diff options
author | Matt Mower <mowerm@gmail.com> | 2015-12-13 18:31:00 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2015-12-23 16:58:04 +0100 |
commit | 523a059fb7d5844ebcca279b2f83aff9164b444c (patch) | |
tree | 4353fa9fa64a17ef2c5548f0c9f73f5e5f389f6a /fuse/android/statvfs.c | |
parent | exfat: Update to 1.2.2 (diff) | |
download | android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.gz android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.bz2 android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.lz android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.xz android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.zst android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.zip |
Diffstat (limited to 'fuse/android/statvfs.c')
-rw-r--r-- | fuse/android/statvfs.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/fuse/android/statvfs.c b/fuse/android/statvfs.c new file mode 100644 index 000000000..7cec574da --- /dev/null +++ b/fuse/android/statvfs.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2012 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "sys/statvfs.h" +#include <sys/statfs.h> + +#define MAP(to,from) vfs->to = sfs.from + +int statvfs(const char *path, struct statvfs *vfs) { + struct statfs sfs; + int ret; + int *fsid; + if ((ret = statfs(path, &sfs)) != 0) + return ret; + + MAP(f_bsize, f_bsize); + MAP(f_frsize, f_frsize); + MAP(f_blocks, f_blocks); + MAP(f_bfree, f_bfree); + MAP(f_bavail, f_bavail); + MAP(f_files, f_files); + MAP(f_ffree, f_ffree); + MAP(f_namemax, f_namelen); + + vfs->f_favail = 0; + vfs->f_flag = 0; + + fsid = (int *)&sfs.f_fsid; + vfs->f_fsid = (fsid[0] << sizeof(fsid[0])) | fsid[1]; + + return ret; +} |