* Use new unified status_flag accessor methods from classes fhandler_*,
tty_min, mtinfo and fs_info thoroughout. * fhandler.h: Redefine all set_close_on_exec methods to take a bool argument. (enum conn_state): Rename from connect_state. (class fhandler_base): Rename some status flags to align with accessor method names. Drop encoded flag entirely. Unify status accessor methods. Const'ify all read accessor methods. (class fhandler_socket): Ditto. (class fhandler_dev_raw): Ditto. * fhandler_disk_file.cc (fhandler_base::fstat_fs): Use fs.fs_is_fat() instead of evaluating FATness of file system here. (fhandler_disk_file::opendir): Drop call to set_encoded(). (fhandler_disk_file::readdir): Use pc.isencoded() directly. * mtinfo.h (class mtinfo_drive): Const'ify all read accessor methods. * path.cc (fsinfo_cnt): Add. (fs_info::update): Accomodate class changes. Evaluate file system name specific flags right here. Add thread safety for reading and writing global fsinfo array. * path.h (enum path_types): Drop values for flags kept in fs already. (struct fs_info): Move status informatin into private struct type status_flags. Add accessor methods. Remove path and file system name string arrays in favor of status bits. (class path_conv): Use new fs_info status information where appropriate. (path_conf::fs_has_ea): Rename from fs_fast_ea. (path_conf::fs_has_acls): New method. (path_conf::root_dir): Remove. (path_conf::volname): Remove. * syscalls (statfs): Evaluate root dir locally. * tty.h (class tty_min): Unify status accessor methods. Const'ify all read accessor methods.
This commit is contained in:
@ -164,7 +164,7 @@ fhandler_base::fstat_fs (struct __stat64 *buf)
|
||||
|
||||
if (get_io_handle ())
|
||||
{
|
||||
if (get_nohandle ())
|
||||
if (nohandle ())
|
||||
return fstat_by_name (buf);
|
||||
else
|
||||
return fstat_by_handle (buf);
|
||||
@ -173,9 +173,8 @@ fhandler_base::fstat_fs (struct __stat64 *buf)
|
||||
then just do a "query open" as it is apparently much faster. */
|
||||
if (pc.exec_state () != dont_know_if_executable)
|
||||
{
|
||||
set_query_open (query_read_control);
|
||||
if (strncasematch (pc.volname (), "FAT", 3)
|
||||
&& !strpbrk (get_win32_name (), "?*|<>"))
|
||||
query_open (query_read_control);
|
||||
if (pc.fs_is_fat () && !strpbrk (get_win32_name (), "?*|<>"))
|
||||
return fstat_by_name (buf);
|
||||
}
|
||||
if (!(oret = open_fs (open_flags, 0)) && get_errno () == EACCES)
|
||||
@ -183,21 +182,21 @@ fhandler_base::fstat_fs (struct __stat64 *buf)
|
||||
/* If we couldn't open the file, try a query open with no permissions.
|
||||
This allows us to determine *some* things about the file, at least. */
|
||||
pc.set_exec (0);
|
||||
set_query_open (query_null_access);
|
||||
query_open (query_null_access);
|
||||
oret = open_fs (open_flags, 0);
|
||||
}
|
||||
|
||||
if (oret)
|
||||
{
|
||||
/* We now have a valid handle, regardless of the "nohandle" state.
|
||||
Since fhandler_base::open only calls CloseHandle if !get_nohandle,
|
||||
Since fhandler_base::open only calls CloseHandle if !nohandle,
|
||||
we have to set it to false before calling close_fs and restore
|
||||
the state afterwards. */
|
||||
res = fstat_by_handle (buf);
|
||||
bool nohandle = get_nohandle ();
|
||||
set_nohandle (false);
|
||||
bool no_handle = nohandle ();
|
||||
nohandle (false);
|
||||
close_fs ();
|
||||
set_nohandle (nohandle);
|
||||
nohandle (no_handle);
|
||||
set_io_handle (NULL);
|
||||
}
|
||||
else
|
||||
@ -631,7 +630,7 @@ fhandler_disk_file::opendir ()
|
||||
goto free_dirent;
|
||||
|
||||
fd = this;
|
||||
fd->set_nohandle (true);
|
||||
fd->nohandle (true);
|
||||
dir->__d_dirent->d_fd = fd;
|
||||
dir->__fh = this;
|
||||
/* FindFirstFile doesn't seem to like duplicate /'s. */
|
||||
@ -647,8 +646,6 @@ fhandler_disk_file::opendir ()
|
||||
|
||||
res = dir;
|
||||
|
||||
if (pc.isencoded ())
|
||||
set_encoded ();
|
||||
}
|
||||
|
||||
syscall_printf ("%p = opendir (%s)", res, get_name ());
|
||||
@ -715,7 +712,7 @@ fhandler_disk_file::readdir (DIR *dir)
|
||||
}
|
||||
|
||||
/* We get here if `buf' contains valid data. */
|
||||
if (get_encoded ())
|
||||
if (pc.isencoded ())
|
||||
(void) fnunmunge (dir->__d_dirent->d_name, buf.cFileName);
|
||||
else
|
||||
strcpy (dir->__d_dirent->d_name, buf.cFileName);
|
||||
|
Reference in New Issue
Block a user