From patchwork Thu Feb 9 03:20:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13133915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7168AC636CC for ; Thu, 9 Feb 2023 03:20:32 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pPxU6-0003bB-NG; Thu, 09 Feb 2023 03:20:30 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pPxU5-0003b4-FA for linux-f2fs-devel@lists.sourceforge.net; Thu, 09 Feb 2023 03:20:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Cc:To:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=3PDIZyYb+5LLhaFUqsvYX1N3H9Ka1BZC1OmItwxznB4=; b=gXfgpxtWR24ZA+l2K421SuIXw4 L9MLaCz5jqR6V3oc0yDWGEhbzLFNRw/OW1lsNUJ9FyUA/f/Oz5niTG/TxZgO+ySbmvaYZPuLIFLlb U9ticjCVvK/MBBiN5Ucp3HwDLMWMFmhpKx2R5/Xr/dPR2EIYWGb0yJud6ZNgIvFoAmjY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Cc:To:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=3PDIZyYb+5LLhaFUqsvYX1N3H9Ka1BZC1OmItwxznB4=; b=Y dFKYO67okREtp0n04fF5HqibJmUR/4p9qjRHGmpAhiKTPiLUJ9LcelLQ549VC+/CEp12r8CQhNuoC PkhqSC/1sRpoMigk5P7dzpB422zZjVoAP3fEhPdjYlosSsOaH3zOdbQqPX0hM5/+8FbzErtF5NFB7 Un/L8NWcIVlOHm5k=; Received: from todd.t-8ch.de ([159.69.126.157]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pPxTz-0006ds-Lp for linux-f2fs-devel@lists.sourceforge.net; Thu, 09 Feb 2023 03:20:28 +0000 From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1675912814; bh=0ax1L+4wlH+3bsB/7eEn2YOweom015kqtn2sv4C2TLM=; h=From:Date:Subject:To:Cc:From; b=FmqVtcQMfIPfadTCbIb6fQaMYIPvH7vQ8bGmgzgE48D5pOefvT8fWpZQQmsMrDrF9 fOJ4kowhcbW5ytiOuOmPFxEMntnr7Tb/W7qvlGpeerY56geyqtXb5gahcF30WoQowB mIzTTORMQQYsv37hlUAcFY3Ur8Pj4Qi76JlfPcPk= Date: Thu, 09 Feb 2023 03:20:10 +0000 MIME-Version: 1.0 Message-Id: <20230209-kobj_type-f2fs-v1-1-b6feedbdd4a8@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAGlm5GMC/x2NQQrCQAwAv1JyNrDGXtqviMhmzdrUsi0bFaX07 6YeZ2CYFUyqikHfrFDlraZzcTgeGkhDLHdBvTkDBToFCh0+Zh6vz+8imCkbctx9armjAB5xNEG usaTBs/KaJpdLlayf/+V82bYf4kgpr3UAAAA= To: Jaegeuk Kim , Chao Yu X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675912812; l=2105; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=0ax1L+4wlH+3bsB/7eEn2YOweom015kqtn2sv4C2TLM=; b=kIRzSTrKvek4pySmNk1lSuXeegxwku6qFmFpJjx7qPcDmSyr1HrZc7v/iT/FDL9a3zQH3ynhi z00ICnBe17YAoHuKe6JJhWcCvt440/jSRgeJiJJdyR/TAYIYMrybH8a X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Headers-End: 1pPxTz-0006ds-Lp Subject: [f2fs-dev] [PATCH] f2fs: make kobj_type structures constant X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 Reviewed-by: Chao Yu --- fs/f2fs/sysfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- base-commit: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb change-id: 20230209-kobj_type-f2fs-ba2302c4b920 Best regards, diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 83a366f3ee80..43f1ff1b92ba 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -1129,13 +1129,13 @@ static const struct sysfs_ops f2fs_attr_ops = { .store = f2fs_attr_store, }; -static struct kobj_type f2fs_sb_ktype = { +static const struct kobj_type f2fs_sb_ktype = { .default_groups = f2fs_groups, .sysfs_ops = &f2fs_attr_ops, .release = f2fs_sb_release, }; -static struct kobj_type f2fs_ktype = { +static const struct kobj_type f2fs_ktype = { .sysfs_ops = &f2fs_attr_ops, }; @@ -1143,7 +1143,7 @@ static struct kset f2fs_kset = { .kobj = {.ktype = &f2fs_ktype}, }; -static struct kobj_type f2fs_feat_ktype = { +static const struct kobj_type f2fs_feat_ktype = { .default_groups = f2fs_feat_groups, .sysfs_ops = &f2fs_attr_ops, }; @@ -1184,7 +1184,7 @@ static const struct sysfs_ops f2fs_stat_attr_ops = { .store = f2fs_stat_attr_store, }; -static struct kobj_type f2fs_stat_ktype = { +static const struct kobj_type f2fs_stat_ktype = { .default_groups = f2fs_stat_groups, .sysfs_ops = &f2fs_stat_attr_ops, .release = f2fs_stat_kobj_release, @@ -1211,7 +1211,7 @@ static const struct sysfs_ops f2fs_feature_list_attr_ops = { .show = f2fs_sb_feat_attr_show, }; -static struct kobj_type f2fs_feature_list_ktype = { +static const struct kobj_type f2fs_feature_list_ktype = { .default_groups = f2fs_sb_feat_groups, .sysfs_ops = &f2fs_feature_list_attr_ops, .release = f2fs_feature_list_kobj_release,