Brian Dessent wrote:

> > Let me say it again.  This is not new behavior:
> >
> > 2003-08-05  Pavel Tsekov  <ptsekov AT gmx.net>
> >
> >         * path.cc (cygdrive_getmntent): Do not skip over drives of type
> >         DRIVE_REMOVABLE.
> >
> > Perhaps you should be discussing this with Pavel.
> 
> Okay, I misunderstood.  I thought that you were saying someone had
> posted a patch that would prevent checking floppy drives in that section
> of the code.  I now see that it used to be the case that this was done,
> and the above patch removed that functionality.
> 
> I have no idea what Pavel's intentions were with his change.  I can only
> guess it was to support /cygdrive use with some form of removable media,
> perhaps floppy, perhaps otherwise.  However at the time it was
> committed, there was no mount checking code in find, and so there were
> no spurious floppy seeks for opening a login shell and many other
> activities.  I will CC him on this email to see if he wants to clarify.
> It seems to me that making this behavior settable through a CYGWIN env
> option would satisy everyone, but I'm also quite sure that no patch I
> submit to implement this would be accepted, mainly due to not having a
> copyright assignment on file.

Here is a patch.  If $CYGWIN does not contain "removable" (or contains
"noremovable") then /cygdrive's where GetDriveType() returns
DRIVE_REMOVABLE are skipped, avoiding the annoying floppy seeks. 
CYGWIN=removable works the same as current code.

Note: I don't know if this would be considered trivial or not.  Nor do I
know if it satisfies Pavel's needs.  Just thought I'd post it anyway.

2004-12-24  Brian Dessent  <[EMAIL PROTECTED]>

        * environ.cc: Add extern decl for `cygdrive_removable'.
        (struct parse_thing): Add entry for `[no]removable'. 
        * path.cc (cygdrive_getmntent): Ignore drive letters of 
        removable drives, unless `cygdrive_removable' set.
Index: src/winsup/cygwin/environ.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/environ.cc,v
retrieving revision 1.105
diff -u -p -r1.105 environ.cc
--- src/winsup/cygwin/environ.cc        3 Dec 2004 23:49:06 -0000       1.105
+++ src/winsup/cygwin/environ.cc        24 Dec 2004 09:12:45 -0000
@@ -31,6 +31,7 @@ extern bool ignore_case_with_glob;
 extern bool allow_ntea;
 extern bool allow_smbntsec;
 extern bool allow_winsymlinks;
+extern bool cygdrive_removable;
 extern bool strip_title_path;
 extern int pcheck_case;
 extern int subauth_id;
@@ -537,6 +538,7 @@ static struct parse_thing
   {"ntea", {func: set_ntea}, isfunc, NULL, {{0}, {s: "yes"}}},
   {"ntsec", {func: set_ntsec}, isfunc, NULL, {{0}, {s: "yes"}}},
   {"smbntsec", {func: set_smbntsec}, isfunc, NULL, {{0}, {s: "yes"}}},
+  {"removable", {&cygdrive_removable}, justset, NULL, {{false}, {true}}},
   {"reset_com", {&reset_com}, justset, NULL, {{false}, {true}}},
   {"strip_title", {&strip_title_path}, justset, NULL, {{false}, {true}}},
   {"subauth_id", {func: &subauth_id_init}, isfunc, NULL, {{0}, {0}}},
Index: src/winsup/cygwin/path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.335
diff -u -p -r1.335 path.cc
--- src/winsup/cygwin/path.cc   23 Dec 2004 21:37:43 -0000      1.335
+++ src/winsup/cygwin/path.cc   24 Dec 2004 09:12:57 -0000
@@ -2301,6 +2301,9 @@ mount_item::getmntent ()
   return fillout_mntent (native_path, posix_path, flags);
 }
 
+/* If true, removable /cygdrive's should be returned by getmntent() */
+bool cygdrive_removable;
+
 static struct mntent *
 cygdrive_getmntent ()
 {
@@ -2316,7 +2319,8 @@ cygdrive_getmntent ()
          break;
 
       __small_sprintf (native_path, "%c:\\", drive);
-      if (GetFileAttributes (native_path) == INVALID_FILE_ATTRIBUTES)
+      if ((!cygdrive_removable && GetDriveType (native_path) == 
DRIVE_REMOVABLE) ||
+         GetFileAttributes (native_path) == INVALID_FILE_ATTRIBUTES)
        {
          _my_tls.locals.available_drives &= ~mask;
          continue;

Reply via email to