From 876da7fb748d988a367c7957bbb17a0b0733d290 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 20 Aug 2007 15:16:27 +0000 Subject: * fhandler.cc (rootdir): Delete. * winsup.h (rootdir): Drop declaration. --- winsup/cygwin/ChangeLog | 5 +++ winsup/cygwin/fhandler.cc | 89 ----------------------------------------------- winsup/cygwin/winsup.h | 1 - 3 files changed, 5 insertions(+), 90 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b2dd5c2..38b6d7c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2007-08-20 Corinna Vinschen + + * fhandler.cc (rootdir): Delete. + * winsup.h (rootdir): Drop declaration. + 2007-08-19 Corinna Vinschen * path.cc (fillout_mntent): Append backslash to drive-only paths before diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 8b180b1..dadb90e 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1008,95 +1008,6 @@ fhandler_base::lock (int, struct __flock64 *) return -1; } -extern "C" char * __stdcall -rootdir (const char *full_path, char *root_path) -{ - /* Possible choices: - * d:... -> d:/ - * \\server\share... -> \\server\share\ - */ - int len; - char *rootp = root_path; - - if (full_path[1] == ':') - { - *rootp++ = *full_path; - *rootp++ = ':'; - } - else if (full_path[0] == '\\' && full_path[1] == '\\') - { - const char *cp = strchr (full_path + 2, '\\'); - if (!cp) - return NULL; - while (*++cp && *cp != '\\') - ; - memcpy (root_path, full_path, (len = cp - full_path)); - rootp = root_path + len; - } - else - return NULL; - - *rootp++ = '\\'; - *rootp = '\0'; - - /* This determines whether reparse points are available. Volume reparse - points on remote shares are neither recognized by Windows functions - like GetVolumeInformation, nor by their native NT counterparts. */ - if (!wincap.has_guid_volumes () || GetDriveType (root_path) == DRIVE_REMOTE) - return root_path; - - PREPARSE_DATA_BUFFER rp = (PREPARSE_DATA_BUFFER) - alloca (MAXIMUM_REPARSE_DATA_BUFFER_SIZE); - - char *test_path = (char *) alloca (CYG_MAX_PATH); - strcpy (test_path, full_path); - - /* This determines the minimum length of the path we test for mount points. - If we're below this value, it's the root dir of the path itself. */ - char *min_c = test_path + (rootp - root_path); - char *c = min_c; - while (*c) - ++c; - while (c > min_c) - { - *c = '\0'; - -# define MOUNTPT_ATTR (FILE_ATTRIBUTE_DIRECTORY \ - | FILE_ATTRIBUTE_REPARSE_POINT) - DWORD attr = GetFileAttributes (test_path); - if (attr != INVALID_FILE_ATTRIBUTES - && (attr & MOUNTPT_ATTR) == MOUNTPT_ATTR) - { - HANDLE h = CreateFile (test_path, GENERIC_READ, FILE_SHARE_READ, - &sec_none_nih, OPEN_EXISTING, - FILE_FLAG_OPEN_REPARSE_POINT - | FILE_FLAG_BACKUP_SEMANTICS, NULL); - if (h != INVALID_HANDLE_VALUE) - { - DWORD size; - BOOL ret = DeviceIoControl (h, FSCTL_GET_REPARSE_POINT, NULL, - 0, (LPVOID) rp, - MAXIMUM_REPARSE_DATA_BUFFER_SIZE, - &size, NULL); - CloseHandle (h); - if (ret - && rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT - && !rp->SymbolicLinkReparseBuffer.PrintNameLength) - { - memcpy (root_path, test_path, len = c - test_path); - strcpy (root_path + len, "\\"); - CloseHandle (h); - break; - } - } - } - while (--c > min_c && *c != '\\') - ; - } - - return root_path; -} - int __stdcall fhandler_base::fstat (struct __stat64 *buf) { diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 9e949e8..034fba1 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -261,7 +261,6 @@ __ino64_t __stdcall hash_path_name (__ino64_t hash, PUNICODE_STRING name) __attr __ino64_t __stdcall hash_path_name (__ino64_t hash, PCWSTR name) __attribute__ ((regparm(2))); __ino64_t __stdcall hash_path_name (__ino64_t hash, const char *name) __attribute__ ((regparm(2))); void __stdcall nofinalslash (const char *src, char *dst) __attribute__ ((regparm(2))); -extern "C" char *__stdcall rootdir (const char *full_path, char *root_path) __attribute__ ((regparm(2))); /* String manipulation */ extern "C" char *__stdcall strccpy (char *s1, const char **s2, char c); -- cgit v1.1