OSDN Git Service

* fhandler.cc (rootdir): Delete.
authorcorinna <corinna>
Mon, 20 Aug 2007 15:16:26 +0000 (15:16 +0000)
committercorinna <corinna>
Mon, 20 Aug 2007 15:16:26 +0000 (15:16 +0000)
* winsup.h (rootdir): Drop declaration.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler.cc
winsup/cygwin/winsup.h

index b2dd5c2..38b6d7c 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-20  Corinna Vinschen  <corinna@vinschen.de>
+
+       * fhandler.cc (rootdir): Delete.
+       * winsup.h (rootdir): Drop declaration.
+
 2007-08-19  Corinna Vinschen  <corinna@vinschen.de>
 
        * path.cc (fillout_mntent): Append backslash to drive-only paths before
index 8b180b1..dadb90e 100644 (file)
@@ -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)
 {
index 9e949e8..034fba1 100644 (file)
@@ -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);