summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-07-23 11:46:06 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-07-23 11:46:06 +0000
commita6131454a5de1af75b06d5dc473ffe4af850b46e (patch)
tree0a8df31a28d35a5126f453cffe4642005b3d3ffe
parent8b1e0815abf421c0d78f569e2601c5041e728900 (diff)
downloadcygnal-a6131454a5de1af75b06d5dc473ffe4af850b46e.tar.gz
cygnal-a6131454a5de1af75b06d5dc473ffe4af850b46e.tar.bz2
cygnal-a6131454a5de1af75b06d5dc473ffe4af850b46e.zip
* mount.h (fs_info::fsn): New member.
(fs_info::clear): Clear fsn. (fs_info::fsname): New read accessor for fsn. * mount.cc (fs_info::update): Fill in fsn member with lowercased filesystem name if filesystem is not well-known. Fall back to "unknown" if filesystem name is missing. (fillout_mntent): Print filesystem name retrieved in fs_info::update rather than static string "unknown".
-rw-r--r--winsup/cygwin/ChangeLog11
-rw-r--r--winsup/cygwin/mount.cc11
-rw-r--r--winsup/cygwin/mount.h9
3 files changed, 28 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7dbbb5c3f..c85fc04e9 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,16 @@
2009-07-23 Corinna Vinschen <corinna@vinschen.de>
+ * mount.h (fs_info::fsn): New member.
+ (fs_info::clear): Clear fsn.
+ (fs_info::fsname): New read accessor for fsn.
+ * mount.cc (fs_info::update): Fill in fsn member with lowercased
+ filesystem name if filesystem is not well-known. Fall back to
+ "unknown" if filesystem name is missing.
+ (fillout_mntent): Print filesystem name retrieved in fs_info::update
+ rather than static string "unknown".
+
+2009-07-23 Corinna Vinschen <corinna@vinschen.de>
+
* mount.cc (fs_info::update): Revert to open filesystem with access set
to READ_CONTROL. If that fails, try additionally with FILE_READ_DATA.
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index 867dab76b..998737d63 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -276,7 +276,14 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
if (is_udf () && wincap.has_broken_udf ())
caseinsensitive (true);
}
-
+ if (!got_fs ())
+ {
+ /* The filesystem name is only used in fillout_mntent and only if
+ the filesystem isn't one of the well-known filesystems anyway. */
+ sys_wcstombs (fsn, sizeof fsn, ffai_buf.ffai.FileSystemName,
+ ffai_buf.ffai.FileSystemNameLength / sizeof (WCHAR));
+ strlwr (fsn);
+ }
has_acls (flags () & FS_PERSISTENT_ACLS);
/* Netapp inodes numbers are fly-by-night. */
hasgood_inode ((has_acls () && !is_netapp ()) || is_nfs ());
@@ -1421,7 +1428,7 @@ fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
else if (mntinfo.is_sunwnfs ())
strcpy (_my_tls.locals.mnt_type, (char *) "sunwnfs");
else
- strcpy (_my_tls.locals.mnt_type, (char *) "unknown");
+ strcpy (_my_tls.locals.mnt_type, mntinfo.fsname ());
ret.mnt_type = _my_tls.locals.mnt_type;
diff --git a/winsup/cygwin/mount.h b/winsup/cygwin/mount.h
index c169ca33b..8876bbe13 100644
--- a/winsup/cygwin/mount.h
+++ b/winsup/cygwin/mount.h
@@ -43,10 +43,16 @@ class fs_info
};
} status;
ULONG sernum;
+ char fsn[80];
unsigned long got_fs () { return status.fs_flags; }
public:
- void clear () { memset (&status, 0 , sizeof status); sernum = 0UL; }
+ void clear ()
+ {
+ memset (&status, 0 , sizeof status);
+ sernum = 0UL;
+ fsn[0] = '\0';
+ }
fs_info () { clear (); }
IMPLEMENT_STATUS_FLAG (ULONG, flags)
@@ -71,6 +77,7 @@ class fs_info
int has_buggy_open () const {return is_sunwnfs ();}
int has_buggy_fileid_dirinfo () const {return is_unixfs ();}
+ const char *fsname () const { return fsn[0] ? fsn : "unknown"; }
bool update (PUNICODE_STRING, HANDLE) __attribute__ ((regparm (3)));
};