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

Dave Chinner david at fromorbit.com
Tue Sep 22 22:32:18 CDT 2015


On Tue, Sep 15, 2015 at 11:59:21AM +0200, Jan Tulak wrote:
> 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        | 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 <mntent.h>
>  #endif
>  
> +#ifdef __APPLE__
> +//#  define statvfs64 statfs;
> +#  include <sys/param.h>
> +#  include <sys/mount.h>
> +#endif

Why is this here? We've included libxfs.h in this file, so we've
got access to the platform specific includes already, and later in
the patch you put the commented out define there...

> +
>  #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

	bsize = platform_statvfs_bsize(&vfss);

Cheers,

Dave.
-- 
Dave Chinner
david at fromorbit.com



More information about the xfs mailing list