delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/11/08/09:54:10

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Date: Wed, 8 Nov 2000 08:52:54 -0500
From: Jason Tishler <Jason DOT Tishler AT dothill DOT com>
To: cygwin-developers AT sources DOT redhat DOT com
Subject: Re: mount --show-cygdrive-prefixes patch
Message-ID: <20001108085254.C388@dothill.com>
References: <20001106232857 DOT A108 AT dothill DOT com> <20001107000018 DOT C29268 AT redhat DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <20001107000018.C29268@redhat.com>; from cgf@redhat.com on Tue, Nov 07, 2000 at 12:00:18AM -0500
Organization: Dot Hill Systems Corp.

--FpCFWTWefPd4/VPz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

See attached for the second version of my patch that enhances mount
--show-cygdrive-prefixes to display the flags too.  This version
allows the old mount (and other programs that expect the original
CW_GET_CYGDRIVE_PREFIXES functionality) to continue to run without
crashing with the new version of the DLL.

The following is the cygwin ChangeLog:

Wed Nov  8 08:49:27 2000 Jason Tishler <jt AT dothill DOT com>

	* external.cc (get_cygdrive_info): New function.
	* external.cc (get_cygdrive_prefixes): Change to use get_cygdrive_info
	but toss the user and system flags.
	* external.cc (cygwin_internal): Add new CW_GET_CYGDRIVE_INFO case.
	* path.cc (mount_info::get_cygdrive_prefixes): Remove method.
	* path.cc (mount_info::get_cygdrive_info): New method.  Actually,
	get_cygdrive_info is really an enhanced version of get_cygdrive_prefixes
	renamed to get_cygdrive_info that also gets the user and system flags.
	* shared_info.h (get_cygdrive_prefixes): Remove method.
	* shared_info.h (get_cygdrive_info): New method.
	* include/cygwin/version.h: Bump minor API version due to adding
	CW_GET_CYGDRIVE_INFO to cygwin_internal.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_CYGDRIVE_INFO.

The following is the utils ChangeLog:

Wed Nov  8 08:49:27 2000 Jason Tishler <jt AT dothill DOT com>

	* mount.cc (main): Call show_cygdrive_info instead of
	show_cygdrive_prefixes.
	* mount.cc (show_cygdrive_prefixes): Remove function.
	* mount.cc (show_cygdrive_info): New function.  Actually,
	show_cygdrive_info is really an enhanced version of
	show_cygdrive_prefixes renamed to show_cygdrive_info that also displays
	the user and system flags.

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corporation         Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason DOT Tishler AT dothill DOT com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

--FpCFWTWefPd4/VPz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="MountShowCygdrive-2.patch"

Index: cygwin/external.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/external.cc,v
retrieving revision 1.18
diff -u -p -r1.18 external.cc
--- external.cc	2000/11/05 06:42:23	1.18
+++ external.cc	2000/11/08 13:23:40
@@ -88,13 +88,24 @@ fillout_pinfo (pid_t pid, int winpid)
 }
 
 static DWORD
-get_cygdrive_prefixes (char *user, char *system)
+get_cygdrive_info (char *user, char *system, char *user_flags,
+	           char *system_flags)
 {
   shared_info *info = cygwin_getshared();
-  int res = info->mount.get_cygdrive_prefixes(user, system);
+  int res = info->mount.get_cygdrive_info (user, system, user_flags,
+				          system_flags);
   return (res == ERROR_SUCCESS) ? 1 : 0;
 }
 
+static DWORD
+get_cygdrive_prefixes (char *user, char *system)
+{
+  char user_flags[MAX_PATH];
+  char system_flags[MAX_PATH];
+  DWORD res = get_cygdrive_info (user, system, user_flags, system_flags);
+  return res;
+}
+
 extern "C" DWORD
 cygwin_internal (cygwin_getinfo_types t, ...)
 {
@@ -150,6 +161,15 @@ cygwin_internal (cygwin_getinfo_types t,
       case CW_INIT_EXCEPTIONS:
 	init_exceptions ((exception_list *) arg);
 	return 0;
+
+      case CW_GET_CYGDRIVE_INFO:
+	{
+	  char *user = va_arg (arg, char *);
+	  char *system = va_arg (arg, char *);
+	  char *user_flags = va_arg (arg, char *);
+	  char *system_flags = va_arg (arg, char *);
+	  return get_cygdrive_info (user, system, user_flags, system_flags);
+	}
 
       default:
 	return (DWORD) -1;
Index: cygwin/path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.78
diff -u -p -r1.78 path.cc
--- path.cc	2000/11/06 16:40:29	1.78
+++ path.cc	2000/11/08 13:23:43
@@ -1623,12 +1623,20 @@ mount_info::remove_cygdrive_info_from_re
 }
 
 int
-mount_info::get_cygdrive_prefixes (char *user, char *system)
+mount_info::get_cygdrive_info (char *user, char *system, char* user_flags,
+			       char* system_flags)
 {
   /* Get the user path prefix from HKEY_CURRENT_USER. */
   reg_key r;
   int res = r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, user, MAX_PATH, "");
 
+  /* Get the user flags, if appropriate */
+  if (res == ERROR_SUCCESS)
+    {
+      int flags = r.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO);
+      strcpy (user_flags, (flags & MOUNT_BINARY) ? "binmode" : "textmode");
+    }
+
   /* Get the system path prefix from HKEY_LOCAL_MACHINE. */
   reg_key r2 (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE",
 	      CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
@@ -1636,6 +1644,13 @@ mount_info::get_cygdrive_prefixes (char 
 	      CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
 	      NULL);
   int res2 = r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, system, MAX_PATH, "");
