diff options
author | Alistair Delva <adelva@google.com> | 2020-08-20 16:14:23 -0700 |
---|---|---|
committer | Alistair Delva <adelva@google.com> | 2020-08-20 16:53:18 -0700 |
commit | d9da10d147d633fdb6ec65e17ff4b8447419d83e (patch) | |
tree | 8f93e8fdc2907f141e0924910bfec26669819f0b /openbsd-compat/bsd-statvfs.c | |
parent | 22246b08952d746a7cc5a292570636cf4277598f (diff) | |
parent | ecb2c02d994b3e21994f31a70ff911667c262f1f (diff) |
Merge upstream-master into master
Commit ecb2c02d994b3e21994f31a70ff911667c262f1f upstream
This nearly (but not quite) corresponds to V_8_3_P1; subsequent
cherry-picks will correct this.
Bug: 162492243
Change-Id: I3c079d86435b7c25aefff4538dc89a3002b1e25b
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)); |