[PATCH] getmntent()->mnt_type values that match Linux...
Ryan C. Gordon
icculus@icculus.org
Mon Mar 19 06:30:00 GMT 2007
There was a discussion quite some time ago about getmntent()'s mnt_type
field:
http://www.cygwin.com/ml/cygwin-developers/2002-09/msg00078.html
...but nothing seems to have come of it. I noticed that Cygwin builds of
PhysicsFS (http://icculus.org/physfs/) don't detect CD-ROM drives since
mnt_type is always "system" or "user" ... this patch changes this to
make an earnest effort to match what a GNU/Linux system would report,
and moves the system/user string to mnt_opts.
Without some solution like this, code external to Cygwin would have to
take heroic measures (#ifdefs and calls into the Win32 API) to figure
out what type of filesystem /cygdrive/f really is.
After patching, here's the output from "mount" for a hard drive with two
NTFS partitions (C: and D:), a CD-ROM drive (E:), a FAT memory stick
(F:), and a Samba share (Z:) ...
$ mount
C:\cygwin\bin on /usr/bin type ntfs (binmode,system)
C:\cygwin\lib on /usr/lib type ntfs (binmode,system)
C:\cygwin on / type ntfs (binmode,system)
c: on /cygdrive/c type ntfs (binmode,noumount,system)
d: on /cygdrive/d type ntfs (binmode,noumount,system)
e: on /cygdrive/e type iso9660 (binmode,noumount,system)
f: on /cygdrive/f type vfat (binmode,noumount,system)
z: on /cygdrive/z type smbfs (binmode,noumount,system)
I haven't noticed any side effects of this patch, but my testing of the
Cygwin system as a whole is fairly limited. Comments welcome.
Patch is against latest CVS.
Thanks,
--ryan.
2007-03-19 Ryan C. Gordon <icculus@icculus.org>
* path.cc (fs_info::update): set and use is_cdrom.
* path.cc (fillout_mntent): set ret.mnt_type to something more
Linux-like, based on data from fs_info. Move "system" and "user"
strings from mnt_type to mnt_opts.
* path.h (struct fs_info): Add is_cdrom field.
* path.h (fs_info::clear): Initialize is_cdrom.
* path.h (struct fs_info): Add IMPLEMENT_STATUS_FLAG(bool,is_cdrom).
* path.h (class path_conv): Add fs_is_cdrom method. Add missing
fs_is_netapp method.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygwin-getmntent-mnt_type-RYAN1.diff
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20070319/d24d62a4/attachment.ksh>
More information about the Cygwin-patches
mailing list