[PATCH 11/14 v2] xfsprogs: Add statvfs64 for osx

Jan Tulak jtulak at redhat.com
Wed Sep 30 03:21:55 CDT 2015


UPDATE:
- removing unnecessary include lines (again)

Simply rename statvfs64 to statfs with a #define.
OSX version of statvfs is missing some members, so if the renaming
is in effect (stavfs64 is defined), don't try to use them and go
directly for the other member value.

Signed-off-by: Jan Tulak <jtulak at redhat.com>
---
 fsr/xfs_fsr.c        | 8 ++++++++
 include/builddefs.in | 2 +-
 include/darwin.h     | 5 +++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index e1b7bd6..c8ef18f 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -948,7 +948,11 @@ fsrfile_common(
 			fname, strerror(errno));
 		return -1;
 	}
+#ifndef statvfs64
 	bsize = vfss.f_frsize ? vfss.f_frsize : vfss.f_bsize;
+#else
+	bsize = vfss.f_bsize;
+#endif
 	if (statp->bs_blksize * statp->bs_blocks >
 	    vfss.f_bfree * bsize - minimumfree) {
 		fsrprintf(_("insufficient freespace for: %s: "
@@ -1728,7 +1732,11 @@ xfs_getrt(int fd, struct statvfs64 *sfbp)
 		close(fd);
 		return -1;
 	}
+#ifndef statvfs64
 	bsize = (sfbp->f_frsize ? sfbp->f_frsize : sfbp->f_bsize);
+#else
+	bsize = sfbp->f_bsize;
+#endif
 	factor = fsgeom.blocksize / bsize;         /* currently this is == 1 */
 	sfbp->f_bfree = (cnt.freertx * fsgeom.rtextsize) * factor;
 	return 0;
diff --git a/include/builddefs.in b/include/builddefs.in
index 25b8816..31e21ba 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -123,7 +123,7 @@ PCFLAGS = -D_GNU_SOURCE $(GCCFLAGS)
 endif
 ifeq ($(PKG_PLATFORM),darwin)
 PCFLAGS = $(GCCFLAGS)
-DEPENDFLAGS = -D__APPLE__
+DEPENDFLAGS = -D__APPLE__ -D_DARWIN_FEATURE_64_BIT_INODE
 endif
 ifeq ($(PKG_PLATFORM),irix)
 PLDLIBS = -ldisk -lgen
diff --git a/include/darwin.h b/include/darwin.h
index 0d2f175..288ad1f 100644
--- a/include/darwin.h
+++ b/include/darwin.h
@@ -216,4 +216,9 @@ static inline int timer_gettime (timer_t timerid, struct itimerspec *value)
 	return getitimer(ITIMER_REAL, value);
 }
 
+/* FSR */
+
+#define statvfs64 statfs
+#define		_PATH_MOUNTED   "/etc/mtab"
+
 #endif	/* __XFS_DARWIN_H__ */
-- 
2.5.1



More information about the xfs mailing list