* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Don't use
FileAllInformation info class since it needs a big buffer. Add a comment.
This commit is contained in:
parent
731a438281
commit
77dcafa5ad
@ -1,3 +1,9 @@
|
|||||||
|
2009-07-12 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Don't use
|
||||||
|
FileAllInformation info class since it needs a big buffer. Add a
|
||||||
|
comment.
|
||||||
|
|
||||||
2009-07-07 Dave Korn <dave.korn.cygwin@gmail.com>
|
2009-07-07 Dave Korn <dave.korn.cygwin@gmail.com>
|
||||||
|
|
||||||
* winbase.h (ilockexch): Avoid making 'ret' volatile.
|
* winbase.h (ilockexch): Avoid making 'ret' volatile.
|
||||||
|
@ -331,16 +331,35 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
|
|||||||
if (pc.fs_is_nfs ())
|
if (pc.fs_is_nfs ())
|
||||||
return fstat_by_nfs_ea (buf);
|
return fstat_by_nfs_ea (buf);
|
||||||
|
|
||||||
struct {
|
/* Don't use FileAllInformation info class. It returns a pathname rather
|
||||||
FILE_ALL_INFORMATION fai;
|
than a filename, so it needs a really big buffer for no good reason
|
||||||
WCHAR buf[NAME_MAX + 1];
|
since we don't need the name anyway. So we just call the three info
|
||||||
} fai_buf;
|
classes necessary to get all information required by stat(2). */
|
||||||
|
FILE_BASIC_INFORMATION fbi;
|
||||||
|
FILE_STANDARD_INFORMATION fsi;
|
||||||
|
FILE_INTERNAL_INFORMATION fii;
|
||||||
|
|
||||||
status = NtQueryInformationFile (get_handle (), &io, &fai_buf.fai,
|
status = NtQueryInformationFile (get_handle (), &io, &fbi, sizeof fbi,
|
||||||
sizeof fai_buf, FileAllInformation);
|
FileBasicInformation);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
debug_printf ("%p = NtQueryInformationFile(%S)",
|
debug_printf ("%p = NtQueryInformationFile(%S, FileBasicInformation)",
|
||||||
|
status, pc.get_nt_native_path ());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
status = NtQueryInformationFile (get_handle (), &io, &fsi, sizeof fsi,
|
||||||
|
FileStandardInformation);
|
||||||
|
if (!NT_SUCCESS (status))
|
||||||
|
{
|
||||||
|
debug_printf ("%p = NtQueryInformationFile(%S, FileStandardInformation)",
|
||||||
|
status, pc.get_nt_native_path ());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
status = NtQueryInformationFile (get_handle (), &io, &fii, sizeof fii,
|
||||||
|
FileInternalInformation);
|
||||||
|
if (!NT_SUCCESS (status))
|
||||||
|
{
|
||||||
|
debug_printf ("%p = NtQueryInformationFile(%S, FileInternalInformation)",
|
||||||
status, pc.get_nt_native_path ());
|
status, pc.get_nt_native_path ());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -348,21 +367,21 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
|
|||||||
support a change timestamp. In that case use the LastWriteTime
|
support a change timestamp. In that case use the LastWriteTime
|
||||||
entry, as in other calls to fstat_helper. */
|
entry, as in other calls to fstat_helper. */
|
||||||
if (pc.is_rep_symlink ())
|
if (pc.is_rep_symlink ())
|
||||||
fai_buf.fai.BasicInformation.FileAttributes &= ~FILE_ATTRIBUTE_DIRECTORY;
|
fbi.FileAttributes &= ~FILE_ATTRIBUTE_DIRECTORY;
|
||||||
pc.file_attributes (fai_buf.fai.BasicInformation.FileAttributes);
|
pc.file_attributes (fbi.FileAttributes);
|
||||||
return fstat_helper (buf,
|
return fstat_helper (buf,
|
||||||
fai_buf.fai.BasicInformation.ChangeTime.QuadPart
|
fbi.ChangeTime.QuadPart
|
||||||
? *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.ChangeTime
|
? *(FILETIME *) (void *) &fbi.ChangeTime
|
||||||
: *(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastWriteTime,
|
: *(FILETIME *) (void *) &fbi.LastWriteTime,
|
||||||
*(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastAccessTime,
|
*(FILETIME *) (void *) &fbi.LastAccessTime,
|
||||||
*(FILETIME *) (void *) &fai_buf.fai.BasicInformation.LastWriteTime,
|
*(FILETIME *) (void *) &fbi.LastWriteTime,
|
||||||
*(FILETIME *) (void *) &fai_buf.fai.BasicInformation.CreationTime,
|
*(FILETIME *) (void *) &fbi.CreationTime,
|
||||||
get_dev (),
|
get_dev (),
|
||||||
fai_buf.fai.StandardInformation.EndOfFile.QuadPart,
|
fsi.EndOfFile.QuadPart,
|
||||||
fai_buf.fai.StandardInformation.AllocationSize.QuadPart,
|
fsi.AllocationSize.QuadPart,
|
||||||
fai_buf.fai.InternalInformation.FileId.QuadPart,
|
fii.FileId.QuadPart,
|
||||||
fai_buf.fai.StandardInformation.NumberOfLinks,
|
fsi.NumberOfLinks,
|
||||||
fai_buf.fai.BasicInformation.FileAttributes);
|
fbi.FileAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
int __stdcall
|
int __stdcall
|
||||||
|
Loading…
x
Reference in New Issue
Block a user