Message ID | 20230210-kobj_type-ubifs-v1-1-052419f90fae@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 s9csp702860wrn; Thu, 9 Feb 2023 18:18:10 -0800 (PST) X-Google-Smtp-Source: AK7set/XR0lqTDo0Xy12w1x1vpAoSYOuxoSUbwkQSx0eF5SfzHZ4iu2DMTJrzk+nw2ZeKAN3u0xY X-Received: by 2002:a62:5f81:0:b0:5a8:4d33:f39e with SMTP id t123-20020a625f81000000b005a84d33f39emr4147180pfb.24.1675995490253; Thu, 09 Feb 2023 18:18:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675995490; cv=none; d=google.com; s=arc-20160816; b=y5vUwt2270li2RZXEm2VIoIlgQDJT+tJCttzNTeypm75yx55C5VXr3YqKlzsZ5owJ6 iDBiV48ohy53g6xY78u7ytssKb2RcpiNIlVAow0QIKKNenwSXvrjDESLtmDW1UOmbShT TvPe33Z7WNNQ0OItWqWBtoG4V7JncbYxpt41lyDbDywzUTM/6RYXwDQAKgu0XWtJmJI/ p8vxti2m1WLtVYkBxmT96VT+ef86bysgioQ6TBWV4iXi04f+L+3iEoKTTnvqs5Y7yuzk jc9ONcFB21zLWJmj1+zNJ8BkMEGbP+oCt60mGdxOGq1+MDOrLUbX9HEvpQWriYyGS6GL t34g== 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=zNTGxPbEPMCNjOqVWC1Bu2R2OSt29xI9eMu5esyfSLM=; b=H2iyqpOY04MhuZmPw4OWVOBYz2WuAqpf9rm+VWxvzhX1D+WHVZqvrMDJ66BJFFoAgH nbK/k5CmrudeHsPPJvRAOiDfRR60kEFJ41wzDzyRMZD/JFQeay2vum+tq3AO6JJ4jobT 0l/3h8W+Y30NFf2Byepgju34bLKpgYObVPtJ9r9f/95LoO340gsHxSL9OsHIkKqkhPu3 WSE2/HF8RgE1RN+xgsOB7ta7N2IyNpoIMt1CfzlM/n5S1wzHe+0WEdZdrNsZVpim+SA7 3BOl9r0zy18ZEt6PPiNzqK4mDP/gjnpGGOcpZPqWgRXa8Hl8VeqcsR6M85129pOAz+UH L0AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=C1Zl+D0k; 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 k5-20020aa79985000000b005a5c5914895si3058692pfh.262.2023.02.09.18.17.56; Thu, 09 Feb 2023 18:18:10 -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=C1Zl+D0k; 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 S229554AbjBJCQ2 (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Thu, 9 Feb 2023 21:16:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbjBJCQ1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Feb 2023 21:16:27 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 485D170969 for <linux-kernel@vger.kernel.org>; Thu, 9 Feb 2023 18:16:18 -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=1675995376; bh=IcKXUOph5Uq/d7rKrb0onbZjg5XcHRfrd3jO9HnwOtc=; h=From:Date:Subject:To:Cc:From; b=C1Zl+D0kHHP6WRG/IcJ9m+o7ZDWLuR52OXL9kQ0PXvscuX9Gqhw45LIPxRb4aQyWm pofvytHVdbTTdwl4rO/xHeZIJk30zckiwUV0lWrj1WHmK/lU6jl1tAzeQ65GsF8mei pEIYkjjMG4jJWWc5lIpXhiPISPA2eGHeVR4+2pJI= Date: Fri, 10 Feb 2023 02:16:13 +0000 Subject: [PATCH] ubifs: make kobj_type structures constant MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230210-kobj_type-ubifs-v1-1-052419f90fae@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAOyo5WMC/x2N0QqDMAwAf0XyvECtm6K/MkRajRqVKo2ODfHfF 3y8g+NOEIpMAlVyQqQPC69BIX0k0I4uDITcKYM1NjM2NTivfmr230Z4eO4FX0VpXNY9cyoL0Mo 7IfTRhXbULhzLonKL1PP33rzr6/oDPO1kK3YAAAA= To: Richard Weinberger <richard@nod.at> Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?T?= =?utf-8?q?homas_Wei=C3=9Fschuh?= <linux@weissschuh.net> X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675995374; l=1131; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=IcKXUOph5Uq/d7rKrb0onbZjg5XcHRfrd3jO9HnwOtc=; b=h0oBl2kNVAVRAwQ2FkTKyDUx9MVHRilJY04iy94HQb8x1TyJyARqGBUi9S71Y+mutyUYJTxf/ i01Zdk1h9O4CnFX8UnzZijYlgogTGypPDMf+V2UrLIEFFhYGzHc5aH3 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?1757408646993303076?= X-GMAIL-MSGID: =?utf-8?q?1757408646993303076?= |
Series |
ubifs: make kobj_type structures constant
|
|
Commit Message
Thomas Weißschuh
Feb. 10, 2023, 2:16 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/ubifs/sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
base-commit: e544a07438522ab3688416e6e2e34bf0ee6d8755
change-id: 20230210-kobj_type-ubifs-5790a3d46e97
Best regards,
Comments
在 2023/2/10 10:16, Thomas Weißschuh 写道: > 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/ubifs/sysfs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com> > diff --git a/fs/ubifs/sysfs.c b/fs/ubifs/sysfs.c > index 06ad8fa1fcfb..4404ca4f2ce9 100644 > --- a/fs/ubifs/sysfs.c > +++ b/fs/ubifs/sysfs.c > @@ -74,13 +74,13 @@ static const struct sysfs_ops ubifs_attr_ops = { > .show = ubifs_attr_show, > }; > > -static struct kobj_type ubifs_sb_ktype = { > +static const struct kobj_type ubifs_sb_ktype = { > .default_groups = ubifs_groups, > .sysfs_ops = &ubifs_attr_ops, > .release = ubifs_sb_release, > }; > > -static struct kobj_type ubifs_ktype = { > +static const struct kobj_type ubifs_ktype = { > .sysfs_ops = &ubifs_attr_ops, > }; > > > --- > base-commit: e544a07438522ab3688416e6e2e34bf0ee6d8755 > change-id: 20230210-kobj_type-ubifs-5790a3d46e97 > > Best regards, >
diff --git a/fs/ubifs/sysfs.c b/fs/ubifs/sysfs.c index 06ad8fa1fcfb..4404ca4f2ce9 100644 --- a/fs/ubifs/sysfs.c +++ b/fs/ubifs/sysfs.c @@ -74,13 +74,13 @@ static const struct sysfs_ops ubifs_attr_ops = { .show = ubifs_attr_show, }; -static struct kobj_type ubifs_sb_ktype = { +static const struct kobj_type ubifs_sb_ktype = { .default_groups = ubifs_groups, .sysfs_ops = &ubifs_attr_ops, .release = ubifs_sb_release, }; -static struct kobj_type ubifs_ktype = { +static const struct kobj_type ubifs_ktype = { .sysfs_ops = &ubifs_attr_ops, };