Return-Path: Received: from relay.sgi.com (relay2.corp.sgi.com [137.38.102.29]) by oss.sgi.com (Postfix) with ESMTP id C814E7F8D for ; Tue, 15 Sep 2015 04:59:52 -0500 (CDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.157.11]) by relay2.corp.sgi.com (Postfix) with ESMTP id AB60730404E for ; Tue, 15 Sep 2015 02:59:52 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id Yt8RHKzoCLsXG83p (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 15 Sep 2015 02:59:49 -0700 (PDT) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 7C0E3C0B91A1 for ; Tue, 15 Sep 2015 09:59:49 +0000 (UTC) From: Jan Tulak Subject: [PATCH 11/14] xfsprogs: Add statvfs64 for osx Date: Tue, 15 Sep 2015 11:59:21 +0200 Message-Id: <1442311164-12921-12-git-send-email-jtulak@redhat.com> In-Reply-To: <1442311164-12921-1-git-send-email-jtulak@redhat.com> References: <1442311164-12921-1-git-send-email-jtulak@redhat.com> List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com To: xfs@oss.sgi.com Cc: Jan Tulak 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 --- fsr/xfs_fsr.c | 14 ++++++++++++++ include/builddefs.in | 2 +- include/darwin.h | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c index e1b7bd6..5f95cdc 100644 --- a/fsr/xfs_fsr.c +++ b/fsr/xfs_fsr.c @@ -36,6 +36,12 @@ # include #endif +#ifdef __APPLE__ +//# define statvfs64 statfs; +# include +# include +#endif + #ifndef XFS_XFLAG_NODEFRAG #define XFS_XFLAG_NODEFRAG 0x00002000 /* src dependancy, remove later */ #endif @@ -948,7 +954,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 +1738,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.4.3 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs