From 4e5a3fa5e2cc0ce5365fd6bd0bfa43f73ba17b55 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 20 Feb 2005 16:14:53 +0000 Subject: [PATCH] * fhandler.h (fhandler_base::fstat_helper): Declare with additional dwVolumeSerialNumber argument. Drop default values for last three arguments. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Pass dwVolumeSerialNumber from GetFileInformationByHandle to fstat_helper. (fhandler_base::fstat_by_name): Pass pc.volser () to fstat_helper. Accomodate dropping default values for last three arguments of fstat_helper. (fhandler_base::fstat_helper): Add dwVolumeSerialNumber argument. Use for st_dev member unless 0 in which case pc.volser () is used. --- winsup/cygwin/ChangeLog | 13 +++++++++++++ winsup/cygwin/fhandler.h | 9 +++++---- winsup/cygwin/fhandler_disk_file.cc | 12 +++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 13b941efd..d6adc5af1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,16 @@ +2005-02-20 Corinna Vinschen + + * fhandler.h (fhandler_base::fstat_helper): Declare with additional + dwVolumeSerialNumber argument. Drop default values for last three + arguments. + * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Pass + dwVolumeSerialNumber from GetFileInformationByHandle to fstat_helper. + (fhandler_base::fstat_by_name): Pass pc.volser () to fstat_helper. + Accomodate dropping default values for last three arguments of + fstat_helper. + (fhandler_base::fstat_helper): Add dwVolumeSerialNumber argument. + Use for st_dev member unless 0 in which case pc.volser () is used. + 2005-02-20 Corinna Vinschen * autoload.cc (FindFirstVolumeA): Add. diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 34b0f20f4..3199351ce 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -250,14 +250,15 @@ class fhandler_base virtual int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); int __stdcall fstat_fs (struct __stat64 *buf) __attribute__ ((regparm (2))); int __stdcall fstat_helper (struct __stat64 *buf, - FILETIME ftCreateionTime, + FILETIME ftCreationTime, FILETIME ftLastAccessTime, FILETIME ftLastWriteTime, + DWORD dwVolumeSerialNumber, DWORD nFileSizeHigh, DWORD nFileSizeLow, - DWORD nFileIndexHigh = 0, - DWORD nFileIndexLow = 0, - DWORD nNumberOfLinks = 1) + DWORD nFileIndexHigh, + DWORD nFileIndexLow, + DWORD nNumberOfLinks) __attribute__ ((regparm (3))); int __stdcall fstat_by_handle (struct __stat64 *buf) __attribute__ ((regparm (2))); int __stdcall fstat_by_name (struct __stat64 *buf) __attribute__ ((regparm (2))); diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 5b057dbbd..dab34a453 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -114,6 +114,7 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf) local.ftCreationTime, local.ftLastAccessTime, local.ftLastWriteTime, + local.dwVolumeSerialNumber, local.nFileSizeHigh, local.nFileSizeLow, local.nFileIndexHigh, @@ -141,13 +142,17 @@ fhandler_base::fstat_by_name (struct __stat64 *buf) local.ftCreationTime, local.ftLastAccessTime, local.ftLastWriteTime, + pc.volser (), local.nFileSizeHigh, - local.nFileSizeLow); + local.nFileSizeLow, + 0, + 0, + 1); } else if (pc.isdir ()) { FILETIME ft = {}; - res = fstat_helper (buf, ft, ft, ft, 0, 0); + res = fstat_helper (buf, ft, ft, ft, pc.volser (), 0, 0, 0, 0, 1); } else { @@ -213,6 +218,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf, FILETIME ftCreationTime, FILETIME ftLastAccessTime, FILETIME ftLastWriteTime, + DWORD dwVolumeSerialNumber, DWORD nFileSizeHigh, DWORD nFileSizeLow, DWORD nFileIndexHigh, @@ -233,7 +239,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf, to_timestruc_t (&ftLastAccessTime, &buf->st_atim); to_timestruc_t (&ftLastWriteTime, &buf->st_mtim); to_timestruc_t (&ftCreationTime, &buf->st_ctim); - buf->st_dev = pc.volser (); + buf->st_dev = dwVolumeSerialNumber ?: pc.volser (); buf->st_size = ((_off64_t) nFileSizeHigh << 32) + nFileSizeLow; /* The number of links to a directory includes the number of subdirectories in the directory, since all -- 2.43.5