When file attributes are of no concern, there is no point to query them. This can greatly speedup code which doesn't need it.
The idea is to have a shallow path conversion with only minimal information. The upcoming unlink_nt for example, first tries a path without filesystem checks, then - if necessary - retries with filesystem checks. --- winsup/cygwin/path.cc | 7 ++++--- winsup/cygwin/path.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index abd3687df..441fe113b 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -627,7 +627,7 @@ path_conv::check (const char *src, unsigned opt, char *pathbuf = tp.c_get (); char *tmp_buf = tp.t_get (); char *THIS_path = tp.c_get (); - symlink_info sym; + symlink_info sym = { 0 }; bool need_directory = 0; bool add_ext = false; bool is_relpath; @@ -931,7 +931,8 @@ path_conv::check (const char *src, unsigned opt, is_fs_via_procsys: - symlen = sym.check (full_path, suff, fs, conv_handle); + if (!(opt & PC_SKIP_SYM_CHECK)) + symlen = sym.check (full_path, suff, fs, conv_handle); is_virtual_symlink: @@ -1172,7 +1173,7 @@ path_conv::check (const char *src, unsigned opt, return; } - if (dev.isfs ()) + if (!(opt & PC_SKIP_FS_CHECK) && dev.isfs ()) { /* If FS hasn't been checked already in symlink_info::check, do so now. */ diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 62bd5ddd5..5821cdf57 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -59,6 +59,8 @@ enum pathconv_arg PC_KEEP_HANDLE = _BIT (12), /* keep handle for later stat calls */ PC_NO_ACCESS_CHECK = _BIT (13), /* helper flag for error check */ PC_SYM_NOFOLLOW_DIR = _BIT (14), /* don't follow a trailing slash */ + PC_SKIP_SYM_CHECK = _BIT (15), /* skip symlink_info::check */ + PC_SKIP_FS_CHECK = _BIT (16), /* skip fs::update check */ PC_DONT_USE = _BIT (31) /* conversion to signed happens. */ }; -- 2.30.0