From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f66.google.com ([209.85.128.66]:54593 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725841AbeLBLix (ORCPT ); Sun, 2 Dec 2018 06:38:53 -0500 Received: by mail-wm1-f66.google.com with SMTP id z18so2993298wmc.4 for ; Sun, 02 Dec 2018 03:38:50 -0800 (PST) From: Amir Goldstein To: Jan Kara Cc: Matthew Bobrowski , linux-fsdevel@vger.kernel.org, Al Viro Subject: [PATCH v4 10/15] vfs: add vfs_get_fsid() helper Date: Sun, 2 Dec 2018 13:38:21 +0200 Message-Id: <20181202113826.32133-11-amir73il@gmail.com> In-Reply-To: <20181202113826.32133-1-amir73il@gmail.com> References: <20181202113826.32133-1-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Wrapper around statfs() interface. Cc: Al Viro Signed-off-by: Amir Goldstein --- fs/statfs.c | 14 ++++++++++++++ include/linux/statfs.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/fs/statfs.c b/fs/statfs.c index f0216629621d..eea7af6f2f22 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 3142e98546ac..9bc69edb8f18 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 -- 2.17.1