Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2499183ybd; Mon, 24 Jun 2019 07:29:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4HeYX6ekBspn0M+ClxWR/BoGQw9Zh2K8tc/TN7eBE7DOb6jZXlyFEVT/oiJmJ/AKN49Ww X-Received: by 2002:a63:d60c:: with SMTP id q12mr32742847pgg.176.1561386549605; Mon, 24 Jun 2019 07:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561386549; cv=none; d=google.com; s=arc-20160816; b=NtrqDyCx3b42smjnCpSXVtOUOHEGo1Ebo+DFpWVuMwe51Xmmxn0MQpXI3JaGg683bu HcqLHoR6b+O9P8fnKIRXz+6/b0Y8gUmyASP1ETA5bK+hIBrNMRszD+GuE9y7O72BLcoc /j0IbrFr7QiwDfiYWEY9BkJk4RRNOIHJYiSQVrb6zsaLDFYm4yE48bodTQrTfKrUNEbA E1BzLzHu0PQJqAfJljxQjunYbYYLd3as3Kmj7tKGqjIl6wpWZR/8aCkFT7+HIVttAflx fXGMnD4zORyvmkMpH18gwwcRuukBBm73Cd3lAIHAZ+/yqcPPeiS1ix+fCHp3wt8ju7/I ZieA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization; bh=LoRIQArz9fSPjHNrrg1hDwb+Inb3+ENdhDpv7DvpUaM=; b=ALM4VzO6yLJxztnvQUVyNKTBAZNIUTMP9eSpw6uY75NKWgACrTc2gpp07QENqs971L K1DnNAI/DKlkVlIHwTPlFf8wYVLuGfTKxp8RF1N4QUO53ERffsOrOXJR0VsTebLhyFJY qv3pm/lhVCXY9TXoZMF+jG2fMoRCXxMZtplPrQOQwCR+3poJvcVLousZ8Ls1lE6gEMZh CBj1B4ApADXJxUrv9or5eY3uMBtnOaYMFcZbTnMV6zEwKt8peULaj7mp+cMfdS38xIIh mDDJzJY1EBc1heWUfiv9xKkwrkobbbVUP8mqrNdReneuQf8xtbI3oqCUyNuC+aUsoHZE XnOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8si10692505pgs.457.2019.06.24.07.28.53; Mon, 24 Jun 2019 07:29:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728107AbfFXOMV (ORCPT + 99 others); Mon, 24 Jun 2019 10:12:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55954 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727283AbfFXOMU (ORCPT ); Mon, 24 Jun 2019 10:12:20 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 549CA3001836; Mon, 24 Jun 2019 14:12:20 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-57.rdu2.redhat.com [10.10.120.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 121FC5D9C5; Mon, 24 Jun 2019 14:12:18 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 24/25] fsinfo: bpf - add sb operation fsinfo() [ver #14] From: David Howells To: viro@zeniv.linux.org.uk Cc: dhowells@redhat.com, raven@themaw.net, mszeredi@redhat.com, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 24 Jun 2019 15:12:18 +0100 Message-ID: <156138553835.25627.17552849634696580641.stgit@warthog.procyon.org.uk> In-Reply-To: <156138532485.25627.7459410522109581052.stgit@warthog.procyon.org.uk> References: <156138532485.25627.7459410522109581052.stgit@warthog.procyon.org.uk> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 24 Jun 2019 14:12:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ian Kent The new fsinfo() system call adds a new super block operation ->fsinfo() which is used by file systems to provide file system specific information for fsinfo() requests. The fsinfo() request FSINFO_ATTR_PARAMETERS provides the same function as sb operation ->show_options() so it needs to be implemented by any file system that provides ->show_options() as a minimum. Signed-off-by: Ian Kent Signed-off-by: David Howells --- kernel/bpf/inode.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c index 6e22363054b1..8c3575eca976 100644 --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c @@ -23,6 +23,7 @@ #include #include #include +#include enum bpf_type { BPF_TYPE_UNSPEC = 0, @@ -567,6 +568,27 @@ static int bpf_show_options(struct seq_file *m, struct dentry *root) return 0; } +#ifdef CONFIG_FSINFO +/* + * Get filesystem information. + */ +static int bpf_fsinfo(struct path *path, struct fsinfo_kparams *params) +{ + umode_t mode = d_inode(path->dentry)->i_mode & S_IALLUGO & ~S_ISVTX; + + switch (params->request) { + case FSINFO_ATTR_PARAMETERS: + fsinfo_note_sb_params(params, path->dentry->d_sb->s_flags); + if (mode != S_IRWXUGO) + fsinfo_note_paramf(params, "mode", "%o", mode); + return params->usage; + + default: + return generic_fsinfo(path, params); + } +} +#endif /* CONFIG_FSINFO */ + static void bpf_free_inode(struct inode *inode) { enum bpf_type type; @@ -583,6 +605,9 @@ static const struct super_operations bpf_super_ops = { .drop_inode = generic_delete_inode, .show_options = bpf_show_options, .free_inode = bpf_free_inode, +#ifdef CONFIG_FSINFO + .fsinfo = bpf_fsinfo, +#endif }; enum {