+
+  /* Get the system flags, if appropriate */
+  if (res2 == ERROR_SUCCESS)
+    {
+      int flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO);
+      strcpy (system_flags, (flags & MOUNT_BINARY) ? "binmode" : "textmode");
+    }
 
   return (res != ERROR_SUCCESS) ? res : res2;
 }
Index: cygwin/shared_info.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/shared_info.h,v
retrieving revision 1.2
diff -u -p -r1.2 shared_info.h
--- shared_info.h	2000/09/08 02:56:55	1.2
+++ shared_info.h	2000/11/08 13:23:43
@@ -85,7 +85,8 @@ public:
 
   int write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsigned flags);
   int remove_cygdrive_info_from_registry (const char *cygdrive_prefix, unsigned flags);
-  int get_cygdrive_prefixes (char *user, char *system);
+  int get_cygdrive_info (char *user, char *system, char* user_flags,
+		         char* system_flags);
 
   void import_v1_mounts ();
 
Index: cygwin/include/cygwin/version.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/version.h,v
retrieving revision 1.21
diff -u -p -r1.21 version.h
--- version.h	2000/11/07 02:21:33	1.21
+++ version.h	2000/11/08 13:23:45
@@ -119,10 +119,11 @@ details. */
        27: CW_GETPINFO_FULL addition to external.cc
        28: Accidentally bumped by cgf
        29: Export hstrerror
+       30: CW_GET_CYGDRIVE_INFO addition to external.cc
      */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 29
+#define CYGWIN_VERSION_API_MINOR 30
 
      /* There is also a compatibity version number associated with the
 	shared memory regions.  It is incremented when incompatible
Index: cygwin/include/sys/cygwin.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/sys/cygwin.h,v
retrieving revision 1.21
diff -u -p -r1.21 cygwin.h
--- cygwin.h	2000/11/03 04:27:03	1.21
+++ cygwin.h	2000/11/08 13:23:45
@@ -58,7 +58,8 @@ typedef enum
     CW_PERFILE,
     CW_GET_CYGDRIVE_PREFIXES,
     CW_GETPINFO_FULL,
-    CW_INIT_EXCEPTIONS
+    CW_INIT_EXCEPTIONS,
+    CW_GET_CYGDRIVE_INFO
   } cygwin_getinfo_types;
 
 #define CW_NEXTPID 0x80000000	// or with pid to get next one
Index: utils/mount.cc
===================================================================
RCS file: /cvs/src/src/winsup/utils/mount.cc,v
retrieving revision 1.9
diff -u -p -r1.9 mount.cc
--- mount.cc	2000/10/28 05:00:00	1.9
+++ mount.cc	2000/11/08 13:23:53
@@ -22,7 +22,7 @@ details. */
 #include <errno.h>
 
 static void show_mounts (void);
-static void show_cygdrive_prefixes (void);
+static void show_cygdrive_info (void);
 static void change_cygdrive_prefix (const char *new_prefix, int flags);
 static int mount_already_exists (const char *posix_path, int flags);
 
@@ -144,7 +144,7 @@ main (int argc, const char **argv)
 	  if ((i + 1) != argc)
 	    usage ();
 
-	  show_cygdrive_prefixes ();
+	  show_cygdrive_info ();
 	}
       else if (strcmp (argv[i], "-b") == 0)
 	flags |= MOUNT_BINARY;
@@ -263,23 +263,27 @@ change_cygdrive_prefix (const char *new_
   exit (0);
 }
 
-/* show_cygdrive_prefixes: Show the user and/or cygdrive path prefixes */
+/* show_cygdrive_info: Show the user and/or cygdrive info, i.e., prefixes and
+   flags.*/
 static void
-show_cygdrive_prefixes ()
+show_cygdrive_info ()
 {
-  /* Get the Cygdrive user and system path prefixes */
+  /* Get the cygdrive info */
   char user[MAX_PATH];
   char system[MAX_PATH];
-  cygwin_internal (CW_GET_CYGDRIVE_PREFIXES, user, system);
+  char user_flags[MAX_PATH];
+  char system_flags[MAX_PATH];
+  cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags,
+		   system_flags);
 
   /* Display the user and system cygdrive path prefixes, if necessary
      (ie, not empty) */
-  const char *format = "%-18s  %-11s\n";
-  printf (format, "Prefix", "Type");
+  const char *format = "%-18s  %-11s  %s\n";
+  printf (format, "Prefix", "Type", "Flags");
   if (strlen (user) > 0)
-    printf (format, user, "user");
+    printf (format, user, "user", user_flags);
   if (strlen (system) > 0)
-    printf (format, system, "system");
+    printf (format, system, "system", system_flags);
 
   exit (0);
 }

--FpCFWTWefPd4/VPz--

- Raw text -


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