diff options
author | Goffredo Baroncelli <kreijack@libero.it> | 2014-02-13 20:19:01 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-12-04 16:48:09 +0100 |
commit | e12e91e8596de39802d30753a8afaf5be9e86fd3 (patch) | |
tree | 8373136801fd0fcc6e5a0f645f2feab1d65538d4 /utils.c | |
parent | 3d1ed6d152107b03c26935a8486af47e22685150 (diff) |
btrfs-progs: Enhance the command btrfs filesystem df
Enhance the command "btrfs filesystem df" to show space usage information
for a mount point(s). It shows also an estimation of the space available,
on the basis of the current one used.
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
[code moved under #if 0 instead of deletion]
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -38,6 +38,8 @@ #include <linux/kdev_t.h> #include <limits.h> #include <blkid/blkid.h> +#include <sys/vfs.h> + #include "kerncompat.h" #include "radix-tree.h" #include "ctree.h" @@ -2494,3 +2496,12 @@ char* btrfs_group_profile_str(u64 flag) } } +u64 disk_size(char *path) +{ + struct statfs sfs; + + if (statfs(path, &sfs) < 0) + return 0; + else + return sfs.f_bsize * sfs.f_blocks; +} |