diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-07-08 23:06:38 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-11-16 19:34:56 -0800 |
commit | 57dc57420958d5cb43df011c20eef44adb7506d2 (patch) | |
tree | ad974954128cd05e566c6b8364f5e656d0c3e688 /winsup/cygwin/path.h | |
parent | 5ad292d2242635e39f81080aff0052f7c698ac52 (diff) | |
download | cygnal-57dc57420958d5cb43df011c20eef44adb7506d2.tar.gz cygnal-57dc57420958d5cb43df011c20eef44adb7506d2.tar.bz2 cygnal-57dc57420958d5cb43df011c20eef44adb7506d2.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.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 4618600aa..9fe4c2698 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -163,6 +163,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) |