diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 117839c51..8c9502d25 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,25 @@ +2008-04-21 Corinna Vinschen + + * mount.cc (mount_info::init): Remove call to from_registry. Print + message that fstab is missing. + (mount_info::from_fstab): Use CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX + instead of constant string. + (mount_info::read_mounts): Remove. + (mount_info::from_registry): Remove. + (mount_info::read_cygdrive_info_from_registry): Remove. + * postinstall: Enable code to create fstab entries from old registry + entries. + * registry.cc (reg_key::reg_key): Drop CYGWIN_INFO_CYGNUS_REGISTRY_NAME + from registry key. + * shared_info.h (mount_info::read_mounts): Remove declaration. + (mount_info::from_registry): Ditto. + (mount_info::to_registry): Ditto. + (mount_info::read_cygdrive_info_from_registry): Ditto. + * winver.rc (CYGWIN_REGISTRY_KEY): Remove. + (LegalCopyright): Fix to include 2008. + (RegistryKey): Set to CYGWIN_INFO_CYGWIN_REGISTRY_NAME. + * include/cygwin/version.h (CYGWIN_INFO_CYGNUS_REGISTRY_NAME): Remove. + 2008-04-21 Corinna Vinschen * kernel32.cc (CreateFileMappingW): Fix bug in reserve/commit handling. diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index f9ece9e62..f9bbc9453 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -364,7 +364,6 @@ details. */ /* Identifiers used in the Win32 registry. */ -#define CYGWIN_INFO_CYGNUS_REGISTRY_NAME "Cygnus Solutions" #define CYGWIN_INFO_CYGWIN_REGISTRY_NAME "Cygwin" #define CYGWIN_INFO_PROGRAM_OPTIONS_NAME "Program Options" #define CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME "mounts v2" diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 83d45d5de..e97121b83 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -25,7 +25,6 @@ details. */ #include "dtable.h" #include "cygheap.h" #include "shared_info.h" -#include "registry.h" #include "cygtls.h" #include "tls_pbuf.h" #include @@ -77,15 +76,11 @@ mount_info::init () { nmounts = 0; - if (from_fstab (false) | from_fstab (true)) /* The single | is correct! */ - return; + if (from_fstab (false) | from_fstab (true)) /* The single | is correct! */ + return; - /* FIXME: Remove fetching from registry before releasing 1.7.0. */ - - /* Fetch the mount table and cygdrive-related information from - the registry. */ - system_printf ("Fallback to fetching mounts from registry"); - from_registry (); + /* FIXME: Remove warning message before releasing 1.7.0. */ + small_printf ("Huh? No /etc/fstab file? Using default root and cygdrive prefix...\n"); } static void @@ -908,7 +903,7 @@ mount_info::from_fstab (bool user) This allows to override it with mount, unless the sysadmin created a cygdrive entry in /etc/fstab. */ cygdrive_flags = MOUNT_BINARY | MOUNT_CYGDRIVE; - strcpy (cygdrive, "/cygdrive/"); + strcpy (cygdrive, CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX "/"); cygdrive_len = strlen (cygdrive); } @@ -963,122 +958,6 @@ done: return true; } -/* read_mounts: Given a specific regkey, read mounts from under its - key. */ -/* FIXME: Remove before releasing 1.7.0. */ - -void -mount_info::read_mounts (reg_key& r) -{ - tmp_pathbuf tp; - char *native_path = tp.c_get (); - /* FIXME: The POSIX path is stored as value name right now, which is - restricted to 256 bytes. */ - char posix_path[CYG_MAX_PATH]; - HKEY key = r.get_key (); - DWORD i, posix_path_size; - int res; - - /* Loop through subkeys */ - /* FIXME: we would like to not check MAX_MOUNTS but the heap in the - shared area is currently statically allocated so we can't have an - arbitrarily large number of mounts. */ - for (i = 0; ; i++) - { - int mount_flags; - - posix_path_size = sizeof (posix_path); - /* FIXME: if maximum posix_path_size is 256, we're going to - run into problems if we ever try to store a mount point that's - over 256 but is under CYG_MAX_PATH. */ - res = RegEnumKeyEx (key, i, posix_path, &posix_path_size, NULL, - NULL, NULL, NULL); - - if (res == ERROR_NO_MORE_ITEMS) - break; - else if (res != ERROR_SUCCESS) - { - debug_printf ("RegEnumKeyEx failed, error %d!", res); - break; - } - - /* Get a reg_key based on i. */ - reg_key subkey = reg_key (key, KEY_READ, posix_path, NULL); - - /* Fetch info from the subkey. */ - subkey.get_string ("native", native_path, NT_MAX_PATH, ""); - mount_flags = subkey.get_int ("flags", 0); - - /* Add mount_item corresponding to registry mount point. */ - res = mount_table->add_item (native_path, posix_path, mount_flags); - if (res && get_errno () == EMFILE) - break; /* The number of entries exceeds MAX_MOUNTS */ - } -} - -/* from_registry: Build the entire mount table from the registry. Also, - read in cygdrive-related information from its registry location. */ -/* FIXME: Remove before releasing 1.7.0. */ - -void -mount_info::from_registry () -{ - - /* Retrieve cygdrive-related information. */ - read_cygdrive_info_from_registry (); - - nmounts = 0; - - /* First read mounts from user's table. - Then read mounts from system-wide mount table while deimpersonated . */ - for (int i = 0; i < 2; i++) - { - if (i) - cygheap->user.deimpersonate (); - reg_key r (i, KEY_READ, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); - read_mounts (r); - if (i) - cygheap->user.reimpersonate (); - } -} - -/* read_cygdrive_info_from_registry: Read the default prefix and flags - to use when creating cygdrives from the special user registry - location used to store cygdrive information. */ -/* FIXME: Remove before releasing 1.7.0. */ - -void -mount_info::read_cygdrive_info_from_registry () -{ - /* First read cygdrive from user's registry. - If failed, then read cygdrive from system-wide registry - while deimpersonated. */ - for (int i = 0; i < 2; i++) - { - if (i) - cygheap->user.deimpersonate (); - reg_key r (i, KEY_READ, CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); - if (i) - cygheap->user.reimpersonate (); - - if (r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive), - CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX) != ERROR_SUCCESS && i == 0) - continue; - - /* Fetch user cygdrive_flags from registry; returns MOUNT_CYGDRIVE on error. */ - cygdrive_flags = r.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, - MOUNT_CYGDRIVE | MOUNT_BINARY); - /* Sanitize */ - if (i == 0) - cygdrive_flags &= ~MOUNT_SYSTEM; - else - cygdrive_flags |= MOUNT_SYSTEM; - slashify (cygdrive, cygdrive, 1); - cygdrive_len = strlen (cygdrive); - break; - } -} - /* write_cygdrive_info: Store default prefix and flags to use when creating cygdrives to the special user shared mem location used to store cygdrive information. */ diff --git a/winsup/cygwin/postinstall b/winsup/cygwin/postinstall index 8a6928374..67fb70920 100755 --- a/winsup/cygwin/postinstall +++ b/winsup/cygwin/postinstall @@ -128,53 +128,50 @@ then EOF - # - # TODO: Enable the below code for the first official release. - # - #usr_bin="" - #usr_lib="" - #key='\HKLM\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2' - #for subkey in $(regtool -q list "$key") - #do - # if [[ "$subkey" =~ /.* ]] - # then - # [ "$subkey" = "/usr/bin" ] && usr_bin="1" - # [ "$subkey" = "/usr/lib" ] && usr_lib="1" - # nat=$(regtool -q get "$key\\$subkey\native") - # nat="${nat//\\//}" - # nat="${nat// /\\040}" - # psx="${subkey// /\\040}" - # flags=$(regtool -q get "$key\\$subkey\flags") - # echo -n "${nat} ${psx} some_fs " - # print_flags $flags - # echo " 0 0" - # fi >> ${FSTAB} - #done - #[ -z "$usr_bin" ] && + usr_bin="" + usr_lib="" + key='\HKLM\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2' + for subkey in $(regtool -q list "$key") + do + if [[ "$subkey" =~ /.* ]] + then + [ "$subkey" = "/usr/bin" ] && usr_bin="1" + [ "$subkey" = "/usr/lib" ] && usr_lib="1" + nat=$(regtool -q get "$key\\$subkey\native") + nat="${nat//\\//}" + nat="${nat// /\\040}" + psx="${subkey// /\\040}" + flags=$(regtool -q get "$key\\$subkey\flags") + echo -n "${nat} ${psx} some_fs " + print_flags $flags + echo " 0 0" + fi >> ${FSTAB} + done + [ -z "$usr_bin" ] && echo "${CYGROOT//\\//}/bin /usr/bin ${FS_TYPE} binary 0 0" >> ${FSTAB} - #[ -z "$usr_lib" ] && + [ -z "$usr_lib" ] && echo "${CYGROOT//\\//}/lib /usr/lib ${FS_TYPE} binary 0 0" >> ${FSTAB} - #cygd="" - #prefix=$(regtool -q get "$key\cygdrive prefix") - #flags=$(regtool -q get "$key\cygdrive flags") - #[ -z "$flags" ] && flags=2 - ## Don't take system and cygdrive flags into account when testing - #if [ -n "$prefix" \ - # -a \( "$prefix" != "/cygdrive" -o "$(( $flags & ~0x28 ))" -ne 2 \) ] - #then - # cygd="1" - # psx="${prefix// /\\040}" - # echo -n "none ${psx} cygdrive " - # print_flags $flags - # echo ",user 0 0" - #fi >> ${FSTAB} + cygd="" + prefix=$(regtool -q get "$key\cygdrive prefix") + flags=$(regtool -q get "$key\cygdrive flags") + [ -z "$flags" ] && flags=2 + # Don't take system and cygdrive flags into account when testing + if [ -n "$prefix" \ + -a \( "$prefix" != "/cygdrive" -o "$(( $flags & ~0x28 ))" -ne 2 \) ] + then + cygd="1" + psx="${prefix// /\\040}" + echo -n "none ${psx} cygdrive " + print_flags $flags + echo ",user 0 0" + fi >> ${FSTAB} - #if [ -z "$cygd" ] - #then + if [ -z "$cygd" ] + then echo "# This is default anyway:" >> ${FSTAB} echo "# none /cygdrive cygdrive binary,user 0 0" >> ${FSTAB} - #fi + fi IFS="$_OLD_IFS" fi diff --git a/winsup/cygwin/registry.cc b/winsup/cygwin/registry.cc index f9008c013..2858bc4f5 100644 --- a/winsup/cygwin/registry.cc +++ b/winsup/cygwin/registry.cc @@ -55,7 +55,6 @@ reg_key::reg_key (bool isHKLM, REGSAM access, ...): _disposition (0) } OK: new (this) reg_key (top, access, "SOFTWARE", - CYGWIN_INFO_CYGNUS_REGISTRY_NAME, CYGWIN_INFO_CYGWIN_REGISTRY_NAME, NULL); if (top != HKEY_LOCAL_MACHINE) RegCloseKey (top); diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h index 8af156226..bd743d5df 100644 --- a/winsup/cygwin/shared_info.h +++ b/winsup/cygwin/shared_info.h @@ -77,7 +77,6 @@ class mount_info bool from_fstab_line (char *line, bool user); bool from_fstab (bool user); - void from_registry (); unsigned set_flags_from_win32_path (const char *path); int conv_to_win32_path (const char *src_path, char *dst, device&, @@ -99,12 +98,9 @@ class mount_info private: void sort (); - void read_mounts (reg_key& r); void mount_slash (); - void to_registry (); int cygdrive_win32_path (const char *src, char *dst, int& unit); - void read_cygdrive_info_from_registry (); }; class user_info diff --git a/winsup/cygwin/winver.rc b/winsup/cygwin/winver.rc index 5fc130440..bb81349a4 100644 --- a/winsup/cygwin/winver.rc +++ b/winsup/cygwin/winver.rc @@ -6,9 +6,6 @@ #define CYGWIN_DLL_NAME CYGWIN_VERSION_DLL_IDENTIFIER STRINGIFY(.dll) -#define CYGWIN_REGISTRY_KEY CYGWIN_INFO_CYGNUS_REGISTRY_NAME "\\" \ - CYGWIN_INFO_CYGWIN_REGISTRY_NAME - #define CYGWIN_API_VERSION STRINGIFY(CYGWIN_VERSION_API_MAJOR) "." \ STRINGIFY(CYGWIN_VERSION_API_MINOR) @@ -36,13 +33,13 @@ BEGIN VALUE "FileDescription", "Cygwin\256 POSIX Emulation DLL" VALUE "FileVersion", STRINGIFY(CYGWIN_VERSION) VALUE "InternalName", CYGWIN_DLL_NAME - VALUE "LegalCopyright", "Copyright \251 Red Hat, Inc. 1996-2003" + VALUE "LegalCopyright", "Copyright \251 Red Hat, Inc. 1996-2008" VALUE "OriginalFilename", CYGWIN_DLL_NAME VALUE "ProductName", "Cygwin" VALUE "ProductVersion", STRINGIFY(CYGWIN_VERSION) VALUE "APIVersion", CYGWIN_API_VERSION VALUE "SharedMemoryVersion", STRINGIFY(CYGWIN_VERSION_SHARED_DATA) - VALUE "RegistryKey", CYGWIN_REGISTRY_KEY + VALUE "RegistryKey", CYGWIN_INFO_CYGWIN_REGISTRY_NAME VALUE "BuildDate", CYGWIN_BUILD_DATE_TIME END END