Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-07-27 13:00:12 +0400
committerCorinna Vinschen <corinna@vinschen.de>2007-07-27 13:00:12 +0400
commit655639ba89fd6f9ca760b052981394cca04e49c9 (patch)
tree6a071244c7d71b8b13500048939a87e9f4e025de
parentfe7bbe1504adc15d6d9af71a508cc305fb3f04a1 (diff)
* fhandler_disk_file.cc (is_volume_mountpoint): New static inline
function. (path_conv::ndisk_links): Call is_volume_mountpoint. (fhandler_disk_file::readdir_helper): Ditto.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc73
2 files changed, 40 insertions, 40 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 0054a280a..ca68bb8bd 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
2007-07-27 Corinna Vinschen <corinna@vinschen.de>
+ * fhandler_disk_file.cc (is_volume_mountpoint): New static inline
+ function.
+ (path_conv::ndisk_links): Call is_volume_mountpoint.
+ (fhandler_disk_file::readdir_helper): Ditto.
+
+2007-07-27 Corinna Vinschen <corinna@vinschen.de>
+
* fhandler.h (enum query_state): Drop redundant query_stat_control.
* fhandler.cc (fhandler_base::open): Ditto. Add READ_CONTROL to
access and FILE_OPEN_FOR_BACKUP_INTENT to create_options when opening
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index ac81a0832..bebc225e3 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -144,6 +144,31 @@ public:
void rewind () { memset (found, 0, sizeof found); }
};
+static inline bool
+is_volume_mountpoint (POBJECT_ATTRIBUTES attr)
+{
+ bool ret = false;
+ IO_STATUS_BLOCK io;
+ HANDLE reph;
+
+ if (NT_SUCCESS (NtOpenFile (&reph, READ_CONTROL, attr, &io,
+ FILE_SHARE_VALID_FLAGS,
+ FILE_OPEN_FOR_BACKUP_INTENT
+ | FILE_OPEN_REPARSE_POINT)))
+ {
+ PREPARSE_DATA_BUFFER rp = (PREPARSE_DATA_BUFFER)
+ alloca (MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
+ if (NT_SUCCESS (NtFsControlFile (reph, NULL, NULL, NULL,
+ &io, FSCTL_GET_REPARSE_POINT, NULL, 0,
+ (LPVOID) rp, MAXIMUM_REPARSE_DATA_BUFFER_SIZE))
+ && rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT
+ && rp->SymbolicLinkReparseBuffer.PrintNameLength == 0)
+ ret = true;
+ NtClose (reph);
+ }
+ return ret;
+}
+
unsigned __stdcall
path_conv::ndisk_links (DWORD nNumberOfLinks)
{
@@ -164,7 +189,6 @@ path_conv::ndisk_links (DWORD nNumberOfLinks)
unsigned count = 0;
bool first = true;
- NTSTATUS status;
PFILE_DIRECTORY_INFORMATION fdibuf = (PFILE_DIRECTORY_INFORMATION)
alloca (65536);
__DIR_mounts *dir = new __DIR_mounts (normalized_path);
@@ -197,28 +221,14 @@ path_conv::ndisk_links (DWORD nNumberOfLinks)
case FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT:
/* Volume mount point or symlink to directory */
{
- HANDLE reph;
UNICODE_STRING fname;
RtlInitCountedUnicodeString (&fname, pfdi->FileNameLength,
pfdi->FileName);
InitializeObjectAttributes (&attr, &fname,
OBJ_CASE_INSENSITIVE, fh, NULL);
- if (NT_SUCCESS (status = NtOpenFile (&reph, READ_CONTROL, &attr, &io,
- FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
- | FILE_OPEN_REPARSE_POINT)))
- {
- PREPARSE_DATA_BUFFER rp = (PREPARSE_DATA_BUFFER)
- alloca (MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
- if (NT_SUCCESS (NtFsControlFile (reph, NULL, NULL, NULL,
- &io, FSCTL_GET_REPARSE_POINT, NULL, 0,
- (LPVOID) rp, MAXIMUM_REPARSE_DATA_BUFFER_SIZE))
- && rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT
- && rp->SymbolicLinkReparseBuffer.PrintNameLength == 0)
- ++count;
- NtClose (reph);
- }
+ if (is_volume_mountpoint (&attr))
+ ++count;
}
break;
default:
@@ -1774,30 +1784,13 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err,
InitializeObjectAttributes (&attr, fname, OBJ_CASE_INSENSITIVE,
get_handle (), NULL);
- if (NT_SUCCESS (NtOpenFile (&reph, READ_CONTROL, &attr, &io,
- FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT
- | FILE_OPEN_REPARSE_POINT)))
+ if (is_volume_mountpoint (&attr)
+ && (NT_SUCCESS (NtOpenFile (&reph, READ_CONTROL, &attr, &io,
+ FILE_SHARE_VALID_FLAGS,
+ FILE_OPEN_FOR_BACKUP_INTENT))))
{
- PREPARSE_DATA_BUFFER rp = (PREPARSE_DATA_BUFFER)
- alloca (MAXIMUM_REPARSE_DATA_BUFFER_SIZE);
- if (NT_SUCCESS (NtFsControlFile (reph, NULL, NULL, NULL,
- &io, FSCTL_GET_REPARSE_POINT, NULL, 0,
- (LPVOID) rp, MAXIMUM_REPARSE_DATA_BUFFER_SIZE))
- && rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT
- && rp->SymbolicLinkReparseBuffer.PrintNameLength == 0)
- {
- NtClose (reph);
- if (NT_SUCCESS (NtOpenFile (&reph, READ_CONTROL, &attr, &io,
- FILE_SHARE_VALID_FLAGS,
- FILE_OPEN_FOR_BACKUP_INTENT)))
- {
- de->d_ino = readdir_get_ino_by_handle (reph);
- NtClose (reph);
- }
- }
- else
- NtClose (reph);
+ de->d_ino = readdir_get_ino_by_handle (reph);
+ NtClose (reph);
}
}