From bcf1bfabdef4481d4748e6c4a82b579af628fd75 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 17 Jan 2013 22:44:00 +0100 Subject: statfs: support f_frsize closes bugzilla #5834 Signed-off-by: Bernhard Reutner-Fischer --- libc/misc/statfs/fstatfs64.c | 3 +++ libc/misc/statfs/internal_statvfs.c | 8 ++++++-- libc/misc/statfs/statfs64.c | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/misc/statfs/fstatfs64.c b/libc/misc/statfs/fstatfs64.c index bc12020a0..ecdfabed1 100644 --- a/libc/misc/statfs/fstatfs64.c +++ b/libc/misc/statfs/fstatfs64.c @@ -42,6 +42,9 @@ int fstatfs64 (int fd, struct statfs64 *buf) buf->f_files = buf32.f_files; buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; +#ifdef _STATFS_F_FRSIZE + buf->f_frsize = buf32.f_frsize; +#endif buf->f_namelen = buf32.f_namelen; memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); diff --git a/libc/misc/statfs/internal_statvfs.c b/libc/misc/statfs/internal_statvfs.c index 6eb4afe5a..29890d490 100644 --- a/libc/misc/statfs/internal_statvfs.c +++ b/libc/misc/statfs/internal_statvfs.c @@ -18,8 +18,12 @@ /* Now fill in the fields we have information for. */ buf->f_bsize = fsbuf.f_bsize; - /* Linux does not support f_frsize, so set it to the full block size. */ +#ifdef _STATFS_F_FRSIZE + buf->f_frsize = fsbuf.f_frsize; +#else + /* No support for f_frsize so set it to the full block size. */ buf->f_frsize = fsbuf.f_bsize; +#endif buf->f_blocks = fsbuf.f_blocks; buf->f_bfree = fsbuf.f_bfree; buf->f_bavail = fsbuf.f_bavail; @@ -38,7 +42,7 @@ buf->__f_unused = 0; #endif buf->f_namemax = fsbuf.f_namelen; - memset (buf->__f_spare, '\0', 6 * sizeof (int)); + memset (buf->__f_spare, '\0', sizeof(fsbuf.f_spare)); /* What remains to do is to fill the fields f_favail and f_flag. */ diff --git a/libc/misc/statfs/statfs64.c b/libc/misc/statfs/statfs64.c index c11b7db23..99227977d 100644 --- a/libc/misc/statfs/statfs64.c +++ b/libc/misc/statfs/statfs64.c @@ -41,6 +41,9 @@ int statfs64 (const char *file, struct statfs64 *buf) buf->f_ffree = buf32.f_ffree; buf->f_fsid = buf32.f_fsid; buf->f_namelen = buf32.f_namelen; +#ifdef _STATFS_F_FRSIZE + buf->f_frsize = buf32.f_frsize; +#endif memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); return 0; -- cgit v1.2.3