]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
vfs: add vfs_get_fsid() helper
authorAmir Goldstein <amir73il@gmail.com>
Thu, 10 Jan 2019 17:04:38 +0000 (19:04 +0200)
committerJan Kara <jack@suse.cz>
Thu, 7 Feb 2019 15:38:35 +0000 (16:38 +0100)
Wrapper around statfs() interface.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/statfs.c
include/linux/statfs.h

index f0216629621d6b52f21f19f9b4010181cfe45d4f..eea7af6f2f229e85f71e3ff3ac5d541e88956856 100644 (file)
@@ -67,6 +67,20 @@ static int statfs_by_dentry(struct dentry *dentry, struct kstatfs *buf)
        return retval;
 }
 
+int vfs_get_fsid(struct dentry *dentry, __kernel_fsid_t *fsid)
+{
+       struct kstatfs st;
+       int error;
+
+       error = statfs_by_dentry(dentry, &st);
+       if (error)
+               return error;
+
+       *fsid = st.f_fsid;
+       return 0;
+}
+EXPORT_SYMBOL(vfs_get_fsid);
+
 int vfs_statfs(const struct path *path, struct kstatfs *buf)
 {
        int error;
index 3142e98546ac9e43b1c35e3649796a77279086b1..9bc69edb8f188fcc63c468c1dd2bd02983a86365 100644 (file)
@@ -41,4 +41,7 @@ struct kstatfs {
 #define ST_NODIRATIME  0x0800  /* do not update directory access times */
 #define ST_RELATIME    0x1000  /* update atime relative to mtime/ctime */
 
+struct dentry;
+extern int vfs_get_fsid(struct dentry *dentry, __kernel_fsid_t *fsid);
+
 #endif