delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/06/15/13:51:53

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
To: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Re: mount doesn't complain about missing "mount directory" any more?
References: <20000613213415 DOT A20386 AT cygnus DOT com> <s1s66rdq93c DOT fsf AT jaist DOT ac DOT jp>
<20000613225819 DOT A12800 AT cygnus DOT com> <s1s3dmgrjm2 DOT fsf AT jaist DOT ac DOT jp>
<20000614010312 DOT B7392 AT cygnus DOT com> <s1sya47oz1j DOT fsf AT jaist DOT ac DOT jp>
<20000615123419 DOT E5388 AT cygnus DOT com>
Mime-Version: 1.0 (generated by tm-edit 7.106)
From: Kazuhiro Fujieda <fujieda AT jaist DOT ac DOT jp>
Date: 16 Jun 2000 02:32:29 +0900
In-Reply-To: Chris Faylor's message of Thu, 15 Jun 2000 12:34:19 -0400
Message-ID: <s1svgzaq28i.fsf@jaist.ac.jp>
Lines: 108
X-Mailer: Gnus v5.3/Emacs 19.34

>>> On Thu, 15 Jun 2000 12:34:19 -0400
>>> Chris Faylor <cgf AT cygnus DOT com> said:

> Actually, UNIX can mount two devices, too.  I just tried it, and a umount
> removes the first in the mount list.  Is it possible to adapt your patch
> to do that?

On SunOS 5.7, I couldn't mount a block special device on two
different directories. Then I tried a network file system and
found it succeeded. In this case, a umount removes the last in
the list.  Anyway, I tried to tailor my patch to your request.

ChangeLog:
2000-06-15 Kazuhiro Fujieda  <fujieda AT jaist DOT ac DOT jp>
	* path.cc (mount_info::add_item): Eliminate a trailing backslash 
	included in a native path starting with '//[A-Za-z]/...'.
	* path.cc (mount_info::del_item): Accept a native path as its target.

Index: path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.30
diff -u -p -r1.30 path.cc
--- path.cc	2000/06/13 16:48:37	1.30
+++ path.cc	2000/06/15 17:03:16
@@ -1614,10 +1614,8 @@ mount_info::add_item (const char *native
   if (slash_drive_prefix_p (native))
     slash_drive_to_win32_path (native, nativetmp, 0);
   else
-    {
-      backslashify (native, nativetmp, 0);
-      nofinalslash (nativetmp, nativetmp);
-    }
+    backslashify (native, nativetmp, 0);
+  nofinalslash (nativetmp, nativetmp);
 
   slashify (posix, posixtmp, 0);
   nofinalslash (posixtmp, posixtmp);
@@ -1677,36 +1675,49 @@ int
 mount_info::del_item (const char *path, unsigned flags, int reg_p)
 {
   char pathtmp[MAX_PATH];
+  int posix_path_p = FALSE;
 
   /* Something's wrong if path is NULL or empty. */
-  if (path == NULL || *path == 0)
+  if (path == NULL || *path == 0 || !isabspath (path))
     {
       set_errno (EINVAL);
       return -1;
     }
 
-  slashify (path, pathtmp, 0);
+  if (slash_drive_prefix_p (path))
+      slash_drive_to_win32_path (path, pathtmp, 0);
+  else if (slash_unc_prefix_p (path) || strpbrk (path, ":\\"))
+      backslashify (path, pathtmp, 0);
+  else
+    {
+      slashify (path, pathtmp, 0);
+      posix_path_p = TRUE;
+    }
   nofinalslash (pathtmp, pathtmp);
-
-  debug_printf ("%s[%s]", path, pathtmp);
 
-  if (reg_p && del_reg_mount (pathtmp, flags)
-      && del_reg_mount (path, flags)) /* for old irregular entries */
+  if (reg_p && posix_path_p &&
+      del_reg_mount (pathtmp, flags) &&
+      del_reg_mount (path, flags)) /* for old irregular entries */
     return -1;
 
   for (int i = 0; i < nmounts; i++)
     {
-      /* Delete if paths and mount locations match. */
-      if ((strcasematch (mount[i].posix_path, pathtmp)
-	   || strcasematch (mount[i].native_path, pathtmp)) &&
-	  (mount[i].flags & MOUNT_SYSTEM) == (flags & MOUNT_SYSTEM))
+      int ent = native_sorted[i]; /* in the same order as getmntent() */
+      if (((posix_path_p)
+	   ? strcasematch (mount[ent].posix_path, pathtmp)
+	   : strcasematch (mount[ent].native_path, pathtmp)) &&
+	  (mount[ent].flags & MOUNT_SYSTEM) == (flags & MOUNT_SYSTEM))
 	{
-	  nmounts--;		/* One less mount table entry */
+	  if (!posix_path_p &&
+	      reg_p && del_reg_mount (mount[ent].posix_path, flags))
+	    return -1;
+
+	  nmounts--; /* One less mount table entry */
 	  /* Fill in the hole if not at the end of the table */
-	  if (i < nmounts)
-	    memmove (mount + i, mount + i + 1,
-		     sizeof (mount[i]) * (nmounts - i));
-	  sort ();		/* Resort the table */
+	  if (ent < nmounts)
+	    memmove (mount + ent, mount + ent + 1,
+		     sizeof (mount[ent]) * (nmounts - ent));
+	  sort (); /* Resort the table */
 	  return 0;
 	}
     }

____
  | AIST      Kazuhiro Fujieda <fujieda AT jaist DOT ac DOT jp>
  | HOKURIKU  School of Information Science
o_/ 1990      Japan Advanced Institute of Science and Technology

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019