From: Bhumika Goyal <bhumirks@gmail.com>
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 <bhumirks@gmail.com>
Subject: [PATCH v2 01/15] configfs: make ci_type field, some pointers and function arguments const
Date: Mon, 16 Oct 2017 15:18:40 +0000 [thread overview]
Message-ID: <1508167134-6243-2-git-send-email-bhumirks@gmail.com> (raw)
In-Reply-To: <1508167134-6243-1-git-send-email-bhumirks@gmail.com>
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 <bhumirks@gmail.com>
---
* 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 */
--
1.9.1
next prev parent reply other threads:[~2017-10-16 15:18 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 15:18 [PATCH v2 00/15] make structure field, function arguments and structures const Bhumika Goyal
2017-10-16 15:18 ` Bhumika Goyal [this message]
2017-10-17 10:24 ` [PATCH v2 01/15] configfs: make ci_type field, some pointers and function arguments const Greg KH
2017-10-16 15:18 ` [PATCH v2 02/15] usb: gadget: make config_item_type structures const Bhumika Goyal
[not found] ` <1508167134-6243-3-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-17 8:30 ` Felipe Balbi
2017-10-18 16:05 ` Laurent Pinchart
2017-10-19 14:06 ` Christoph Hellwig
2017-10-19 15:05 ` Laurent Pinchart
2017-10-20 8:02 ` Julia Lawall
2017-10-20 8:13 ` Bhumika Goyal
[not found] ` <1508167134-6243-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-16 15:18 ` [PATCH v2 03/15] target: make config_item_type const Bhumika Goyal
2017-10-16 15:18 ` [PATCH v2 04/15] iio: make function argument and some structures const Bhumika Goyal
2017-10-16 18:48 ` Jonathan Cameron
2017-10-16 15:18 ` [PATCH v2 05/15] ocfs2/cluster: make config_item_type const Bhumika Goyal
2017-10-16 15:18 ` [PATCH v2 06/15] PCI: endpoint: " Bhumika Goyal
2017-10-16 18:24 ` Bjorn Helgaas
2017-10-16 15:18 ` [PATCH v2 07/15] usb: gadget: configfs: " Bhumika Goyal
[not found] ` <1508167134-6243-8-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-17 8:31 ` Felipe Balbi
2017-10-16 15:18 ` [PATCH v2 08/15] nvmet: " Bhumika Goyal
2017-10-17 10:18 ` Sagi Grimberg
2017-10-16 15:18 ` [PATCH v2 09/15] ACPI: configfs: " Bhumika Goyal
2017-10-17 0:10 ` Rafael J. Wysocki
2017-10-16 15:18 ` [PATCH v2 10/15] nullb: " Bhumika Goyal
2017-10-16 15:18 ` [PATCH v2 11/15] stm class: " Bhumika Goyal
2017-10-17 10:25 ` Greg KH
2017-10-16 15:18 ` [PATCH v2 12/15] RDMA/cma: " Bhumika Goyal
[not found] ` <1508167134-6243-13-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-17 10:56 ` Leon Romanovsky
2017-10-18 14:33 ` Doug Ledford
2017-10-16 15:18 ` [PATCH v2 13/15] netconsole: " Bhumika Goyal
2017-10-16 15:18 ` [PATCH v2 14/15] dlm: " Bhumika Goyal
2017-10-16 15:18 ` [PATCH v2 15/15] configfs: " Bhumika Goyal
2017-10-17 10:12 ` [PATCH v2 00/15] make structure field, function arguments and structures const Greg KH
2017-10-17 10:16 ` Julia Lawall
2017-10-17 10:23 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1508167134-6243-2-git-send-email-bhumirks@gmail.com \
--to=bhumirks@gmail.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=balbi@kernel.org \
--cc=bhelgaas@google.com \
--cc=ccaulfie@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=dledford@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hal.rosenstock@gmail.com \
--cc=hch@lst.de \
--cc=jic23@kernel.org \
--cc=jlbec@evilplan.org \
--cc=julia.lawall@lip6.fr \
--cc=kishon@ti.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mfasheh@versity.com \
--cc=nab@linux-iscsi.org \
--cc=netdev@vger.kernel.org \
--cc=ocfs2-devel@oss.oracle.com \
--cc=pmeerw@pmeerw.net \
--cc=rjw@rjwysocki.net \
--cc=sagi@grimberg.me \
--cc=sean.hefty@intel.com \
--cc=target-devel@vger.kernel.org \
--cc=teigland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).