Message ID | 20230209-kobj_type-ext4-v1-1-6865fb05c1f8@weissschuh.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp99501wrn; Wed, 8 Feb 2023 19:25:14 -0800 (PST) X-Google-Smtp-Source: AK7set/94yE5m+n31OT60BadWHjKvysVSpot93ZvGiCHbgTe9vruu6j5+ZwhMYcK24G4Skv1xTwg X-Received: by 2002:a62:d115:0:b0:5a8:1637:1f03 with SMTP id z21-20020a62d115000000b005a816371f03mr6109156pfg.1.1675913114555; Wed, 08 Feb 2023 19:25:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675913114; cv=none; d=google.com; s=arc-20160816; b=V7fl/fqHyy8ZG6FBj0+VVKhZfjHHpoopa9y8AA4mMxZaHIb5w13Cs5w0NgeRl+Bkzu dHdno0c1pt9zXQNVbm5fUwe00fFHVNSe9oMD+QDMNYeCA/ZuWnLl3+IxYaNzd0LNErXv 2ZDaFMTG8gYob1tPa0p7tgEGaSml2rSzieDppW8IV3J65MPtpLtPS6Pv4VuckW5ULo5s 4VaPTSQK0qRoZZlQdGwZBvfNACwdwQ5XjzeHjML8AjmJd/daoLHlZsIaB0uMWPO/LBjM XBQoiVrvMKsOZcZk9yTQljUqnxx7SKZWWa9Zfo1WTvZCKWCT66VwQlOG9fjlcwx5MCcx wsYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:dkim-signature:from; bh=aVKH/0hXhSCD4TkKhE5limTXl/q4GdYSjG3Icox6HxE=; b=bGq2eIkaVLOzURLuYVMDZYRIvJGeQUcy81klfiqe+0w+0Ud1KUZfeU78rUET/fVXdU H+FJbyv4Liee3Y2PNkEWBhmMPbV+EDNxLu1xAyxcDU5WtPOtOX+b+qVRzx9bg/E99pDq cwy+s1AiVobp+CbrEDwmiC8i1FqxqaoA8GkX5ZMJi6Rux/Wf/n1ZEdUCsuOPi8Iuanx8 QTQ/y1AFZZuFeHedZ5pOKU1SeCFgmVP+glrFiAt9nyx1HBgv5yOtPqUn7zo7WcKKPhwe psvYbDk71oTwI/PAwDyCDbXH2VhokgYUEE2E5mUY/HO9A1aBk4+ZCK6WWiaIHz5ZiquI ANRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=dtKAwyvA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g28-20020aa79ddc000000b00565ba4c501asi456788pfq.276.2023.02.08.19.25.01; Wed, 08 Feb 2023 19:25:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=dtKAwyvA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232680AbjBIDTO (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Wed, 8 Feb 2023 22:19:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbjBIDSj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 8 Feb 2023 22:18:39 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 134025FD4; Wed, 8 Feb 2023 19:18:39 -0800 (PST) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <linux@weissschuh.net> DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1675912717; bh=jjDU3ChkgfkUs+8zhzngad6rgmB2giHbf/BU63I4rfg=; h=From:Date:Subject:To:Cc:From; b=dtKAwyvAdiuOCUq8Dhc0NnN4IYZmYBdZ1QEyh0eLS5Z8ZnhpNne/lGiHXnQeoCl2f QCT8UzQ2rpzC7vsH32Ok7UIvNPp1zkboWPcmJ8aO77PWgyWYD88MhP/lAr+OKYNxGl n0A+d2Je8B/W9OW1jE+tGRv0F0u4PwT30kfBs3s0= Date: Thu, 09 Feb 2023 03:18:35 +0000 Subject: [PATCH] ext4: make kobj_type structures constant MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230209-kobj_type-ext4-v1-1-6865fb05c1f8@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAApm5GMC/x2NWwqDMBAAryL73YV0fZR4lSKS6LZulSiJikW8e 5d+zsAwJySOwgnq7ITIuySZg8L9lkE3uPBmlF4ZyFBuyFgcZ/9p1+/CyMdaoK2oLwsqH5V1oJF 3idFHF7pBs7BNk8ol8kuO/+XZXNcP9uWlhXUAAAA= To: Theodore Ts'o <tytso@mit.edu>, Andreas Dilger <adilger.kernel@dilger.ca> Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thom?= =?utf-8?q?as_Wei=C3=9Fschuh?= <linux@weissschuh.net> X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675912715; l=1209; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=jjDU3ChkgfkUs+8zhzngad6rgmB2giHbf/BU63I4rfg=; b=GdidmAXCVsiBRCNB6UgRitsMUO+dUYtE4OIJBJDx3Ub8W+X0GY7VE1WOd/Miup14Sabtl5pGU weuMSzG4eaOC9F1em4JLPSQn8pY/8Y5FaTcs69FDIavi320vbuPIznx X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757322269961184958?= X-GMAIL-MSGID: =?utf-8?q?1757322269961184958?= |
Series |
ext4: make kobj_type structures constant
|
|
Commit Message
Thomas Weißschuh
Feb. 9, 2023, 3:18 a.m. UTC
Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.
Take advantage of this to constify the structure definitions to prevent
modification at runtime.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
fs/ext4/sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
base-commit: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb
change-id: 20230209-kobj_type-ext4-962d5425769a
Best regards,
Comments
On Thu 09-02-23 03:18:35, Thomas Weißschuh wrote: > Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.") > the driver core allows the usage of const struct kobj_type. > > Take advantage of this to constify the structure definitions to prevent > modification at runtime. > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/ext4/sysfs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c > index d233c24ea342..364e3da49b03 100644 > --- a/fs/ext4/sysfs.c > +++ b/fs/ext4/sysfs.c > @@ -496,13 +496,13 @@ static const struct sysfs_ops ext4_attr_ops = { > .store = ext4_attr_store, > }; > > -static struct kobj_type ext4_sb_ktype = { > +static const struct kobj_type ext4_sb_ktype = { > .default_groups = ext4_groups, > .sysfs_ops = &ext4_attr_ops, > .release = ext4_sb_release, > }; > > -static struct kobj_type ext4_feat_ktype = { > +static const struct kobj_type ext4_feat_ktype = { > .default_groups = ext4_feat_groups, > .sysfs_ops = &ext4_attr_ops, > .release = (void (*)(struct kobject *))kfree, > > --- > base-commit: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb > change-id: 20230209-kobj_type-ext4-962d5425769a > > Best regards, > -- > Thomas Weißschuh <linux@weissschuh.net> >
On Thu, 09 Feb 2023 03:18:35 +0000, Thomas Weißschuh wrote: > Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.") > the driver core allows the usage of const struct kobj_type. > > Take advantage of this to constify the structure definitions to prevent > modification at runtime. > > > [...] Applied, thanks! [1/1] ext4: make kobj_type structures constant commit: 60db00e0a1490adcdc8b80887f7caf954d8bcd3e Best regards,
diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c index d233c24ea342..364e3da49b03 100644 --- a/fs/ext4/sysfs.c +++ b/fs/ext4/sysfs.c @@ -496,13 +496,13 @@ static const struct sysfs_ops ext4_attr_ops = { .store = ext4_attr_store, }; -static struct kobj_type ext4_sb_ktype = { +static const struct kobj_type ext4_sb_ktype = { .default_groups = ext4_groups, .sysfs_ops = &ext4_attr_ops, .release = ext4_sb_release, }; -static struct kobj_type ext4_feat_ktype = { +static const struct kobj_type ext4_feat_ktype = { .default_groups = ext4_feat_groups, .sysfs_ops = &ext4_attr_ops, .release = (void (*)(struct kobject *))kfree,