diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-02-18 10:46:53 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-02-18 10:46:53 +0000 |
commit | 408b92dbb5b1bbb81af068f23f8ddf25999da2f4 (patch) | |
tree | 9a7cb8e780dfa3ac8e246c22906ee0905b29066c /winsup/cygwin/fhandler_disk_file.cc | |
parent | 753702223c7de6e18253d1cd89d6bf08cb00630d (diff) | |
download | cygnal-408b92dbb5b1bbb81af068f23f8ddf25999da2f4.tar.gz cygnal-408b92dbb5b1bbb81af068f23f8ddf25999da2f4.tar.bz2 cygnal-408b92dbb5b1bbb81af068f23f8ddf25999da2f4.zip |
* fhandler_disk_file.cc (FS_IS_SAMBA): Move out of
path_conv::hasgood_inode.
(path_conv::is_samba): New method.
(fhandler_base::fstat_by_handle): Don't even try to use
FileIdBothDirectoryInformation on Samba.
* path.h (class path_conv): Declare is_samba method.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 3d286ebe9..2445eb279 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -96,6 +96,10 @@ path_conv::ndisk_links (DWORD nNumberOfLinks) return count + saw_dot; } +#define FS_IS_SAMBA (FILE_CASE_SENSITIVE_SEARCH \ + | FILE_CASE_PRESERVED_NAMES \ + | FILE_PERSISTENT_ACLS) + bool path_conv::hasgood_inode () { @@ -117,10 +121,7 @@ path_conv::hasgood_inode () An exception is Samba, which seems to return valid inode numbers without having the FILE_SUPPORTS_OBJECT_IDS flag set. So we're testing for the flag values returned by a 3.x Samba explicitely - for now. */ -#define FS_IS_SAMBA (FILE_CASE_SENSITIVE_SEARCH \ - | FILE_CASE_PRESERVED_NAMES \ - | FILE_PERSISTENT_ACLS) + for now. But note the comment in the below "is_samba" function. */ if (!(fs_flags () & FILE_SUPPORTS_OBJECT_IDS) && fs_flags () != FS_IS_SAMBA) return false; @@ -128,6 +129,25 @@ path_conv::hasgood_inode () return true; } +bool +path_conv::is_samba () +{ + /* Something weird happens on Samba. FileIdBothDirectoryInformation + seems to work nicely, but only up to the 128th entry in the + directory. After reaching this entry, the next call to + NtQueryDirectoryFile(FileIdBothDirectoryInformation) returns + STATUS_INVAILD_LEVEL. Why should we care, we can just switch to + FileBothDirectoryInformation, isn't it? Nope! The next call to + NtQueryDirectoryFile(FileBothDirectoryInformation) actually returns + STATUS_NO_MORE_FILES, regardless how many files are left unread in + the directory. This does not happen when using + FileBothDirectoryInformation right from the start. In that case we + can read the whole directory unmolested. So we have to excempt + Samba from the usage of FileIdBothDirectoryInformation entirely, + even though Samba returns valid File IDs. */ + return drive_type () == DRIVE_REMOTE && fs_flags () == FS_IS_SAMBA; +} + int __stdcall fhandler_base::fstat_by_handle (struct __stat64 *buf) { @@ -1461,7 +1481,7 @@ fhandler_disk_file::opendir () if (pc.hasgood_inode ()) { dir->__flags |= dirent_set_d_ino; - if (wincap.has_fileid_dirinfo ()) + if (wincap.has_fileid_dirinfo () && !pc.is_samba ()) dir->__flags |= dirent_get_d_ino; } } |