From patchwork Sun Dec 2 11:38:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10707981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0C9F17F0 for ; Sun, 2 Dec 2018 11:38:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B08752AE9F for ; Sun, 2 Dec 2018 11:38:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4AA22AEBA; Sun, 2 Dec 2018 11:38:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 576782AE9F for ; Sun, 2 Dec 2018 11:38:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725857AbeLBLix (ORCPT ); Sun, 2 Dec 2018 06:38:53 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WyHRaU/VRAng0csQ6QFDoFzWZ9FQwMMiw8mjnaBs5B8=; b=RIYOjfPtDQjAno38yOztEwjQNZ0oHFFgHj63ojiMR1vx5rkH6VjxCemsUu/B0JMCKY mgu7QGo6zCJAJo6AxkXi5Ts7eZ6A5qp/s1QukgzriZtKq4/YkAHWBNzZnRcbsCbxqPOt zFiG6wRMEHdhp6B9vVSlqb8SNGDzjJdc0MhQxxZmAqDRGbhYcJ59DB16Pp6bacPnndPY FVSJaMAD2OGTPptG20qTY1/6QRBa9dnrzVEWhOUaJI7nHomudIYEAXKgj9sHP4qygDfC s48YoJ+WdS0nXxfdLpUMfSKKWdwCkYDg/GQz92eQdJZGKb+anDm42qKuOIAgxKvkS+mh tCGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WyHRaU/VRAng0csQ6QFDoFzWZ9FQwMMiw8mjnaBs5B8=; b=AHOuq/1P9KMlr54eE1fS39mt2vavyjWmy0u1qLoHkVUFVFCeA+Jtr0qHrsIUgnBuhC MrxnhSI6iYnqwk0TX6XXXUNQnyb6OjFQq7JGN1ynyZsoNSi5jXW7h7RblWZG49u/knhV sp64PgekOxNFygYMNQSW0ypLTJAujdaK9i/r18h1t9tqdn0zaBQoEhVkLfGfpomEwlqF pWsaz9X9JHCPFRym7zgeQmsUO5Iqq+eOl3fr08ROZAo+zeELwaHPNmHMUJSdbmesJvJp CUnfAV2THf3f38fYnrleBiNYU30ArhNNQ0uW2p6hfyZGbVIbcFZ2jYQ4pwgjNH+Wfbwd seGw== X-Gm-Message-State: AA+aEWYorMPZ8cyu/4A9LCSAwcr/+rPFRWoGvxOm8SBB691wfRr5CrCu 8/3lRHUmLoXeuKcMavjuSPyNvo/l X-Google-Smtp-Source: AFSGD/V7vUeDlbvbY6l6jrMEoMWu3zHkeUnQ2IYMSmSHMjWAUxPgVdf4aMDIGjW56IutFiQeJ2EAQg== X-Received: by 2002:a1c:d14d:: with SMTP id i74mr4544232wmg.100.1543750729357; Sun, 02 Dec 2018 03:38:49 -0800 (PST) Received: from localhost.localdomain (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id c3-v6sm3448672wmb.46.2018.12.02.03.38.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Dec 2018 03:38:48 -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> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181202113826.32133-1-amir73il@gmail.com> References: <20181202113826.32133-1-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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