From e4b575030bb0743d48a3bf156814cf77dc397b7a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 16 Jul 2008 20:20:45 +0000 Subject: Add case-sensitivity. Unconditionally handle mount points case-sensitive. Unconditionally handle virtual paths case-sensitive. Unconditionally handle registry paths case-insensitive. Otherwise, accommodate case-sensitivity of given path throughout. * cygheap.cc (cygheap_root::set): Get additional caseinsensitive parameter and store it. * cygheap.h (struct cygheap_root_mount_info): Add member caseinsensitive. * dlfcn.cc (get_full_path_of_dll): Drop PC_NOFULL parameter from call to path_conv::check. * environ.cc (pcheck_case): Remove. (check_case_init): Remove. (known): Drop "check_case" option. * exceptions.cc (open_stackdumpfile): Add comment. * fhandler.cc (fhandler_base::get_default_fmode): Call pathmatch instead of strcasematch. * fhandler_disk_file.cc: Accommodate case-sensitivity of given path throughout. (__DIR_mounts::check_mount): Unconditionally check virtual paths case-sensitive. (fhandler_disk_file::link): Drop case clash handling. (fhandler_disk_file::open): Ditto. (fhandler_disk_file::readdir_helper): Drop managed mount code. * mount.cc: Remove managed mount code and datastructures. (struct opt): Remove "managed" option. Add "posix=0" and "posix=1" options. (fillout_mntent): Remove "managed" output. Add "posix" output. * path.cc (struct symlink_info): Remove case_clash member and case_check method. (pcheck_case): Remove. (path_prefix_p): Take additional bool parameter "caseinsensitive". (pathnmatch): Ditto. (pathmatch): Ditto. (mkrelpath): Ditto. (fs_info::update): Set caseinsensitive flag according to file system name and FILE_CASE_SENSITIVE_SEARCH flag. Add comment. (tfx_chars_managed): Remove. (transform_chars): Drop "managed" parameter. Always use tfx_chars. (get_nt_native_path): Drop "managed" parameter. Make sure drive letters are always upper case. (getfileattr): Change second parameter to denote caseinsensitivity. (path_conv::check): Initialize caseinsensitive to OBJ_CASE_INSENSITIVE. Set caseinsensitive according to global obcaseinsensitive flag, file system case sensitivity and MOUNT_NOPOSIX mount flag. Drop case_clash and all the related code. (symlink_worker): Drop case clash handling. (symlink_info::set): Drop setting case_clash. (symlink_info::case_check): Remove. (cwdstuff::set): Add comment. (etc::init): Take path_conv instead of PUNICODE_STRING as parameter to allow case sensitivity. * path.h (enum pathconv_arg): Drop PC_SYM_IGNORE. (enum case_checking): Remove. (enum path_types): Drop PATH_ENC, add PATH_NOPOSIX flag. (struct fs_info): Add caseinsensitive flag and accessor methods. (class path_conv): Add caseinsensitive member and define objcaseinsensitive method. Drop case_clash member and isencoded method. (pathmatch): Change prototype according to above change. (pathnmatch): Ditto. (path_prefix_p): Ditto. (get_nt_native_path): Ditto. (class etc): Ditto. (fnunmunge): Remove prototype. * shared.cc (shared_info::init_obcaseinsensitive): Initialize obcaseinsensitive flag from obcaseinsensitive registry value. (shared_info::initialize): Call init_obcaseinsensitive here by the first process creating the shared memory. * shared_info.h (mount_item::fnmunge): Remove. (shared_info::obcaseinsensitive): Rename from obcaseinsensitivity. (shared_info::init_obcaseinsensitive): Declare. * syscalls.cc (try_to_bin): Add comment. * include/sys/mount.h (MOUNT_ENC): Remove flag. (MOUNT_NOPOSIX): Add flag. --- winsup/cygwin/path.h | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'winsup/cygwin/path.h') diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 2db254e58..a567e1e07 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -49,7 +49,6 @@ enum pathconv_arg { PC_SYM_FOLLOW = 0x0001, PC_SYM_NOFOLLOW = 0x0002, - PC_SYM_IGNORE = 0x0004, PC_SYM_CONTENTS = 0x0008, PC_NOFULL = 0x0010, PC_NULLEMPTY = 0x0020, @@ -59,13 +58,6 @@ enum pathconv_arg PC_NO_ACCESS_CHECK = 0x00800000 }; -enum case_checking -{ - PCHECK_RELAXED = 0, - PCHECK_ADJUST = 1, - PCHECK_STRICT = 2 -}; - #define PC_NONULLEMPTY -1 #include "sys/mount.h" @@ -78,9 +70,9 @@ enum path_types PATH_EXEC = MOUNT_EXEC, PATH_NOTEXEC = MOUNT_NOTEXEC, PATH_CYGWIN_EXEC = MOUNT_CYGWIN_EXEC, - PATH_ENC = MOUNT_ENC, PATH_RO = MOUNT_RO, PATH_NOACL = MOUNT_NOACL, + PATH_NOPOSIX = MOUNT_NOPOSIX, PATH_ALL_EXEC = (PATH_CYGWIN_EXEC | PATH_EXEC), PATH_NO_ACCESS_CHECK = PC_NO_ACCESS_CHECK, PATH_LNK = 0x01000000, @@ -103,6 +95,7 @@ struct fs_info unsigned has_buggy_open : 1; unsigned has_acls : 1; unsigned hasgood_inode : 1; + unsigned caseinsensitive : 1; unsigned is_fat : 1; unsigned is_ntfs : 1; unsigned is_samba : 1; @@ -122,6 +115,7 @@ struct fs_info IMPLEMENT_STATUS_FLAG (bool, has_buggy_open) IMPLEMENT_STATUS_FLAG (bool, has_acls) IMPLEMENT_STATUS_FLAG (bool, hasgood_inode) + IMPLEMENT_STATUS_FLAG (bool, caseinsensitive) IMPLEMENT_STATUS_FLAG (bool, is_fat) IMPLEMENT_STATUS_FLAG (bool, is_ntfs) IMPLEMENT_STATUS_FLAG (bool, is_samba) @@ -136,6 +130,7 @@ struct fs_info class path_conv { DWORD fileattr; + ULONG caseinsensitive; fs_info fs; PWCHAR wide_path; UNICODE_STRING uni_path; @@ -146,15 +141,14 @@ class path_conv char *known_suffix; int error; device dev; - bool case_clash; bool isremote () const {return fs.is_remote_drive ();} + ULONG objcaseinsensitive () const {return caseinsensitive;} bool has_acls () const {return !(path_flags & PATH_NOACL) && fs.has_acls (); } bool hasgood_inode () const {return fs.hasgood_inode (); } bool isgood_inode (__ino64_t ino) const; int has_symlinks () const {return path_flags & PATH_HAS_SYMLINKS;} int has_buggy_open () const {return fs.has_buggy_open ();} - bool isencoded () const {return path_flags & PATH_ENC;} int binmode () const { if (path_flags & PATH_BINARY) @@ -333,18 +327,17 @@ has_exec_chars (const char *buf, int len) (buf[0] == 'M' && buf[1] == 'Z')); } -int pathmatch (const char *path1, const char *path2) __attribute__ ((regparm (2))); -int pathnmatch (const char *path1, const char *path2, int len) __attribute__ ((regparm (2))); +int pathmatch (const char *path1, const char *path2, bool caseinsensitive) __attribute__ ((regparm (3))); +int pathnmatch (const char *path1, const char *path2, int len, bool caseinsensitive) __attribute__ ((regparm (3))); bool has_dot_last_component (const char *dir, bool test_dot_dot) __attribute__ ((regparm (2))); -bool fnunmunge (char *, const char *) __attribute__ ((regparm (2))); - -int path_prefix_p (const char *path1, const char *path2, int len1) __attribute__ ((regparm (3))); +int path_prefix_p (const char *path1, const char *path2, int len1, + bool caseinsensitive) __attribute__ ((regparm (3))); bool is_floppy (const char *); int normalize_win32_path (const char *, char *, char *&); int normalize_posix_path (const char *, char *, char *&); -PUNICODE_STRING get_nt_native_path (const char *, UNICODE_STRING&, bool); +PUNICODE_STRING get_nt_native_path (const char *, UNICODE_STRING&); /* FIXME: Move to own include file eventually */ @@ -358,7 +351,7 @@ class etc static OBJECT_ATTRIBUTES fn[MAX_ETC_FILES + 1]; static LARGE_INTEGER last_modified[MAX_ETC_FILES + 1]; static bool dir_changed (int); - static int init (int, PUNICODE_STRING); + static int init (int, path_conv &pc); static bool file_changed (int); static bool test_file_change (int); friend class pwdgrp; -- cgit v1.2.3