From patchwork Mon Oct 16 15:18:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 10008855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 119BF601D5 for ; Mon, 16 Oct 2017 15:27:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02044285ED for ; Mon, 16 Oct 2017 15:27:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9C76285FF; Mon, 16 Oct 2017 15:27:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7317328604 for ; Mon, 16 Oct 2017 15:27:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754157AbdJPP1g (ORCPT ); Mon, 16 Oct 2017 11:27:36 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:51942 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753622AbdJPPTL (ORCPT ); Mon, 16 Oct 2017 11:19:11 -0400 Received: by mail-wm0-f65.google.com with SMTP id f4so4489683wme.0; Mon, 16 Oct 2017 08:19:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yVMYFBR/CQr00T8dBrzajOqWB6n362pCrB13rY5ZD/4=; b=AYyB0aAe5ST6luOxZIZZEsye2f1BiAg1NSZeRKcRZCKGyCecUg3uwmjK8SPGzyWRfK zIMKFjuuw6j34JJJH29BtbM3+iFyMCFv773xO7PYZp3lVH4lbzMbPxItWiqVOb3/AXag VkV8YjpzJ65dwuEbvnWCn+OiXsLMk0CFn9fdVznuYPBHnPoxu9ptc278KqUt2S2ycstW V1CwBWbbwQS/WUGAZSoFNa11Ml4XywoukFeG33NxyfLUS2j4OwdifmbtEsA9P/CQS0pf gjCvoZ4k859Oj6BjHIwXqHNHLowUrfW59vCDAsKfMibgvqMBJdGYBWSM0trfAm4cV4y/ xTew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yVMYFBR/CQr00T8dBrzajOqWB6n362pCrB13rY5ZD/4=; b=Ne8Vm8jR+sWMdUfVTYodP0yqXTUfauoWJ26zxAFTz/2zCTQoiH52wEsV+VDYEybri0 jeG+Pyzqemf+iUxEH/72n0GFNFoFrmzbi/hiz/+Yqsk93hUq4G1xXfJllF28KNeNa081 8ZyCS5HvziAZuqiMWv+6Fnkemw36YIarWUCmITs0+7PqFFcZn5XhcH6GlUqxlmZp67US Ftt7mkneYNrbK2A68scv6stgE9em1ckhEQ7KehsWme02cl593LIST0dN2R80VQJw5iDT Uc3c033Oo7acUmc0YiZI/TgD/NucFrEU9bhU2mX923Spx1l8qcUhrfXe/f2NmJZrYrwc 2NMA== X-Gm-Message-State: AMCzsaV/yrb0m2pIBA8Xv3JD0zUgtT8dw6MXJqMKZpJCVyOL++Xxjvig GjE3m3mfLN5GaYx40MaRy7I= X-Google-Smtp-Source: ABhQp+SHRCx9oqPVi25KzaW//g/QZzlZnkzrO8eSwbNUnPN8MkzIoBMbtEKyX99XCEU710q4qWeuSQ== X-Received: by 10.223.134.154 with SMTP id 26mr978307wrx.137.1508167148605; Mon, 16 Oct 2017 08:19:08 -0700 (PDT) Received: from gmail.com (dell-goyal.wifi.rsr.lip6.fr. [132.227.77.190]) by smtp.gmail.com with ESMTPSA id c45sm9257879wrg.97.2017.10.16.08.19.06 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 16 Oct 2017 08:19:07 -0700 (PDT) Received: by gmail.com (sSMTP sendmail emulation); Mon, 16 Oct 2017 17:19:06 +0200 From: Bhumika Goyal To: julia.lawall@lip6.fr, rjw@rjwysocki.net, lenb@kernel.org, alexander.shishkin@linux.intel.com, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com, hch@lst.de, sagi@grimberg.me, kishon@ti.com, bhelgaas@google.com, nab@linux-iscsi.org, balbi@kernel.org, gregkh@linuxfoundation.org, laurent.pinchart@ideasonboard.com, jlbec@evilplan.org, ccaulfie@redhat.com, teigland@redhat.com, mfasheh@versity.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-usb@vger.kernel.org, cluster-devel@redhat.com, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH v2 01/15] configfs: make ci_type field, some pointers and function arguments const Date: Mon, 16 Oct 2017 17:18:40 +0200 Message-Id: <1508167134-6243-2-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508167134-6243-1-git-send-email-bhumirks@gmail.com> References: <1508167134-6243-1-git-send-email-bhumirks@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ci_type field of the config_item structure do not modify the fields of the config_item_type structure it points to. And the other pointers initialized with ci_type do not modify the fields as well. So, make the ci_type field and the pointers initialized with ci_type as const. Make the struct config_item_type *type function argument of functions config_{item/group}_init_type_name const as the argument in both the functions is only stored in the ci_type field of a config_item structure which is now made const. Make the argument of configfs_register_default_group const as it is only passed to the argument of the function config_group_init_type_name which is now const. Signed-off-by: Bhumika Goyal Acked-by: Greg Kroah-Hartman --- * Changes in v2- Combine all the followup patches and the constification patches into a series. fs/configfs/dir.c | 10 +++++----- fs/configfs/item.c | 6 +++--- fs/configfs/symlink.c | 4 ++-- include/linux/configfs.h | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 56fb261..577cff2 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -584,7 +584,7 @@ static void detach_attrs(struct config_item * item) static int populate_attrs(struct config_item *item) { - struct config_item_type *t = item->ci_type; + const struct config_item_type *t = item->ci_type; struct configfs_attribute *attr; struct configfs_bin_attribute *bin_attr; int error = 0; @@ -901,7 +901,7 @@ static void configfs_detach_group(struct config_item *item) static void client_disconnect_notify(struct config_item *parent_item, struct config_item *item) { - struct config_item_type *type; + const struct config_item_type *type; type = parent_item->ci_type; BUG_ON(!type); @@ -920,7 +920,7 @@ static void client_disconnect_notify(struct config_item *parent_item, static void client_drop_item(struct config_item *parent_item, struct config_item *item) { - struct config_item_type *type; + const struct config_item_type *type; type = parent_item->ci_type; BUG_ON(!type); @@ -1260,7 +1260,7 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode struct config_item *parent_item; struct configfs_subsystem *subsys; struct configfs_dirent *sd; - struct config_item_type *type; + const struct config_item_type *type; struct module *subsys_owner = NULL, *new_item_owner = NULL; char *name; @@ -1810,7 +1810,7 @@ void configfs_unregister_group(struct config_group *group) struct config_group * configfs_register_default_group(struct config_group *parent_group, const char *name, - struct config_item_type *item_type) + const struct config_item_type *item_type) { int ret; struct config_group *group; diff --git a/fs/configfs/item.c b/fs/configfs/item.c index a66f662..88f266e 100644 --- a/fs/configfs/item.c +++ b/fs/configfs/item.c @@ -113,7 +113,7 @@ int config_item_set_name(struct config_item *item, const char *fmt, ...) void config_item_init_type_name(struct config_item *item, const char *name, - struct config_item_type *type) + const struct config_item_type *type) { config_item_set_name(item, "%s", name); item->ci_type = type; @@ -122,7 +122,7 @@ void config_item_init_type_name(struct config_item *item, EXPORT_SYMBOL(config_item_init_type_name); void config_group_init_type_name(struct config_group *group, const char *name, - struct config_item_type *type) + const struct config_item_type *type) { config_item_set_name(&group->cg_item, "%s", name); group->cg_item.ci_type = type; @@ -148,7 +148,7 @@ struct config_item *config_item_get_unless_zero(struct config_item *item) static void config_item_cleanup(struct config_item *item) { - struct config_item_type *t = item->ci_type; + const struct config_item_type *t = item->ci_type; struct config_group *s = item->ci_group; struct config_item *parent = item->ci_parent; diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index c8aabba..78ffc26 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c @@ -138,7 +138,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna struct configfs_dirent *sd; struct config_item *parent_item; struct config_item *target_item = NULL; - struct config_item_type *type; + const struct config_item_type *type; sd = dentry->d_parent->d_fsdata; /* @@ -186,7 +186,7 @@ int configfs_unlink(struct inode *dir, struct dentry *dentry) struct configfs_dirent *sd = dentry->d_fsdata; struct configfs_symlink *sl; struct config_item *parent_item; - struct config_item_type *type; + const struct config_item_type *type; int ret; ret = -EPERM; /* What lack-of-symlink returns */ diff --git a/include/linux/configfs.h b/include/linux/configfs.h index c967090..90b90f8 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h @@ -58,7 +58,7 @@ struct config_item { struct list_head ci_entry; struct config_item *ci_parent; struct config_group *ci_group; - struct config_item_type *ci_type; + const struct config_item_type *ci_type; struct dentry *ci_dentry; }; @@ -72,7 +72,7 @@ static inline char *config_item_name(struct config_item * item) extern void config_item_init_type_name(struct config_item *item, const char *name, - struct config_item_type *type); + const struct config_item_type *type); extern struct config_item *config_item_get(struct config_item *); extern struct config_item *config_item_get_unless_zero(struct config_item *); @@ -101,7 +101,7 @@ struct config_group { extern void config_group_init(struct config_group *group); extern void config_group_init_type_name(struct config_group *group, const char *name, - struct config_item_type *type); + const struct config_item_type *type); static inline struct config_group *to_config_group(struct config_item *item) { @@ -261,7 +261,7 @@ int configfs_register_group(struct config_group *parent_group, struct config_group * configfs_register_default_group(struct config_group *parent_group, const char *name, - struct config_item_type *item_type); + const struct config_item_type *item_type); void configfs_unregister_default_group(struct config_group *group); /* These functions can sleep and can alloc with GFP_KERNEL */