diff options
Diffstat (limited to 'openbsd-compat/bsd-statvfs.c')
-rw-r--r-- | openbsd-compat/bsd-statvfs.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/openbsd-compat/bsd-statvfs.c b/openbsd-compat/bsd-statvfs.c index 2d93bfc8..b05ee2b3 100644 --- a/openbsd-compat/bsd-statvfs.c +++ b/openbsd-compat/bsd-statvfs.c @@ -1,5 +1,3 @@ -/* $Id: bsd-statvfs.c,v 1.2 2014/01/17 07:10:59 dtucker Exp $ */ - /* * Copyright (c) 2008,2014 Darren Tucker <dtucker@zip.com.au> * @@ -26,13 +24,21 @@ #endif #if defined(ANDROID) -#include <sys/vfs.h> -#include <string.h> +#include <sys/param.h> #define MNAMELEN PATH_MAX #endif #include <errno.h> +#ifndef MNAMELEN +# define MNAMELEN 32 +#endif + +#ifdef HAVE_STRUCT_STATFS_F_FILES +# define HAVE_STRUCT_STATFS +#endif + +#ifdef HAVE_STRUCT_STATFS static void copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from) { @@ -45,18 +51,19 @@ copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from) to->f_ffree = from->f_ffree; to->f_favail = from->f_ffree; /* no exact equivalent */ to->f_fsid = 0; /* XXX fix me */ -#if GCE_PLATFORM_SDK_VERSION >= 19 +#ifdef HAVE_STRUCT_STATFS_F_FLAGS to->f_flag = from->f_flags; #else - to->f_flag = from->f_spare[0]; + to->f_flag = 0; #endif to->f_namemax = MNAMELEN; } +#endif # ifndef HAVE_STATVFS int statvfs(const char *path, struct statvfs *buf) { -# ifdef HAVE_STATFS +# if defined(HAVE_STATFS) && defined(HAVE_STRUCT_STATFS) struct statfs fs; memset(&fs, 0, sizeof(fs)); @@ -74,7 +81,7 @@ int statvfs(const char *path, struct statvfs *buf) # ifndef HAVE_FSTATVFS int fstatvfs(int fd, struct statvfs *buf) { -# ifdef HAVE_FSTATFS +# if defined(HAVE_FSTATFS) && defined(HAVE_STRUCT_STATFS) struct statfs fs; memset(&fs, 0, sizeof(fs)); |