* 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.
This commit is contained in:
Corinna Vinschen 2010-01-12 10:14:59 +00:00
parent eeda30d7d5
commit 4ee93264fd
10 changed files with 52 additions and 65 deletions

View File

@ -1,3 +1,22 @@
2010-01-12 Corinna Vinschen <corinna@vinschen.de>
* 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 <corinna@vinschen.de>
* fhandler_proc.cc (format_proc_stat): Use new in_buf.

View File

@ -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 ())

View File

@ -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)

View File

@ -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 ();

View File

@ -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 ())

View File

@ -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

View File

@ -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);

View File

@ -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 <corinna@vinschen.de>
@ -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 ());

View File

@ -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);

View File

@ -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 ());
}
}