RE: Devices as files

Hi,

Does someone know the reason behind this design
decision - to have an object namespace that is not
tied to a filesystem?

The obvious disadvantage is that regular filesystem
commands can’t be run on this namespace.

Just trying to understand…

Thanks in advance for any comments.

Regards,
Manoj

----- Original Message -----
Subject: Re: Devices as files
From: “Maxim S. Shatskih”
Date: Thu, 4 Nov 2004 17:59:56 +0300

> Surely, but this namespace is not part of the
> filesystem, so you cannot do DIR on it. It is the in

> memory namespace, which can be browsed using
> undocumented syscalls.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Manoj Paul Joseph”
> To: “Windows System Software Devs Interest List”
> Sent: Thursday, November 04, 2004 5:47 PM
> Subject: [ntdev] Devices as files
>
>
>> Hi,
>>
>> In the Windows world, is there a way to access
devices
>> from user space like the way they do in Unix?
>> Like /dev/dsk…
>>
>> Is the global namespace accessible to applications
>> using just the win32 api?
>>
>> Thanks,
>> Manoj

__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo

Not sure, but making devices part of the filesystem was an illogical
hack in the first place it was done…

While devices share a very small number of things in common with files,
they are a lot more different than they are similar.

What “regular filesystem commands” were you interested in running on
that namespace?

Anyway, non-GUID based names are just a disaster waiting to happen. This
is true even to the limited extent that Windows support them for
devices. Device interfaces are the way of the future (at least for
Windows). Good riddance to device namespaces.

Now if only there were a trivial way to create a user-reachable device
interface from a filter driver…

Manoj Paul Joseph wrote:

Hi,

Does someone know the reason behind this design
decision - to have an object namespace that is not
tied to a filesystem?

The obvious disadvantage is that regular filesystem
commands can’t be run on this namespace.

Just trying to understand…

Thanks in advance for any comments.

Regards,
Manoj

----- Original Message -----
Subject: Re: Devices as files
From: “Maxim S. Shatskih”
> Date: Thu, 4 Nov 2004 17:59:56 +0300
>
>
>> Surely, but this namespace is not part of the
>>filesystem, so you cannot do DIR on it. It is the in
>
>
>>memory namespace, which can be browsed using
>>undocumented syscalls.
>>
>>Maxim Shatskih, Windows DDK MVP
>>StorageCraft Corporation
>>xxxxx@storagecraft.com
>>http://www.storagecraft.com
>>
>>----- Original Message -----
>>From: “Manoj Paul Joseph”
>>To: “Windows System Software Devs Interest List”
>>Sent: Thursday, November 04, 2004 5:47 PM
>>Subject: [ntdev] Devices as files
>>
>>
>>
>>>Hi,
>>>
>>>In the Windows world, is there a way to access
>
> devices
>
>>>from user space like the way they do in Unix?
>>>Like /dev/dsk…
>>>
>>>Is the global namespace accessible to applications
>>>using just the win32 api?
>>>
>>>Thanks,
>>>Manoj
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.
> http://mobile.yahoo.com/maildemo
>


…/ray..

Please remove “.spamblock” from my email address if you need to contact
me outside the newsgroup.

> Not sure, but making devices part of the filesystem was an illogical

hack in the first place it was done…

Two good things in that idea:

  • saving the device access rights on the disk, and using the usual “chmod” for
    devices. Try to update the device’s ACL in Windows. Requires some programming
    and not trivial.
  • ability of use the usual tools like “ls” for devices.

While devices share a very small number of things in common with files,
they are a lot more different than they are similar.

Why? Entity which can be opened by name, supports read/write semantics and
device-specific IOCTLs.

What “regular filesystem commands” were you interested in running on
that namespace?

DIR. ATTRIB. And so on.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Maxim S. Shatskih wrote:

>Not sure, but making devices part of the filesystem was an illogical
>hack in the first place it was done…

  • saving the device access rights on the disk, and using the usual “chmod” for
    devices. Try to update the device’s ACL in Windows. Requires some programming
    and not trivial.
  • ability of use the usual tools like “ls” for devices.

