public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Ken Brown <kbrown@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: fhandler_disk_file::fstatvfs: refactor Date: Tue, 28 Jan 2020 19:06:00 -0000 [thread overview] Message-ID: <20200128190647.130985.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=68b7a457f7331ed852380cd7afd0e17dffdc726e commit 68b7a457f7331ed852380cd7afd0e17dffdc726e Author: Ken Brown <kbrown@cornell.edu> Date: Fri Jan 24 16:02:57 2020 -0500 Cygwin: fhandler_disk_file::fstatvfs: refactor Define a new method fhandler_base::fstatvfs_by_handle, extracted from fhandler_disk_file::fstatvfs, which gets the statvfs information when a handle is available. This will be used in future commits for special files that have been opened with O_PATH. Diff: --- winsup/cygwin/fhandler.h | 1 + winsup/cygwin/fhandler_disk_file.cc | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 5d0c579..80a78d1 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -392,6 +392,7 @@ private: int __reg2 fstat_by_name (struct stat *buf); public: virtual int __reg2 fstatvfs (struct statvfs *buf); + int __reg2 fstatvfs_by_handle (HANDLE h, struct statvfs *buf); int __reg2 utimens_fs (const struct timespec *); virtual int __reg1 fchmod (mode_t mode); virtual int __reg2 fchown (uid_t uid, gid_t gid); diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index d9213d7..19a1c5a 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -600,9 +600,7 @@ int __reg2 fhandler_disk_file::fstatvfs (struct statvfs *sfs) { int ret = -1, opened = 0; - NTSTATUS status; IO_STATUS_BLOCK io; - FILE_FS_FULL_SIZE_INFORMATION full_fsi; /* We must not use the stat handle here, even if it exists. The handle has been opened with FILE_OPEN_REPARSE_POINT, thus, in case of a volume mount point, it points to the FS of the mount point, rather than to the @@ -630,6 +628,22 @@ fhandler_disk_file::fstatvfs (struct statvfs *sfs) } } + ret = fstatvfs_by_handle (fh, sfs); +out: + if (opened) + NtClose (fh); + syscall_printf ("%d = fstatvfs(%s, %p)", ret, get_name (), sfs); + return ret; +} + +int __reg2 +fhandler_base::fstatvfs_by_handle (HANDLE fh, struct statvfs *sfs) +{ + int ret = -1; + NTSTATUS status; + IO_STATUS_BLOCK io; + FILE_FS_FULL_SIZE_INFORMATION full_fsi; + sfs->f_files = ULONG_MAX; sfs->f_ffree = ULONG_MAX; sfs->f_favail = ULONG_MAX; @@ -688,10 +702,6 @@ fhandler_disk_file::fstatvfs (struct statvfs *sfs) debug_printf ("%y = NtQueryVolumeInformationFile" "(%S, FileFsFullSizeInformation)", status, pc.get_nt_native_path ()); -out: - if (opened) - NtClose (fh); - syscall_printf ("%d = fstatvfs(%s, %p)", ret, get_name (), sfs); return ret; }
reply other threads:[~2020-01-28 19:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200128190647.130985.qmail@sourceware.org \ --to=kbrown@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).