From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79277C432C1 for ; Tue, 24 Sep 2019 13:23:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5984A2064A for ; Tue, 24 Sep 2019 13:23:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505052AbfIXNXB (ORCPT ); Tue, 24 Sep 2019 09:23:01 -0400 Received: from icp-osb-irony-out7.external.iinet.net.au ([203.59.1.107]:6015 "EHLO icp-osb-irony-out7.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505048AbfIXNXB (ORCPT ); Tue, 24 Sep 2019 09:23:01 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2AiAAA1GIpd/9+j0HYNWBwBAQEEAQE?= =?us-ascii?q?MBAEBgVQGAQELAYQ5hCKPWQEBAQEBAQaBEYoahR+KDoF7CQEBAQEBAQEBATc?= =?us-ascii?q?BAYQ6AwICg0Q1CA4CDAEBAQQBAQEBAQUDAYVYhhkCAQMjBFIQGA0CJgICRxA?= =?us-ascii?q?GE4UZrRNzfzMaijSBDCgBgWKKPniBB4ERM4Mdh0+CWASPVoVNX0KWSIIslSU?= =?us-ascii?q?MjgcDiw8thAakeAGCDU0uCoMnUIF+F44vZopTK4InAQE?= X-IPAS-Result: =?us-ascii?q?A2AiAAA1GIpd/9+j0HYNWBwBAQEEAQEMBAEBgVQGAQELA?= =?us-ascii?q?YQ5hCKPWQEBAQEBAQaBEYoahR+KDoF7CQEBAQEBAQEBATcBAYQ6AwICg0Q1C?= =?us-ascii?q?A4CDAEBAQQBAQEBAQUDAYVYhhkCAQMjBFIQGA0CJgICRxAGE4UZrRNzfzMai?= =?us-ascii?q?jSBDCgBgWKKPniBB4ERM4Mdh0+CWASPVoVNX0KWSIIslSUMjgcDiw8thAake?= =?us-ascii?q?AGCDU0uCoMnUIF+F44vZopTK4InAQE?= X-IronPort-AV: E=Sophos;i="5.64,544,1559491200"; d="scan'208";a="205615178" Received: from unknown (HELO [192.168.1.222]) ([118.208.163.223]) by icp-osb-irony-out7.iinet.net.au with ESMTP; 24 Sep 2019 21:22:49 +0800 Subject: [REPOST PATCH v3 09/16] xfs: mount-api - add xfs_get_tree() From: Ian Kent To: linux-xfs Cc: David Howells , Dave Chinner , Al Viro , Eric Sandeen Date: Tue, 24 Sep 2019 21:22:49 +0800 Message-ID: <156933136908.20933.15050470634891698659.stgit@fedora-28> In-Reply-To: <156933112949.20933.12761540130806431294.stgit@fedora-28> References: <156933112949.20933.12761540130806431294.stgit@fedora-28> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Add the fs_context_operations method .get_tree that validates mount options and fills the super block as previously done by the file_system_type .mount method. Signed-off-by: Ian Kent --- fs/xfs/xfs_super.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index ea3640ffd8f5..6f9fe92b4e21 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1933,6 +1933,51 @@ xfs_fs_fill_super( return error; } +STATIC int +xfs_fill_super( + struct super_block *sb, + struct fs_context *fc) +{ + struct xfs_fs_context *ctx = fc->fs_private; + struct xfs_mount *mp = sb->s_fs_info; + int silent = fc->sb_flags & SB_SILENT; + int error = -ENOMEM; + + mp->m_super = sb; + + /* + * set up the mount name first so all the errors will refer to the + * correct device. + */ + mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL); + if (!mp->m_fsname) + return -ENOMEM; + mp->m_fsname_len = strlen(mp->m_fsname) + 1; + + error = xfs_validate_params(mp, ctx, false); + if (error) + goto out_free_fsname; + + error = __xfs_fs_fill_super(mp, silent); + if (error) + goto out_free_fsname; + + return 0; + + out_free_fsname: + sb->s_fs_info = NULL; + xfs_free_fsname(mp); + + return error; +} + +STATIC int +xfs_get_tree( + struct fs_context *fc) +{ + return vfs_get_block_super(fc, xfs_fill_super); +} + STATIC void xfs_fs_put_super( struct super_block *sb) @@ -2003,6 +2048,11 @@ static const struct super_operations xfs_super_operations = { .free_cached_objects = xfs_fs_free_cached_objects, }; +static const struct fs_context_operations xfs_context_ops = { + .parse_param = xfs_parse_param, + .get_tree = xfs_get_tree, +}; + static struct file_system_type xfs_fs_type = { .owner = THIS_MODULE, .name = "xfs",