summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-07-08 23:06:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-07-08 23:06:38 -0700
commita73b5a8f6beb37685888977171cea10af94e77c9 (patch)
tree2536518d59ba59ac26abf7a0640f5c149e108138 /winsup/cygwin/path.h
parenteec582cdb351530131d2ae30376eca2771f78e49 (diff)
downloadcygnal-a73b5a8f6beb37685888977171cea10af94e77c9.tar.gz
cygnal-a73b5a8f6beb37685888977171cea10af94e77c9.tar.bz2
cygnal-a73b5a8f6beb37685888977171cea10af94e77c9.zip
First steps toward native path handling.
- /proc and /dev are are still available, accessed as proc:/ and dev:/ - All other paths are native, and do not "see" virtual Cygwin items; /cygdrive is just C:\cygdrive (if the current drive is C). - chdir() to a virtual directory like dev:/ or proc:/ results in errno EOPNOTSUPP. * winsup/cygwin/mount.cc (mount_info::conv_to_win32_path): Takes new bool argument, hide_cygwin_virtuals. If true all that the function does is "backslashify" the path. (mount_info::add_item): Special hack inserted here so that we can create the virtual root directory which holds dev and proc and whatnot, and is passed here as "/". We cannot let this go through normalize_posix_path any more because it will turn to C:\. * winsup/cygwin/mount.h (mount_info::conv_to_win32_path): Declaration updated. * winsup/cygwin/path.cc (is_posix_space): New static function: tests for paths in special spaces, currently "dev:/" and "proc:/". Used by normalize_posix_path. (normalize_posix_path): Any path that doesn't satisfy the is_posix_space test is treated as Win32. Since the bulk of the code is now only used for these spaces, the relative path handling is not required and a the corresponding block of code is removed. Paths satisfying is_posix_space are transformed. I.e. the underlying path resolution machine in the path_conv class still recognizes /proc and /dev. It's just that these will not occur, because normalize_posix_path will convert them to references with drive names. (path_conv::check): Pass the is_msdos flag down to mount_info::conv_to_win32_path as the new argument. Thus if normalize_posix_path indicates a native path, this function will hide the virtual spaces. Also, we add PATH_NOPOSIX and PATH_NOACL to the object's path_flags. This is used in chdir. (normalize_win32_path): A small piece of logic works against our plan here: it checks for the leading forward slash on the path, and prevents such paths from being converted to Win32 paths with a drive reference. We eliminate this test, and treat paths unconditionally. (chdir): Here, if the path is not native, we return EOPNOTSUPP. Thus it is impossible to chdir into Cygwin virtual directories like /dev (now referenced as dev:/). They can be listed but not turned into the current directory. Eventually we want chdir to actually set the Win32 current directory of the process; that can't work for virtual dirs. * winsup/cygwin/path.h (path_conv::is_native): New inline accessor which tests for the PATH_NOPOSIX flag.
Diffstat (limited to 'winsup/cygwin/path.h')
-rw-r--r--winsup/cygwin/path.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 1e2af6550..c6f43c183 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -161,6 +161,7 @@ class path_conv
bool has_acls () const {return !(path_flags & PATH_NOACL) && fs.has_acls (); }
bool hasgood_inode () const {return !(path_flags & PATH_IHASH); }
bool isgood_inode (ino_t ino) const;
+ bool is_native () const {return !!(path_flags & PATH_NOPOSIX);}
bool support_sparse () const
{
return (path_flags & PATH_SPARSE)