mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-28 03:27:46 +08:00
Cygwin: fs_info: check for SSD
During fs_info::update, check for the file being on an SSD. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
61f49ada90
commit
8b01c5d690
@ -69,6 +69,7 @@ class fs_info
|
|||||||
ULONG name_len; /* MaximumComponentNameLength */
|
ULONG name_len; /* MaximumComponentNameLength */
|
||||||
fs_info_type fs_type; /* Filesystem type */
|
fs_info_type fs_type; /* Filesystem type */
|
||||||
unsigned is_remote_drive : 1;
|
unsigned is_remote_drive : 1;
|
||||||
|
unsigned is_ssd : 1;
|
||||||
unsigned has_acls : 1;
|
unsigned has_acls : 1;
|
||||||
unsigned hasgood_inode : 1;
|
unsigned hasgood_inode : 1;
|
||||||
unsigned caseinsensitive : 1;
|
unsigned caseinsensitive : 1;
|
||||||
@ -80,6 +81,8 @@ class fs_info
|
|||||||
ULONG sernum; /* Volume Serial Number */
|
ULONG sernum; /* Volume Serial Number */
|
||||||
char fsn[80]; /* Windows filesystem name */
|
char fsn[80]; /* Windows filesystem name */
|
||||||
|
|
||||||
|
void check_ssd (HANDLE);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void clear ()
|
void clear ()
|
||||||
{
|
{
|
||||||
@ -93,6 +96,7 @@ class fs_info
|
|||||||
IMPLEMENT_STATUS_FLAG (ULONG, samba_version)
|
IMPLEMENT_STATUS_FLAG (ULONG, samba_version)
|
||||||
IMPLEMENT_STATUS_FLAG (ULONG, name_len)
|
IMPLEMENT_STATUS_FLAG (ULONG, name_len)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, is_remote_drive)
|
IMPLEMENT_STATUS_FLAG (bool, is_remote_drive)
|
||||||
|
IMPLEMENT_STATUS_FLAG (bool, is_ssd)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, has_acls)
|
IMPLEMENT_STATUS_FLAG (bool, has_acls)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, hasgood_inode)
|
IMPLEMENT_STATUS_FLAG (bool, hasgood_inode)
|
||||||
IMPLEMENT_STATUS_FLAG (bool, caseinsensitive)
|
IMPLEMENT_STATUS_FLAG (bool, caseinsensitive)
|
||||||
|
@ -523,8 +523,22 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
|
|||||||
caseinsensitive ((!(flags () & FILE_CASE_SENSITIVE_SEARCH) || is_samba ())
|
caseinsensitive ((!(flags () & FILE_CASE_SENSITIVE_SEARCH) || is_samba ())
|
||||||
&& !is_nfs ());
|
&& !is_nfs ());
|
||||||
|
|
||||||
|
/* Check for being an SSD */
|
||||||
|
if (!is_remote_drive () && !is_cdrom ())
|
||||||
|
{
|
||||||
|
/* Theoretically FileFsVolumeFlagsInformation would be sufficient,
|
||||||
|
but apparently it's not exposed into userspace. */
|
||||||
|
FILE_FS_SECTOR_SIZE_INFORMATION ffssi;
|
||||||
|
|
||||||
|
status = NtQueryVolumeInformationFile (vol, &io, &ffssi, sizeof ffssi,
|
||||||
|
FileFsSectorSizeInformation);
|
||||||
|
if (NT_SUCCESS (status))
|
||||||
|
is_ssd (!!(ffssi.Flags & SSINFO_FLAGS_NO_SEEK_PENALTY));
|
||||||
|
}
|
||||||
|
|
||||||
if (!in_vol)
|
if (!in_vol)
|
||||||
NtClose (vol);
|
NtClose (vol);
|
||||||
|
|
||||||
fsi_cache.add (hash, this);
|
fsi_cache.add (hash, this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user