exposing Windows mountpoints in Cygwin
Jeremy Drake
cygwin@jdrake.com
Fri Feb 7 19:19:47 GMT 2025
On Fri, 7 Feb 2025, Corinna Vinschen via Cygwin wrote:
> On Feb 6 13:31, Jeremy Drake via Cygwin wrote:
> > Now that my patch to escape characters in /proc/mounts has been applied,
> > I'll get back to what I was thinking about back in June. I would like to
> > have a way to list Windows volume roots in Cygwin, and it seems to make
> > sense to me to expose them via getmntent, /proc/mounts, etc. The way I
> > see this working is probably to replace the available_drives mechanism for
> > enumerating mounts in favor of using FindFirst/NextVolumeW and
> > GetVolumePathNamesForVolumeNameW to enumerate cygdrive mount points.
>
> Been there, done that, but that was more than 10 years ago, so things
> might have changed. At the time, the volume manager was incredibly
> slow. Enumerating and converting volume paths from one style into the
> other just took too much time. And, as you know, Cygwin already is
> slow...
>
> Still, if you want to do that, it should not be part of the standard
> mount points becasue this is another level of implementation. These are
> the POSIX mount points handled by Cygwin. That should be part of the
> cygdrive handling. Sounds like you were mulling over this anyway.
Right, the cygdrive_getmntent function in mount.cc.
> But it's not quite clear what the expected output should be.
> So what is the expected output in the cygdrive dir?
>
> What I could imagine is something like this. Assuming two drives, one
> of them mounted into a dir:
>
> C: \Device\HarddiskVolume1
> C:\foo \Device\HarddiskVolume2
>
> $ ls -gG /cygdrive
> d---r-x---+ 1 0 Feb 7 03:38 c
> drwxrwxr-x 1 0 Jan 8 11:02 c_foo -> /mnt/c/foo
I'm thinking much simpler than that. I'm just thinking about enumerating
directory mounts in the cygdrive_getmntent function. So /cygdrive looks
the same as it does now, just the roots of drives, but for instance mount
would show something like
C: on /cygdrive/c type ntfs (binary,noacl,posix=0,user,noumount,auto)
C:/foo on /cygdrive/c/foo type ntfs (binary,noacl,posix=0,user,noumount,auto)
Presumably this would also make df privy to them.
More information about the Cygwin
mailing list