From 8eddff4b785a196b2aae8be2d3a0e75fa3b6c0cf Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Fri, 27 May 2011 10:27:03 -0400 Subject: [PATCH] volinfo: fix file size data type Use afs_sfsize_t for file size instead of int. Change-Id: If68fca11183cd7b3ecd3750609f1b989af7445f5 Reviewed-on: http://gerrit.openafs.org/4737 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/vol/vol-info.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index e8c50454a..f38129020 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -773,16 +773,21 @@ NT_date(FILETIME * ft) #endif static int -GetFileInfo(FD_t fd, int *size, char **ctime, char **mtime, char **atime) +GetFileInfo(FD_t fd, afs_sfsize_t * size, char **ctime, char **mtime, + char **atime) { #ifdef AFS_NT40_ENV BY_HANDLE_FILE_INFORMATION fi; + LARGE_INTEGER fsize; if (!GetFileInformationByHandle(fd, &fi)) { - fprintf(stderr, "%s: GetFileInformationByHandle failed\n", - progname); + fprintf(stderr, "%s: GetFileInformationByHandle failed\n", progname); + return -1; + } + if (!GetFileSizeEx(fd, &fsize)) { + fprintf(stderr, "%s: GetFileSizeEx failed\n", progname); return -1; } - *size = (int)fi.nFileSizeLow; + *size = fsize.QuadPart; *ctime = "N/A"; *mtime = NT_date(&fi.ftLastWriteTime); *atime = NT_date(&fi.ftLastAccessTime); @@ -792,7 +797,7 @@ GetFileInfo(FD_t fd, int *size, char **ctime, char **mtime, char **atime) fprintf(stderr, "%s: fstat failed %d\n", progname, errno); return -1; } - *size = (int)status.st_size; + *size = status.st_size; *ctime = date(status.st_ctime); *mtime = date(status.st_mtime); *atime = date(status.st_atime); @@ -887,12 +892,13 @@ HandleVnodes(Volume * vp, VnodeClass class) char buf[SIZEOF_LARGEDISKVNODE]; struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)buf; StreamHandle_t *file = NULL; - int vnodeIndex, nVnodes; + int vnodeIndex; + afs_sfsize_t nVnodes; afs_foff_t offset = 0; Inode ino; IHandle_t *ih = vp->vnodeIndex[class].handle; FdHandle_t *fdP = NULL; - int size; + afs_sfsize_t size; char *ctime, *atime, *mtime; /* print vnode table heading */ -- 2.39.5