From 4ee93264fd8e7fbad277026a21bc7f3f14f4b333 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 12 Jan 2010 10:14:59 +0000 Subject: [PATCH] * dtable.cc (build_fh_name_worker): Remove. Move all functionality back into build_fh_name. (build_fh_name): Drop unused HANDLE parameter. Drop call to pc.fillin. Remove disabled build_fh_name with UNICODE_STRING name parameter. * dtable.h (build_fh_name): Drop HANDLE parameter from declaration. Remove declaration for build_fh_name with UNICODE_STRING name parameter. * path.cc (path_conv::fillin): Remove. (symlink_info::check): Fix comment. * path.h (path_conv::fillin): Remove declaration. * dir.cc: Accommodate change in build_fh_name parameters throughout. * sec_acl.cc: Ditto. * syscalls.cc: Ditto. * ntea.cc (getxattr_worker): Fix debug output. (setxattr_worker): Ditto. * times.cc (utimens_worker): Ditto. --- winsup/cygwin/ChangeLog | 19 +++++++++++++++++++ winsup/cygwin/dir.cc | 8 ++++---- winsup/cygwin/dtable.cc | 26 ++++---------------------- winsup/cygwin/dtable.h | 7 +++---- winsup/cygwin/ntea.cc | 6 +++--- winsup/cygwin/path.cc | 17 ++--------------- winsup/cygwin/path.h | 3 +-- winsup/cygwin/sec_acl.cc | 5 +++-- winsup/cygwin/syscalls.cc | 22 +++++++++++----------- winsup/cygwin/times.cc | 4 ++-- 10 files changed, 52 insertions(+), 65 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 77d7a0c9f..724eb4458 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,22 @@ +2010-01-12 Corinna Vinschen + + * dtable.cc (build_fh_name_worker): Remove. Move all functionality + back into build_fh_name. + (build_fh_name): Drop unused HANDLE parameter. Drop call to pc.fillin. + Remove disabled build_fh_name with UNICODE_STRING name parameter. + * dtable.h (build_fh_name): Drop HANDLE parameter from declaration. + Remove declaration for build_fh_name with UNICODE_STRING name parameter. + * path.cc (path_conv::fillin): Remove. + (symlink_info::check): Fix comment. + * path.h (path_conv::fillin): Remove declaration. + * dir.cc: Accommodate change in build_fh_name parameters throughout. + * sec_acl.cc: Ditto. + * syscalls.cc: Ditto. + + * ntea.cc (getxattr_worker): Fix debug output. + (setxattr_worker): Ditto. + * times.cc (utimens_worker): Ditto. + 2010-01-11 Corinna Vinschen * fhandler_proc.cc (format_proc_stat): Use new in_buf. diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 4bca40cec..641aabe4b 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -1,7 +1,7 @@ /* dir.cc: Posix directory-related routines Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2006, 2007, - 2008, 2009 Red Hat, Inc. + 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -54,7 +54,7 @@ opendir (const char *name) fhandler_base *fh; DIR *res; - fh = build_fh_name (name, NULL, PC_SYM_FOLLOW); + fh = build_fh_name (name, PC_SYM_FOLLOW); if (!fh) res = NULL; else if (fh->exists ()) @@ -299,7 +299,7 @@ mkdir (const char *dir, mode_t mode) while (p > dir && isdirsep (*p)) *p-- = '\0'; } - if (!(fh = build_fh_name (dir, NULL, PC_SYM_NOFOLLOW))) + if (!(fh = build_fh_name (dir, PC_SYM_NOFOLLOW))) goto done; /* errno already set */; if (fh->error ()) @@ -329,7 +329,7 @@ rmdir (const char *dir) if (efault.faulted (EFAULT)) return -1; - if (!(fh = build_fh_name (dir, NULL, PC_SYM_NOFOLLOW))) + if (!(fh = build_fh_name (dir, PC_SYM_NOFOLLOW))) goto done; /* errno already set */; if (fh->error ()) diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index a01ae1cd3..ec5d3e386 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -1,7 +1,7 @@ /* dtable.cc: file descriptor support. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -400,9 +400,10 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle) #define cnew(name) new ((void *) ccalloc (HEAP_FHANDLER, 1, sizeof (name))) name -static fhandler_base * -build_fh_name_worker (path_conv& pc, HANDLE h, unsigned opt, suffix_info *si) +fhandler_base * +build_fh_name (const char *name, unsigned opt, suffix_info *si) { + path_conv pc (name, opt | PC_NULLEMPTY | PC_POSIX, si); if (pc.error) { fhandler_base *fh = cnew (fhandler_nodevice) (); @@ -412,27 +413,8 @@ build_fh_name_worker (path_conv& pc, HANDLE h, unsigned opt, suffix_info *si) return fh; } - if (!pc.exists () && h) - pc.fillin (h); - return build_fh_pc (pc); } -fhandler_base * -build_fh_name (const char *name, HANDLE h, unsigned opt, suffix_info *si) -{ - path_conv pc (name, opt | PC_NULLEMPTY | PC_POSIX, si); - return build_fh_name_worker (pc, h, opt, si); -} - -#if 0 /* Not needed yet */ -#define cnew(name) new ((void *) ccalloc (HEAP_FHANDLER, 1, sizeof (name))) name -fhandler_base * -build_fh_name (const UNICODE_STRING *name, HANDLE h, unsigned opt, suffix_info *si) -{ - path_conv pc (name, opt | PC_NULLEMPTY | PC_POSIX, si); - return build_fh_name_worker (pc, h, opt, si); -} -#endif fhandler_base * build_fh_dev (const device& dev, const char *unix_name) diff --git a/winsup/cygwin/dtable.h b/winsup/cygwin/dtable.h index 7b5af6fb8..1eedd7695 100644 --- a/winsup/cygwin/dtable.h +++ b/winsup/cygwin/dtable.h @@ -1,7 +1,7 @@ /* dtable.h: fd table definition. - Copyright 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Red - Hat, Inc. + Copyright 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, + 2010 Red Hat, Inc. This file is part of Cygwin. @@ -94,8 +94,7 @@ public: }; fhandler_base *build_fh_dev (const device&, const char * = NULL); -fhandler_base *build_fh_name (const char *, HANDLE = NULL, unsigned = 0, suffix_info * = NULL); -fhandler_base *build_fh_name (const UNICODE_STRING *, HANDLE = NULL, unsigned = 0, suffix_info * = NULL); +fhandler_base *build_fh_name (const char *, unsigned = 0, suffix_info * = NULL); fhandler_base *build_fh_pc (path_conv& pc, bool set_name = true); void dtable_init (); diff --git a/winsup/cygwin/ntea.cc b/winsup/cygwin/ntea.cc index 147b672f6..25ba6db1f 100644 --- a/winsup/cygwin/ntea.cc +++ b/winsup/cygwin/ntea.cc @@ -1,6 +1,6 @@ /* ntea.cc: code for manipulating Extended Attributes - Copyright 1997, 1998, 2000, 2001, 2006, 2008 Red Hat, Inc. + Copyright 1997, 1998, 2000, 2001, 2006, 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -329,7 +329,7 @@ getxattr_worker (path_conv &pc, const char *name, void *value, size_t size) if (pc.error) { - debug_printf ("got %d error from build_fh_name", pc.error); + debug_printf ("got %d error from path_conv", pc.error); set_errno (pc.error); } else if (pc.exists ()) @@ -424,7 +424,7 @@ setxattr_worker (path_conv &pc, const char *name, const void *value, if (pc.error) { - debug_printf ("got %d error from build_fh_name", pc.error); + debug_printf ("got %d error from path_conv", pc.error); set_errno (pc.error); } else if (pc.exists ()) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 559c87339..47274b4e0 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1,7 +1,7 @@ /* path.cc: path support. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008, 2009 Red Hat, Inc. + 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -371,19 +371,6 @@ mkrelpath (char *path, bool caseinsensitive) strcpy (path, "."); } -void -path_conv::fillin (HANDLE h) -{ - IO_STATUS_BLOCK io; - FILE_BASIC_INFORMATION fbi; - - if (NT_SUCCESS (NtQueryInformationFile (h, &io, &fbi, sizeof fbi, - FileBasicInformation))) - fileattr = fbi.FileAttributes; - else - fileattr = INVALID_FILE_ATTRIBUTES; -} - void path_conv::set_normalized_path (const char *path_copy) { @@ -2289,7 +2276,7 @@ symlink_info::check (char *path, const suffix_info *suffixes, unsigned opt, Note that additional STATUS_OBJECT_PATH_INVALID and STATUS_OBJECT_PATH_SYNTAX_BAD status codes exist. The first one - is seemingly not generated by NtQueryAttributesFile, the latter + is seemingly not generated by NtQueryInformationFile, the latter is only generated if the path is no absolute path within the NT name space, which should not happen and would point to an error in get_nt_native_path. Both status codes are deliberately diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 531a108ca..b310dc7bc 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -1,7 +1,7 @@ /* path.h: path data structures Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008 Red Hat, Inc. + 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -242,7 +242,6 @@ class path_conv strcpy (new_path, p); return path = new_path; } - void fillin (HANDLE h); bool is_binary (); unsigned __stdcall ndisk_links (DWORD); diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index 3a5497574..156320407 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -1,6 +1,7 @@ /* sec_acl.cc: Sun compatible ACL functions. - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Red Hat, Inc. Written by Corinna Vinschen @@ -418,7 +419,7 @@ acl_worker (const char *path, int cmd, int nentries, __aclent32_t *aclbufp, unsigned fmode) { int res = -1; - fhandler_base *fh = build_fh_name (path, NULL, fmode, stat_suffixes); + fhandler_base *fh = build_fh_name (path, fmode, stat_suffixes); if (fh->error ()) { debug_printf ("got %d error from build_fh_name", fh->error ()); diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 5b5aa1fd6..5cc59e682 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1,7 +1,7 @@ /* syscalls.cc: syscalls Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -1009,7 +1009,7 @@ open (const char *unix_path, int flags, ...) if (fd >= 0) { - if (!(fh = build_fh_name (unix_path, NULL, + if (!(fh = build_fh_name (unix_path, (flags & (O_NOFOLLOW | O_EXCL)) ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW, stat_suffixes))) @@ -1136,7 +1136,7 @@ link (const char *oldpath, const char *newpath) int res = -1; fhandler_base *fh; - if (!(fh = build_fh_name (oldpath, NULL, PC_SYM_NOFOLLOW, stat_suffixes))) + if (!(fh = build_fh_name (oldpath, PC_SYM_NOFOLLOW, stat_suffixes))) goto error; if (fh->error ()) @@ -1168,7 +1168,7 @@ chown_worker (const char *name, unsigned fmode, __uid32_t uid, __gid32_t gid) int res = -1; fhandler_base *fh; - if (!(fh = build_fh_name (name, NULL, fmode, stat_suffixes))) + if (!(fh = build_fh_name (name, fmode, stat_suffixes))) goto error; if (fh->error ()) @@ -1260,7 +1260,7 @@ chmod (const char *path, mode_t mode) { int res = -1; fhandler_base *fh; - if (!(fh = build_fh_name (path, NULL, PC_SYM_FOLLOW, stat_suffixes))) + if (!(fh = build_fh_name (path, PC_SYM_FOLLOW, stat_suffixes))) goto error; if (fh->error ()) @@ -1471,7 +1471,7 @@ stat_worker (path_conv &pc, struct __stat64 *buf) if (pc.error) { - debug_printf ("got %d error from build_fh_name", pc.error); + debug_printf ("got %d error from path_conv", pc.error); set_errno (pc.error); } else if (pc.exists ()) @@ -1572,7 +1572,7 @@ access (const char *fn, int flags) set_errno (EINVAL); else { - fhandler_base *fh = build_fh_name (fn, NULL, PC_SYM_FOLLOW, stat_suffixes); + fhandler_base *fh = build_fh_name (fn, PC_SYM_FOLLOW, stat_suffixes); if (fh) { res = fh->fhaccess (flags, false); @@ -1595,7 +1595,7 @@ euidaccess (const char *fn, int flags) set_errno (EINVAL); else { - fhandler_base *fh = build_fh_name (fn, NULL, PC_SYM_FOLLOW, stat_suffixes); + fhandler_base *fh = build_fh_name (fn, PC_SYM_FOLLOW, stat_suffixes); if (fh) { res = fh->fhaccess (flags, true); @@ -2207,7 +2207,7 @@ pathconf (const char *file, int v) set_errno (ENOENT); return -1; } - if (!(fh = build_fh_name (file, NULL, PC_SYM_FOLLOW, stat_suffixes))) + if (!(fh = build_fh_name (file, PC_SYM_FOLLOW, stat_suffixes))) return -1; if (!fh->exists ()) set_errno (ENOENT); @@ -2502,7 +2502,7 @@ statvfs (const char *name, struct statvfs *sfs) if (efault.faulted (EFAULT)) goto error; - if (!(fh = build_fh_name (name, NULL, PC_SYM_FOLLOW, stat_suffixes))) + if (!(fh = build_fh_name (name, PC_SYM_FOLLOW, stat_suffixes))) goto error; if (fh->error ()) @@ -4013,7 +4013,7 @@ faccessat (int dirfd, const char *pathname, int mode, int flags) set_errno (EINVAL); else { - fhandler_base *fh = build_fh_name (path, NULL, + fhandler_base *fh = build_fh_name (path, (flags & AT_SYMLINK_NOFOLLOW) ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW, stat_suffixes); diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index a59ade851..39fc6546a 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -1,7 +1,7 @@ /* times.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. This file is part of Cygwin. @@ -514,7 +514,7 @@ utimens_worker (path_conv &win32, const struct timespec *tvp) if (fh->error ()) { - debug_printf ("got %d error from build_fh_name", fh->error ()); + debug_printf ("got %d error from build_fh_pc", fh->error ()); set_errno (fh->error ()); } }