# Device names in /proc/mounts

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Jul 27 09:41:00 GMT 2011

On Jul 27 10:35, Schwarz, Konrad wrote:
> > From: Corinna Vinschen
> > On Jul 25 14:29, Schwarz, Konrad wrote:
> > > There seems no way of mapping device names (resp. Win32 Device
> > > Namespace names) to mount points --
> >
> > Cygwin mount pounts are not mapping disk devices to POSIX
> > pathnames, but
> > Win32 pathnames to POSIX pathnames.
>
> That is incompatibile with Linux's /proc/mount and mount(8).

Yes.  Cygwin is *not* an operating system.  It does not mount devices.
That's the task of the NT kernel as in

"\??\C:" ==> "\Device\HarddiskVolume2".

Cygwin mount points are mapping from a POSIX to a Win32 path, nothing
else.  That's how it is defined.

> Furthermore, Cygwin is inconsistent in this respect, as it uses
> POSIX disk device names elsewhere, e.g., in the output of blkid(8).
>
> I would like to find the mount point of a disk using its volume label (or UUID).
> blk_id (on both Linux and Cygwin) outputs a string of the form /dev/sdXY,
> given a volume label as an argument.

As I wrote before, the /dev device names are only used for raw device
access, not for the mount table.  Given that the mount table contains
paths like:

D:/foo/bar /baz xyz binary,posix=0 0 0
//server/share/some/path /home/dummy smbfs binary,noacl 0 0

how would you map them to devices?  Both paths are not devices,
except that they are equivalent to the NT kernel paths

\Device\HarddiskVolume3\foo\bar
\Device\Mup\server\share\some\path

> In Cygwin, there is no way of figuring out where /dev/sdXY is mounted.

Yes, for the simple reason that they are not mounted in Cygwin, but
only in NT.  What you're asking for just doesn't make sense in this
context.

> > http://www.cygwin.com/cygwin-ug-net/using-specialnames.html#pa
> > thnames-proc-registry).
> > > It does not explain how to decode the information there --
> > but neither does MSDN.
> >
> > Huh?  This is just an example for the virtual /proc/registry access.
> > It has nothing to do with device mapping.
>
> I merely find it telling that the key
> used in the example is the one you would need to map between NT names
> for disks and DOS/Win32 names -- this is the section right after the
> one you refer to below.

Ok, here's my official reply:  This was just some example.  It was
not written with any ulterior motive.  I just opened regedit and
searched for a nice registry key to use as an example.  It was not
even written at the same time I rewrote the preceeding chapters.  I'm
sorry that you misinterpreted it, but the fact that the example was in
another, unrelated section of the user's guide could have been used as a
clue.

> > http://www.cygwin.com/cygwin-ug-net/using-specialnames.html#pa
> > thnames-posixdevices
> > instead, which shows how POSIX devices are mapped to native
> > NT devices.
>
> But that is not enough.  What is missing is how to map POSIX device
> names to Cygwin mount points.  (This mapping obviously goes
> from POSIX device names to NT devices to DOS/Win32 names to
> Cygwin mount point, but the link from NT devices to DOS/Win32
> names is missing.)

No.  POSIX devices are not mounted at all.  Win32 paths are.
POSIX devices are only used for raw device access.  There is no
mapping from POSIX device to POSIX path.

> > No.  As I wrote above, Cygwin mount pounts are not mapping devices but
> > Win32 pathnames to POSIX pathnames.  Devices just don't make
> > sense in this context.  The mapping from NT devices to POSIX
> > devices is used for direct device access only.
>
> Well, since Win32 pathnames corresponding to volumes have NT device names,
> and NT device names have Cygwin device names, wouldn't it be more consistent
> to use the Cygwin device names in those Cygwin mount points?

No.  There is no reason to carry the Linux compatibility to such
extremes.  Forcing the users to use device names in /etc/fstab just
won't fly.  Let's use the above two examples again:

D:/foo/bar /baz xyz binary,posix=0 0 0
//server/share/some/path /home/dummy smbfs binary,noacl 0 0

What would you like to see in fstab for both of them?

/Device/HarddiskVolume3/foo/bar /baz xyz binary,posix=0 0 0

or

/dev/sdb1/foo/bar /baz xyz binary,posix=0 0 0

Both are not Linux compatible either, since you can't use expressions
like /dev/sdb1/foo/bar under Linux to access subdirectories on a drive.

/Device/Mup/server/share/some/path /home/dummy smbfs binary,noacl 0 0

Where's the POSIX device here?  There is none.  Do you want to invent
one, like, say, /dev/mup?  There's no equivalent device on Linux.
Again, not Linux compatible.  Cygwin tries to have a Linux-like API.
But it's running on Win32.  So there are limitation what we can do
and what makes sense, given the context.

Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple