From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Tom Lendacky <thomas.lendacky@amd.com>,
linux-kernel@vger.kernel.org, x86@kernel.org,
linux-coco@lists.linux.dev, svsm-devel@coconut-svsm.dev
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Dan Williams <dan.j.williams@intel.com>,
Michael Roth <michael.roth@amd.com>,
Ashish Kalra <ashish.kalra@amd.com>,
Joel Becker <jlbec@evilplan.org>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v5 10/13] fs/configfs: Add a callback to determine attribute visibility
Date: Thu, 11 Jul 2024 22:07:57 +0200 [thread overview]
Message-ID: <45f04f18-0f17-46a3-a8ba-21d1819e560a@wanadoo.fr> (raw)
In-Reply-To: <e555c8740a263fab9f83b2cbb44da1af49a2813c.1717600736.git.thomas.lendacky@amd.com>
Le 05/06/2024 à 17:18, Tom Lendacky a écrit :
> In order to support dynamic decisions as to whether an attribute should be
> created, add a callback that returns a bool to indicate whether the
> attribute should be displayed. If no callback is registered, the attribute
> is displayed by default.
>
> Cc: Joel Becker <jlbec@evilplan.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Co-developed-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> fs/configfs/dir.c | 10 ++++++++++
> include/linux/configfs.h | 3 +++
> 2 files changed, 13 insertions(+)
>
> diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
> index 18677cd4e62f..43d6bde1adcc 100644
> --- a/fs/configfs/dir.c
> +++ b/fs/configfs/dir.c
> @@ -580,6 +580,7 @@ static void detach_attrs(struct config_item * item)
> static int populate_attrs(struct config_item *item)
> {
> const struct config_item_type *t = item->ci_type;
> + struct configfs_group_operations *ops;
> struct configfs_attribute *attr;
> struct configfs_bin_attribute *bin_attr;
> int error = 0;
> @@ -587,14 +588,23 @@ static int populate_attrs(struct config_item *item)
>
> if (!t)
> return -EINVAL;
> +
> + ops = t->ct_group_ops;
> +
> if (t->ct_attrs) {
> for (i = 0; (attr = t->ct_attrs[i]) != NULL; i++) {
> + if (ops && ops->is_visible && !ops->is_visible(item, attr, i))
> + continue;
> +
> if ((error = configfs_create_file(item, attr)))
> break;
> }
> }
> if (t->ct_bin_attrs) {
> for (i = 0; (bin_attr = t->ct_bin_attrs[i]) != NULL; i++) {
> + if (ops && ops->is_bin_visible && !ops->is_bin_visible(item, bin_attr, i))
> + continue;
> +
> error = configfs_create_bin_file(item, bin_attr);
> if (error)
> break;
> diff --git a/include/linux/configfs.h b/include/linux/configfs.h
> index 2606711adb18..c771e9d0d0b9 100644
> --- a/include/linux/configfs.h
> +++ b/include/linux/configfs.h
> @@ -216,6 +216,9 @@ struct configfs_group_operations {
> struct config_group *(*make_group)(struct config_group *group, const char *name);
> void (*disconnect_notify)(struct config_group *group, struct config_item *item);
> void (*drop_item)(struct config_group *group, struct config_item *item);
> + bool (*is_visible)(struct config_item *item, struct configfs_attribute *attr, int n);
> + bool (*is_bin_visible)(struct config_item *item, struct configfs_bin_attribute *attr,
Hi,
Should/could this take a *const* struct configfs_bin_attribute * and a
const struct config_item *?
I'm currently looking if if is feasible to constify struct
configfs_attribute and co.
In my investigation, I arrived on this new API.
So, if it makes sense to constify the attr argument, it would avoid some
later work if.
Just my 2c
CJ
> + int n);
> };
>
> struct configfs_subsystem {
next prev parent reply other threads:[~2024-07-11 20:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 15:18 [PATCH v5 00/13] Provide SEV-SNP support for running under an SVSM Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 01/13] x86/irqflags: Provide native versions of the local_irq_save()/restore() Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 02/13] x86/sev: Check for the presence of an SVSM in the SNP Secrets page Tom Lendacky
2024-06-05 19:38 ` Borislav Petkov
2024-06-05 21:17 ` Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 03/13] x86/sev: Use kernel provided SVSM Calling Areas Tom Lendacky
2024-06-06 12:36 ` Borislav Petkov
2024-06-05 15:18 ` [PATCH v5 04/13] x86/sev: Perform PVALIDATE using the SVSM when not at VMPL0 Tom Lendacky
2024-06-06 14:38 ` Borislav Petkov
2024-06-17 17:50 ` Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 05/13] x86/sev: Use the SVSM to create a vCPU when not in VMPL0 Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 06/13] x86/sev: Provide SVSM discovery support Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 07/13] x86/sev: Provide guest VMPL level to userspace Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 08/13] virt: sev-guest: Choose the VMPCK key based on executing VMPL Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 09/13] configfs-tsm: Allow the privlevel_floor attribute to be updated Tom Lendacky
2024-06-14 20:47 ` Dan Williams
2024-06-05 15:18 ` [PATCH v5 10/13] fs/configfs: Add a callback to determine attribute visibility Tom Lendacky
2024-07-11 20:07 ` Christophe JAILLET [this message]
2024-06-05 15:18 ` [PATCH v5 11/13] x86/sev: Take advantage of configfs visibility support in TSM Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 12/13] x86/sev: Extend the config-fs attestation support for an SVSM Tom Lendacky
2024-06-06 19:15 ` Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 13/13] x86/sev: Allow non-VMPL0 execution when an SVSM is present Tom Lendacky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45f04f18-0f17-46a3-a8ba-21d1819e560a@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hch@lst.de \
--cc=hpa@zytor.com \
--cc=jlbec@evilplan.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=svsm-devel@coconut-svsm.dev \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).