* external.cc (cygwin_internal): Make v1 mount table access invalid.
* path.cc (mount_info::init): Remove had_to_create_mount_areas initialization. (mount_info::from_registry): Remove v1 table import. (mount_info::read_v1_mounts): Eliminate. (mount_info::import_v1_mounts): Ditto. * shared_info.h (mount_info): Ditto for both of above. * sys/mount.h (MOUNT_DEVFS): New enum. (MOUNT_PROC): Ditto.
This commit is contained in:
		| @@ -1,3 +1,14 @@ | ||||
| 2002-06-08  Christopher Faylor  <cgf@redhat.com> | ||||
|  | ||||
| 	* external.cc (cygwin_internal): Make v1 mount table access invalid. | ||||
| 	* path.cc (mount_info::init): Remove had_to_create_mount_areas initialization. | ||||
| 	(mount_info::from_registry): Remove v1 table import. | ||||
| 	(mount_info::read_v1_mounts): Eliminate. | ||||
| 	(mount_info::import_v1_mounts): Ditto. | ||||
| 	* shared_info.h (mount_info): Ditto for both of above. | ||||
| 	* sys/mount.h (MOUNT_DEVFS): New enum. | ||||
| 	(MOUNT_PROC): Ditto. | ||||
|  | ||||
| 2002-06-08  Christopher Faylor  <cgf@redhat.com> | ||||
|  | ||||
| 	* include/wchar.h: Define __need_size_t. | ||||
|   | ||||
| @@ -161,9 +161,8 @@ cygwin_internal (cygwin_getinfo_types t, ...) | ||||
| 	return (DWORD) cygwin_version_strings; | ||||
|  | ||||
|       case CW_READ_V1_MOUNT_TABLES: | ||||
| 	/* Upgrade old v1 registry mounts to new location. */ | ||||
| 	mount_table->import_v1_mounts (); | ||||
| 	return 0; | ||||
| 	set_errno (ENOSYS); | ||||
| 	return 1; | ||||
|  | ||||
|       case CW_USER_DATA: | ||||
| 	return (DWORD) &__cygwin_user_data; | ||||
|   | ||||
| @@ -21,12 +21,14 @@ enum | ||||
|   MOUNT_BINARY =	0x002,	/* "binary" format read/writes */ | ||||
|   MOUNT_SYSTEM =	0x008,	/* mount point came from system table */ | ||||
|   MOUNT_EXEC   =	0x010,	/* Any file in the mounted directory gets 'x' bit */ | ||||
|   MOUNT_AUTO   =	0x020,	/* mount point refers to auto device mount */ | ||||
|   MOUNT_CYGDRIVE   =	0x020,	/* mount point refers to cygdriv device mount */ | ||||
|   MOUNT_CYGWIN_EXEC =	0x040,	/* file or directory is or contains a cygwin | ||||
| 				   executable */ | ||||
|   MOUNT_MIXED	=	0x080,	/* reads are text, writes are binary | ||||
| 				   not yet implemented */ | ||||
|   MOUNT_NOTEXEC =	0x100	/* don't check files for executable magic */ | ||||
|   MOUNT_NOTEXEC =	0x100,	/* don't check files for executable magic */ | ||||
|   MOUNT_DEVFS =		0x200,	/* /device "filesystem" */ | ||||
|   MOUNT_PROC =		0x400	/* /proc "filesystem" */ | ||||
| }; | ||||
|  | ||||
| int mount (const char *, const char *, unsigned __flags); | ||||
|   | ||||
| @@ -1334,7 +1334,6 @@ void | ||||
| mount_info::init () | ||||
| { | ||||
|   nmounts = 0; | ||||
|   had_to_create_mount_areas = 0; | ||||
|  | ||||
|   /* Fetch the mount table and cygdrive-related information from | ||||
|      the registry.  */ | ||||
| @@ -1835,11 +1834,6 @@ mount_info::from_registry () | ||||
| 	      CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, | ||||
| 	      NULL); | ||||
|   read_mounts (r1); | ||||
|  | ||||
|   /* If we had to create both user and system mount areas, import | ||||
|      old mounts. */ | ||||
|   if (had_to_create_mount_areas == 2) | ||||
|     import_v1_mounts (); | ||||
| } | ||||
|  | ||||
| /* add_reg_mount: Add mount item to registry.  Return zero on success, | ||||
| @@ -2315,81 +2309,6 @@ mount_info::del_item (const char *path, unsigned flags, int reg_p) | ||||
|   return -1; | ||||
| } | ||||
|  | ||||
| /* read_v1_mounts: Given a reg_key to an old mount table registry area, | ||||
|    read in the mounts.  The "which" arg contains zero if we're reading | ||||
|    the user area and MOUNT_SYSTEM if we're reading the system area. | ||||
|    This way we can store the mounts read in the appropriate place when | ||||
|    they are written back to the new registry layout. */ | ||||
|  | ||||
| void | ||||
| mount_info::read_v1_mounts (reg_key r, unsigned which) | ||||
| { | ||||
|   unsigned mountflags = 0; | ||||
|  | ||||
|   /* MAX_MOUNTS was 30 when we stopped using the v1 layout */ | ||||
|   for (int i = 0; i < 30; i++) | ||||
|     { | ||||
|       char key_name[10]; | ||||
|       char win32path[MAX_PATH]; | ||||
|       char unixpath[MAX_PATH]; | ||||
|  | ||||
|       __small_sprintf (key_name, "%02x", i); | ||||
|  | ||||
|       reg_key k (r.get_key (), KEY_ALL_ACCESS, key_name, NULL); | ||||
|  | ||||
|       /* The registry names are historical but useful so are left alone.  */ | ||||
|       k.get_string ("native", win32path, sizeof (win32path), ""); | ||||
|       k.get_string ("unix", unixpath, sizeof (unixpath), ""); | ||||
|  | ||||
|       /* Does this entry contain something?  */ | ||||
|       if (*win32path != 0) | ||||
| 	{ | ||||
| 	  mountflags = 0; | ||||
|  | ||||
| 	  if (k.get_int ("fbinary", 0)) | ||||
| 	    mountflags |= MOUNT_BINARY; | ||||
|  | ||||
| 	  /* Or in zero or MOUNT_SYSTEM depending on which table | ||||
| 	     we're reading. */ | ||||
| 	  mountflags |= which; | ||||
|  | ||||
| 	  int res = mount_table->add_item (win32path, unixpath, mountflags, TRUE); | ||||
| 	  if (res && get_errno () == EMFILE) | ||||
| 	    break; /* The number of entries exceeds MAX_MOUNTS */ | ||||
| 	} | ||||
|     } | ||||
| } | ||||
|  | ||||
| /* import_v1_mounts: If v1 mounts are present, load them and write | ||||
|    the new entries to the new registry area. */ | ||||
|  | ||||
| void | ||||
| mount_info::import_v1_mounts () | ||||
| { | ||||
|   reg_key r (HKEY_CURRENT_USER, KEY_ALL_ACCESS, | ||||
| 	     "SOFTWARE", | ||||
| 	     "Cygnus Solutions", | ||||
| 	     "CYGWIN.DLL setup", | ||||
| 	     "b15.0", | ||||
| 	     "mounts", | ||||
| 	     NULL); | ||||
|  | ||||
|   nmounts = 0; | ||||
|  | ||||
|   /* First read mounts from user's table. */ | ||||
|   read_v1_mounts (r, 0); | ||||
|  | ||||
|   /* Then read mounts from system-wide mount table. */ | ||||
|   reg_key r1 (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, | ||||
| 	      "SOFTWARE", | ||||
| 	      "Cygnus Solutions", | ||||
| 	      "CYGWIN.DLL setup", | ||||
| 	      "b15.0", | ||||
| 	      "mounts", | ||||
| 	      NULL); | ||||
|   read_v1_mounts (r1, MOUNT_SYSTEM); | ||||
| } | ||||
|  | ||||
| /************************* mount_item class ****************************/ | ||||
|  | ||||
| static mntent * | ||||
|   | ||||
| @@ -94,13 +94,10 @@ class mount_info | ||||
|   int get_cygdrive_info (char *user, char *system, char* user_flags, | ||||
| 			 char* system_flags); | ||||
|  | ||||
|   void import_v1_mounts (); | ||||
|  | ||||
|  private: | ||||
|  | ||||
|   void sort (); | ||||
|   void read_mounts (reg_key& r); | ||||
|   void read_v1_mounts (reg_key r, unsigned which); | ||||
|   void mount_slash (); | ||||
|   void to_registry (); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user