* fhandler_proc.cc (fhandler_proc::fstat): Use fhandler name rather than
path_conv name. (fhandler_proc::open): Ditto. * fhandler_process.cc (fhandler_process::fstat): Use fhandler name rather than path_conv name. (fhandler_process::open): Ditto. * fhandler_registry.cc (fhandler_registry::fstat): Use fhandler name rather than path_conv name. (fhandler_registry::open): Ditto. * path.cc (path_conv::check): Don't copy posix path when virtual. (mount_info::conv_to_win32_path): Don't zero string when isproc. Just derive normal windows path. * path.h (path_conv::clear_normalized_path): Declare new method. * path.cc (path_conv::clear_normalized_path): Define new method. * dtable.cc (build_fhandler_from_name): Clear normalized path when finished to conserve space.
This commit is contained in:
parent
3bb7eb449c
commit
335c87f94d
@ -1,3 +1,23 @@
|
|||||||
|
2002-05-02 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* fhandler_proc.cc (fhandler_proc::fstat): Use fhandler name rather
|
||||||
|
than path_conv name.
|
||||||
|
(fhandler_proc::open): Ditto.
|
||||||
|
* fhandler_process.cc (fhandler_process::fstat): Use fhandler name
|
||||||
|
rather than path_conv name.
|
||||||
|
(fhandler_process::open): Ditto.
|
||||||
|
* fhandler_registry.cc (fhandler_registry::fstat): Use fhandler name
|
||||||
|
rather than path_conv name.
|
||||||
|
(fhandler_registry::open): Ditto.
|
||||||
|
* path.cc (path_conv::check): Don't copy posix path when virtual.
|
||||||
|
(mount_info::conv_to_win32_path): Don't zero string when isproc. Just
|
||||||
|
derive normal windows path.
|
||||||
|
|
||||||
|
* path.h (path_conv::clear_normalized_path): Declare new method.
|
||||||
|
* path.cc (path_conv::clear_normalized_path): Define new method.
|
||||||
|
* dtable.cc (build_fhandler_from_name): Clear normalized path when
|
||||||
|
finished to conserve space.
|
||||||
|
|
||||||
2002-05-02 Christopher Faylor <cgf@redhat.com>
|
2002-05-02 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* fhandler_proc.cc (fhandler_proc::fstat): Prime with information from
|
* fhandler_proc.cc (fhandler_proc::fstat): Prime with information from
|
||||||
|
@ -287,7 +287,9 @@ dtable::build_fhandler_from_name (int fd, const char *name, HANDLE handle,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return build_fhandler (fd, pc.get_devn (), pc.normalized_path, pc, pc.get_unitn ());
|
fhandler_base *fh = build_fhandler (fd, pc.get_devn (), pc.normalized_path, pc, pc.get_unitn ());
|
||||||
|
pc.clear_normalized_path ();
|
||||||
|
return fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cnew(name) new ((void *) ccalloc (HEAP_FHANDLER, 1, sizeof (name))) name
|
#define cnew(name) new ((void *) ccalloc (HEAP_FHANDLER, 1, sizeof (name))) name
|
||||||
|
@ -124,7 +124,7 @@ fhandler_proc::fhandler_proc (DWORD devtype):
|
|||||||
int
|
int
|
||||||
fhandler_proc::fstat (struct __stat64 *buf, path_conv *pc)
|
fhandler_proc::fstat (struct __stat64 *buf, path_conv *pc)
|
||||||
{
|
{
|
||||||
debug_printf ("fstat (%s)", (char *) *pc);
|
debug_printf ("fstat (%s)", get_name ());
|
||||||
const char *path = get_name ();
|
const char *path = get_name ();
|
||||||
path += proc_len;
|
path += proc_len;
|
||||||
(void) fhandler_base::fstat (buf, pc);
|
(void) fhandler_base::fstat (buf, pc);
|
||||||
@ -199,7 +199,7 @@ fhandler_proc::open (path_conv *pc, int flags, mode_t mode)
|
|||||||
|
|
||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
path = (char *) *pc + proc_len;
|
path = get_name () + proc_len;
|
||||||
|
|
||||||
if (!*path)
|
if (!*path)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ fhandler_process::fhandler_process ():
|
|||||||
int
|
int
|
||||||
fhandler_process::fstat (struct __stat64 *buf, path_conv *pc)
|
fhandler_process::fstat (struct __stat64 *buf, path_conv *pc)
|
||||||
{
|
{
|
||||||
int file_type = exists ((const char *) get_name ());
|
int file_type = exists (get_name ());
|
||||||
(void) fhandler_base::fstat (buf, pc);
|
(void) fhandler_base::fstat (buf, pc);
|
||||||
buf->st_mode &= ~_IFMT & NO_W;
|
buf->st_mode &= ~_IFMT & NO_W;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ fhandler_process::open (path_conv *pc, int flags, mode_t mode)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
const char *path;
|
const char *path;
|
||||||
path = (const char *) *pc + proc_len + 1;
|
path = get_name () + proc_len + 1;
|
||||||
pid = atoi (path);
|
pid = atoi (path);
|
||||||
while (*path != 0 && !SLASH_P (*path))
|
while (*path != 0 && !SLASH_P (*path))
|
||||||
path++;
|
path++;
|
||||||
|
@ -161,9 +161,9 @@ fhandler_registry::fhandler_registry ():
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_registry::fstat (struct __stat64 *buf, path_conv *path)
|
fhandler_registry::fstat (struct __stat64 *buf, path_conv *pc)
|
||||||
{
|
{
|
||||||
this->fhandler_base::fstat (buf, path);
|
this->fhandler_base::fstat (buf, pc);
|
||||||
buf->st_mode &= ~_IFMT & NO_W;
|
buf->st_mode &= ~_IFMT & NO_W;
|
||||||
int file_type = exists (get_name ());
|
int file_type = exists (get_name ());
|
||||||
switch (file_type)
|
switch (file_type)
|
||||||
@ -315,7 +315,7 @@ fhandler_registry::open (path_conv *pc, int flags, mode_t mode)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
const char *path;
|
const char *path;
|
||||||
path = (const char *) *pc + proc_len + 1 + registry_len;
|
path = get_name () + proc_len + 1 + registry_len;
|
||||||
if (!*path)
|
if (!*path)
|
||||||
{
|
{
|
||||||
if ((mode & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
|
if ((mode & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
|
||||||
|
@ -45,9 +45,9 @@ fhandler_virtual::opendir (path_conv& pc)
|
|||||||
DIR *res = NULL;
|
DIR *res = NULL;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (exists (pc) <= 0)
|
if (exists (get_name ()) <= 0)
|
||||||
set_errno (ENOTDIR);
|
set_errno (ENOTDIR);
|
||||||
else if ((len = strlen (pc)) > MAX_PATH - 3)
|
else if ((len = strlen (get_name ())) > MAX_PATH - 3)
|
||||||
set_errno (ENAMETOOLONG);
|
set_errno (ENAMETOOLONG);
|
||||||
else if ((dir = (DIR *) malloc (sizeof (DIR))) == NULL)
|
else if ((dir = (DIR *) malloc (sizeof (DIR))) == NULL)
|
||||||
set_errno (ENOMEM);
|
set_errno (ENOMEM);
|
||||||
@ -64,7 +64,7 @@ fhandler_virtual::opendir (path_conv& pc)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy (dir->__d_dirname, pc);
|
strcpy (dir->__d_dirname, get_name ());
|
||||||
dir->__d_dirent->d_version = __DIRENT_VERSION;
|
dir->__d_dirent->d_version = __DIRENT_VERSION;
|
||||||
cygheap_fdnew fd;
|
cygheap_fdnew fd;
|
||||||
fd = this;
|
fd = this;
|
||||||
|
@ -368,10 +368,20 @@ path_conv::update_fs_info (const char* win32_path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
path_conv::clear_normalized_path ()
|
||||||
|
{
|
||||||
|
// not thread safe
|
||||||
|
if (normalized_path)
|
||||||
|
{
|
||||||
|
cfree (normalized_path);
|
||||||
|
normalized_path = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
path_conv::~path_conv ()
|
path_conv::~path_conv ()
|
||||||
{
|
{
|
||||||
if (normalized_path)
|
clear_normalized_path ();
|
||||||
cfree (normalized_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert an arbitrary path SRC to a pure Win32 path, suitable for
|
/* Convert an arbitrary path SRC to a pure Win32 path, suitable for
|
||||||
@ -526,8 +536,6 @@ path_conv::check (const char *src, unsigned opt,
|
|||||||
fileattr = 0;
|
fileattr = 0;
|
||||||
}
|
}
|
||||||
delete fh;
|
delete fh;
|
||||||
if (!error)
|
|
||||||
strcpy (path, path_copy);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/* devn should not be a device. If it is, then stop parsing now. */
|
/* devn should not be a device. If it is, then stop parsing now. */
|
||||||
@ -1428,7 +1436,13 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst,
|
|||||||
/* Check if the cygdrive prefix was specified. If so, just strip
|
/* Check if the cygdrive prefix was specified. If so, just strip
|
||||||
off the prefix and transform it into an MS-DOS path. */
|
off the prefix and transform it into an MS-DOS path. */
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
if (iscygdrive (pathbuf))
|
if (isproc (pathbuf))
|
||||||
|
{
|
||||||
|
devn = fhandler_proc::get_proc_fhandler (pathbuf);
|
||||||
|
if (devn == FH_BAD)
|
||||||
|
return ENOENT;
|
||||||
|
}
|
||||||
|
else if (iscygdrive (pathbuf))
|
||||||
{
|
{
|
||||||
int n = mount_table->cygdrive_len - 1;
|
int n = mount_table->cygdrive_len - 1;
|
||||||
if (!pathbuf[n] ||
|
if (!pathbuf[n] ||
|
||||||
@ -1447,14 +1461,6 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst,
|
|||||||
else if (mount_table->cygdrive_len > 1)
|
else if (mount_table->cygdrive_len > 1)
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
if (isproc (pathbuf))
|
|
||||||
{
|
|
||||||
devn = fhandler_proc::get_proc_fhandler (pathbuf);
|
|
||||||
dst[0] = '\0';
|
|
||||||
if (devn == FH_BAD)
|
|
||||||
return ENOENT;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
int chrooted_path_len;
|
int chrooted_path_len;
|
||||||
chrooted_path_len = 0;
|
chrooted_path_len = 0;
|
||||||
|
@ -141,6 +141,7 @@ class path_conv
|
|||||||
DWORD get_drive_type () {return drive_type;}
|
DWORD get_drive_type () {return drive_type;}
|
||||||
BOOL fs_fast_ea () {return sym_opt & PC_CHECK_EA;}
|
BOOL fs_fast_ea () {return sym_opt & PC_CHECK_EA;}
|
||||||
void set_path (const char *p) {strcpy (path, p);}
|
void set_path (const char *p) {strcpy (path, p);}
|
||||||
|
void clear_normalized_path ();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Symlink marker */
|
/* Symlink marker */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user