From nobody Thu Feb 12 00:28:56 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9CA015886A; Tue, 18 Jun 2024 09:45:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718703902; cv=none; b=o8yribEH40Usr/726aZfYfsqrgpjpo9SwMU77Uji4Tni6NgX9AC4d75Rmrxs4fYyKQH0TSHXVT8OWF2XAl4HQL9LSQ4AxUcGjGdZguj0g/y9GFrVtRfEqk2A/RSp0GsaZbfvn/j2rkQ0/9GHi/kPt6REqxg3IkKGuUTl6/35NHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718703902; c=relaxed/simple; bh=cSghjsEwm0oSadzX5B2qh5Bvl2He/hbSq75IYjQs+5g=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=fs1K4IqImJ3xp78bqI6SWGrMwhoTt+q0zZyeSZb600Hy970qN4a6V/jDKuH2Tc9a0Y9JjUJdtBuEByCKNH9YMXTDWuuWnP4B+KddIoPerKMIJSx0YQRRq7U2AuRrYT4YQwJesbbgGxCGLECPKLf+c4i99PvEcxGx5N0upHOK1HQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gWhdTpBM; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=PXklnixj; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gWhdTpBM"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PXklnixj" Date: Tue, 18 Jun 2024 09:44:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718703898; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vPwyuHKZV5s3QK+XnC78NlAWnjcWwf4f+UR1goYrZek=; b=gWhdTpBM45HdULqyUIizJMtLgsH/u9J0cKAZfaYnT0y1Kr34visbmfcsF/Yp3zjo7m7dP0 y2tsvsAuDw7ho6QW21qgocZKzwj+6A0gHjij4ZELqjz2U5ARBU4jmmW6CyE9Syjtu2CuUH GnKNhFxsNyd8fBFlvx2lhIjGuFErX3HiDAbvYJtPkiNELXt1vhXrIfKDrpoX1AXx+dEwmD tN7I2taXJfX5U9I0p7x6bybZ1C+yKuSuit67fElcuAK26JYlGfRfU5jGqJlo+1HhW/3iuL YQryVP6wWN6A2bS1YmIeDC1jnu4H4vh4RdqoJZg42WbfJ3Mz5VuZ1PTyEglR9Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718703898; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vPwyuHKZV5s3QK+XnC78NlAWnjcWwf4f+UR1goYrZek=; b=PXklnixjnHtswuKQZxfT8EgqxYzt3fLPYhdLMAzq588MNk/5ZhgmU3EXonAmEM/CP4IgvS KFqMpo7fS5KSU/Dw== From: "tip-bot2 for Tom Lendacky" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sev] fs/configfs: Add a callback to determine attribute visibility Cc: Dan Williams , Tom Lendacky , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3Ce555c8740a263fab9f83b2cbb44da1af49a2813c=2E17176?= =?utf-8?q?00736=2Egit=2Ethomas=2Elendacky=40amd=2Ecom=3E?= References: =?utf-8?q?=3Ce555c8740a263fab9f83b2cbb44da1af49a2813c=2E171760?= =?utf-8?q?0736=2Egit=2Ethomas=2Elendacky=40amd=2Ecom=3E?= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171870389862.10875.6010778864006857480.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/sev branch of tip: Commit-ID: 0e6a35b93745bb2d8b921fd0520ef730489d41a2 Gitweb: https://git.kernel.org/tip/0e6a35b93745bb2d8b921fd0520ef7304= 89d41a2 Author: Tom Lendacky AuthorDate: Wed, 05 Jun 2024 10:18:53 -05:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 17 Jun 2024 20:42:57 +02:00 fs/configfs: Add a callback to determine attribute visibility 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. Co-developed-by: Dan Williams Signed-off-by: Dan Williams Signed-off-by: Tom Lendacky Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/e555c8740a263fab9f83b2cbb44da1af49a2813c.17= 17600736.git.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 18677cd..43d6bde 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 =3D item->ci_type; + struct configfs_group_operations *ops; struct configfs_attribute *attr; struct configfs_bin_attribute *bin_attr; int error =3D 0; @@ -587,14 +588,23 @@ static int populate_attrs(struct config_item *item) =20 if (!t) return -EINVAL; + + ops =3D t->ct_group_ops; + if (t->ct_attrs) { for (i =3D 0; (attr =3D t->ct_attrs[i]) !=3D NULL; i++) { + if (ops && ops->is_visible && !ops->is_visible(item, attr, i)) + continue; + if ((error =3D configfs_create_file(item, attr))) break; } } if (t->ct_bin_attrs) { for (i =3D 0; (bin_attr =3D t->ct_bin_attrs[i]) !=3D NULL; i++) { + if (ops && ops->is_bin_visible && !ops->is_bin_visible(item, bin_attr, = i)) + continue; + error =3D configfs_create_bin_file(item, bin_attr); if (error) break; diff --git a/include/linux/configfs.h b/include/linux/configfs.h index 2606711..c771e9d 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 *a= ttr, int n); + bool (*is_bin_visible)(struct config_item *item, struct configfs_bin_attr= ibute *attr, + int n); }; =20 struct configfs_subsystem {