I’m not arguing that there shouldn’t be a way to perform the operations
done by standard tools on devices, but that’s different from making them
part of the filesystem, which requires useless complication in the
standard tools and/or the underlying OS.

It *is* a little weird that the driver is responsible for setting the
access rights of it’s device objects when it creates them. BTW, if you
want a graphical tool to mess with these, WinObj from sysinternals will
let you play with your device DACLs all day long.

But as a general design philosophy, wanting to apply access rights to
the devices assumes you’re going to have different access rights for
different users. For the vast majority of devices this isn’t what you
want. So don’t complicate the normal case in order to make the
extraordinary case easier.

>While devices share a very small number of things in common with files,
>they are a lot more different than they are similar.

Why? Entity which can be opened by name, supports read/write semantics and
device-specific IOCTLs.

Well… maybe because most devices don’t support read/write semantics
without torturing those semantics beyond all recognition? Most devices
that you might want exposed this way are natively read *or* write devices.

Some examples of mostly output devices where “read” semantics don’t make
much sense (except possibly for control information, which doesn’t
really have “read” semantics anyway): printers, video cards, audio cards.

Some examples of mostly input devices where “write” semantics don’t make
much sense (similar caveats): mice, keyboards, other HIDs, scanners,
CD-ROM drives :-).

And then there are all the devices that have neither sensible read nor
write semantics, like disk controllers, processors, and the large
variety of motherboard deviecs out there (bridges, host controllers,
buses, etc., etc.).

In fact, even disks and network devices don’t *really* have read/write
semantics. Files and ports have read/write semantics, but the raw
devices don’t (unless you’re completely insane)… the fact that we’ve
tortured these semantics to *seem* applicable notwithstanding…

>What “regular filesystem commands” were you interested in running on
>that namespace?

DIR. ATTRIB. And so on.

Again, I don’t deny it would be useful to have tools that did these
things for devices (actually, attrib is way too coarse to be useful, and
DIR would just be confusing for “devices” that expose numerous device
objects). It would also be nice if they were persistent :-).

But what’s the charm in having them be the *same* tools? Except for a
few rare cases, there really isn’t anything analogous to do to a device.
An MMC plugin would be much better for this. That way it would also be
hidden from casual users, which is a *very* good thing.

…/ray..

Please remove “.spamblock” from my email address if you need to contact
me outside the newsgroup.

> Some examples of mostly output devices where “read” semantics don’t make

much sense (except possibly for control information, which doesn’t
really have “read” semantics anyway): printers, video cards, audio cards.

Microphone?

Some examples of mostly input devices where “write” semantics don’t make
much sense (similar caveats): mice, keyboards, other HIDs,

LED state? force feedback?

But what’s the charm in having them be the *same* tools?

Simple batch scripts?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Hi Ray, Max,

First, thanks for the responses. Some comments inline.

— Ray Trent wrote:

> I’m not arguing that there shouldn’t be a way to
> perform the operations
> done by standard tools on devices, but that’s
> different from making them
> part of the filesystem, which requires useless
> complication in the
> standard tools and/or the underlying OS.
The way I see it, read/write/ioctl semantics are
already there. No?
It is just not out there as a filesystem.

> But as a general design philosophy, wanting to apply
> access rights to
> the devices assumes you’re going to have different
> access rights for
> different users. For the vast majority of devices
> this isn’t what you
> want. So don’t complicate the normal case in order
> to make the
> extraordinary case easier.
I think fine granularity with respect to access rights
is a good thing. Much better than a root or nobody
philosophy.

> >>What “regular filesystem commands” were you
> interested in running on
> >>that namespace?
> >
> > DIR. ATTRIB. And so on.
>
> Again, I don’t deny it would be useful to have tools
> that did these
> things for devices (actually, attrib is way too
> coarse to be useful, and
> DIR would just be confusing for “devices” that
> expose numerous device
> objects). It would also be nice if they were
> persistent :-).
I would also be nice to set the security ACL using
Explorer. Command line is also ok.

> But what’s the charm in having them be the same
> tools? Except for a
> few rare cases, there really isn’t anything
> analogous to do to a device.
The advantage is that they are 1. already there 2.
easy to use.

Regards,
Manoj

__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo