summaryrefslogtreecommitdiff
path: root/include/fs.h
diff options
context:
space:
mode:
authorRamesh Thomas <ramesh.thomas@intel.com>2016-09-01 17:11:16 -0700
committerAnas Nashif <nashif@linux.intel.com>2016-09-23 00:06:32 +0000
commit524004d54b147c9293977474ad175e067c237426 (patch)
treeacd58d0eb3e6a16c26bfd87fb8ddd2c3300b086b /include/fs.h
parent211db5352d3ae14d91e9de780612ff828fda7965 (diff)
fs: Adds file system API to get volume statistics
Adds API to return volume statistics. This is similar to fstatvfs() POSIX function but limited to total size, free space, allocation unit size and optimal transfer block size. Jira: ZEP-636 Change-Id: Ie9e7367b9164277875860c2d0e8de883b2fca07a Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Diffstat (limited to 'include/fs.h')
-rw-r--r--include/fs.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/fs.h b/include/fs.h
index d321227e5..24a3d3ce4 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -69,6 +69,24 @@ struct zfs_dirent {
};
/**
+ * @brief Structure to receive volume statistics
+ *
+ * Used to retrieve information about total and available space
+ * in the volume.
+ *
+ * @param f_bsize Optimal transfer block size
+ * @param f_frsize Allocation unit size
+ * @param f_blocks Size of FS in f_frsize units
+ * @param f_bfree Number of free blocks
+ */
+struct zfs_statvfs {
+ size_t f_bsize;
+ size_t f_frsize;
+ size_t f_blocks;
+ size_t f_bfree;
+};
+
+/**
* @}
*/
@@ -282,6 +300,18 @@ int fs_closedir(ZDIR *zdp);
int fs_stat(const char *path, struct zfs_dirent *entry);
/**
+ * @brief Retrieves statistics of the file system volume
+ *
+ * Returns the total and available space in the file system volume.
+ *
+ * @param stat Pointer to zfs_statvfs structure to receive the fs statistics
+ *
+ * @retval 0 Success
+ * @retval -ERRNO errno code if error
+ */
+int fs_statvfs(struct zfs_statvfs *stat);
+
+/**
* @}
*/