From: Amir Goldstein Date: Thu, 10 Jan 2019 17:04:38 +0000 (+0200) Subject: vfs: add vfs_get_fsid() helper X-Git-Tag: v5.1-rc1~139^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec86ff5689ff9605e2d57e016098764ad9a2fee5;p=thirdparty%2Fkernel%2Fstable.git vfs: add vfs_get_fsid() helper Wrapper around statfs() interface. Cc: Al Viro Signed-off-by: Amir Goldstein Signed-off-by: Jan Kara --- diff --git a/fs/statfs.c b/fs/statfs.c index f0216629621d6..eea7af6f2f229 100644 --- a/fs/statfs.c +++ b/fs/statfs.c @@ -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; diff --git a/include/linux/statfs.h b/include/linux/statfs.h index 3142e98546ac9..9bc69edb8f188 100644 --- a/include/linux/statfs.h +++ b/include/linux/statfs.h @@ -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