From mboxrd@z Thu Jan 1 00:00:00 1970 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.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 AE2D0C05027 for ; Thu, 9 Feb 2023 03:22:51 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4PC2HZ193xz3chB for ; Thu, 9 Feb 2023 14:22:50 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.98; helo=out30-98.freemail.mail.aliyun.com; envelope-from=hsiangkao@linux.alibaba.com; receiver=) Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4PC2HT2yK3z3bT7 for ; Thu, 9 Feb 2023 14:22:44 +1100 (AEDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VbE36X2_1675912957; Received: from 30.97.49.34(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VbE36X2_1675912957) by smtp.aliyun-inc.com; Thu, 09 Feb 2023 11:22:40 +0800 Message-ID: Date: Thu, 9 Feb 2023 11:22:37 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] erofs: make kobj_type structures constant To: =?UTF-8?Q?Thomas_Wei=c3=9fschuh?= , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu References: <20230209-kobj_type-erofs-v1-1-078c945e2c4b@weissschuh.net> From: Gao Xiang In-Reply-To: <20230209-kobj_type-erofs-v1-1-078c945e2c4b@weissschuh.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" On 2023/2/9 11:21, 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 Acked-by: Gao Xiang Thanks, Gao Xiang > --- > fs/erofs/sysfs.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c > index fd476961f742..435e515c0792 100644 > --- a/fs/erofs/sysfs.c > +++ b/fs/erofs/sysfs.c > @@ -179,13 +179,13 @@ static const struct sysfs_ops erofs_attr_ops = { > .store = erofs_attr_store, > }; > > -static struct kobj_type erofs_sb_ktype = { > +static const struct kobj_type erofs_sb_ktype = { > .default_groups = erofs_groups, > .sysfs_ops = &erofs_attr_ops, > .release = erofs_sb_release, > }; > > -static struct kobj_type erofs_ktype = { > +static const struct kobj_type erofs_ktype = { > .sysfs_ops = &erofs_attr_ops, > }; > > @@ -193,7 +193,7 @@ static struct kset erofs_root = { > .kobj = {.ktype = &erofs_ktype}, > }; > > -static struct kobj_type erofs_feat_ktype = { > +static const struct kobj_type erofs_feat_ktype = { > .default_groups = erofs_feat_groups, > .sysfs_ops = &erofs_attr_ops, > }; > > --- > base-commit: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb > change-id: 20230209-kobj_type-erofs-0f0f4c901045 > > Best regards,