diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2007-07-26 21:30:54 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2007-07-26 21:30:54 +0400 |
commit | 214c3a1167c25b0696b118e347a78adf813151a9 (patch) | |
tree | 412d926fc8b2185246eac004b59b990e65a24e63 /winsup/cygwin/syscalls.cc | |
parent | 4b62a570de173dd5adecbac8bf9ae9039d0bdef5 (diff) |
* dir.cc (readdir_worker): Drop dir parameter from call to
readdir_get_ino.
* fhandler.h (fhandler_disk_file::readdir_helper): Switch file name
parameter to PUNICODE_STRING.
* fhandler_disk_file.cc: Drop including ntdef.h.
(class __DIR_mounts): Store mount points in UNICODE. Additionally
store cygdrive prefix in unicode here. Change methods accordingly.
(__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64.
(__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers.
(path_conv::ndisk_links): Rewrite using native NT functions.
(fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH.
Always set pfvi->VolumeSerialNumber to non-0. Remove last resort
code.
(fhandler_base::fstat_by_name): Rewrite using native NT functions.
(fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle
fails.
(fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber.
(fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails.
(DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH.
(__DIR_cache): Remove __name.
(d_dirname): Remove.
(fhandler_disk_file::opendir): Drop pathname length check.
Remove outdated comment. Use get_name method instead of accessing
pc.normalized_path directly.
(readdir_get_ino): Drop unused dir parameter. Accomodate throughout.
Allocate fname dynamically. Call new stat_worker instead of lstat64.
Call NtOpenFile instead of CreateFile. Call NtClose instead of
CloseHandle.
(fhandler_disk_file::readdir_helper): Use native NT functions.
Check for volume mount points and use correct inode number.
(fhandler_disk_file::readdir): Simplify slightly.
Use get_name instead of pc.normalized_path.
(fhandler_disk_file::rewinddir): Use RtlInitUnicodeString.
(fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink
correctly.
(fhandler_cygdrive::readdir): Ignore floppy drives.
* fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate
change to readdir_get_ino.
* fhandler_proc.cc (PROC_DIR_COUNT): Define.
(fhandler_proc::fstat): Evaluate correct link count for /proc.
* ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define.
(NtFsControlFile): Declare.
(RtlAppendUnicodeToString): Declare.
(RtlAppendUnicodeStringToString): Declare.
(RtlCompareUnicodeString): Declare.
(RtlCopyUnicodeString): Declare.
(RtlCreateUnicodeStringFromAsciiz): Declare.
(RtlEqualUnicodeString): Declare.
(RtlFreeUnicodeString): Declare.
(RtlInitEmptyUnicodeString): Declare.
(RtlSecondsSince1970ToTime): Declare.
(RtlInitEmptyUnicodeString): Define as inline function.
(RtlInitCountedUnicodeString): Define as inline function.
* path.cc (path_conv::check): New method with PUNICODE_STRING as path,
preliminary implementation.
(mount_info::get_mounts_here): Change to create UNICODE_STRINGs.
Also copy cygpath prefix into UNICODE_STRING.
(is_floppy): Drop 9x consideration.
* path.h: Drop including ntdef.h.
(path_conv::check): Add declaration.
(path_conv::path_conv): Add constructor for UNICODE_STRING paths.
* shared_info.h (mount_info::get_mounts_here): Change declaration.
* syscalls.cc: Drop forward declaration of stat_worker.
(stat_worke): Take path_conv as parameter. Drop nofollow flag.
(stat64): Create matching path_conv and call stat_worker with it.
(lstat64): Ditto.
* winsup.h: Include ntdef.h.
(stat_worker): Declare.
(readdir_get_ino): Change declaration.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 65aac3b64..b27947cb4 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -96,9 +96,6 @@ SYSTEM_INFO system_info; static int __stdcall mknod_worker (const char *, mode_t, mode_t, _major_t, _minor_t); -static int __stdcall stat_worker (const char *name, struct __stat64 *buf, - int nofollow) __attribute__ ((regparm (3))); - /* Close all files and process any queued deletions. Lots of unix style applications will open a tmp file, unlink it, but never call close. This function is called by _exit to @@ -1225,8 +1222,8 @@ sync () } /* Cygwin internal */ -static int __stdcall -stat_worker (const char *name, struct __stat64 *buf, int nofollow) +int __stdcall +stat_worker (path_conv &pc, struct __stat64 *buf) { int res = -1; fhandler_base *fh = NULL; @@ -1235,8 +1232,7 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow) if (efault.faulted (EFAULT)) goto error; - if (!(fh = build_fh_name (name, NULL, nofollow ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW, - stat_suffixes))) + if (!(fh = build_fh_pc (pc))) goto error; if (fh->error ()) @@ -1246,8 +1242,8 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow) } else if (fh->exists ()) { - debug_printf ("(%s, %p, %d, %p), file_attributes %d", name, buf, nofollow, - fh, (DWORD) *fh); + debug_printf ("(%s, %p, %p), file_attributes %d", + pc.normalized_path, buf, fh, (DWORD) *fh); memset (buf, 0, sizeof (*buf)); res = fh->fstat (buf); if (!res) @@ -1266,7 +1262,7 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow) delete fh; error: MALLOC_CHECK; - syscall_printf ("%d = (%s, %p)", res, name, buf); + syscall_printf ("%d = (%s, %p)", res, pc.normalized_path, buf); return res; } @@ -1274,7 +1270,8 @@ extern "C" int stat64 (const char *name, struct __stat64 *buf) { syscall_printf ("entering"); - return stat_worker (name, buf, 0); + path_conv pc (name, PC_SYM_FOLLOW | PC_POSIX, stat_suffixes); + return stat_worker (pc, buf); } extern "C" int @@ -1312,7 +1309,8 @@ extern "C" int lstat64 (const char *name, struct __stat64 *buf) { syscall_printf ("entering"); - return stat_worker (name, buf, 1); + path_conv pc (name, PC_SYM_NOFOLLOW | PC_POSIX, stat_suffixes); + return stat_worker (pc, buf); } /* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */ |