2017-10-17 16:14:32

by Bhumika Goyal

[permalink] [raw]
Subject: [PATCH 0/4] make function arg and structures as const

Make the function argument as const. After thing change, make
the cache_detail structures as const.

Bhumika Goyal (4):
sunrpc: make the function arg as const
NFS: make cache_detail structures const
NFSD: make cache_detail structures const
SUNRPC: make cache_detail structures const

fs/nfs/dns_resolve.c | 2 +-
fs/nfsd/export.c | 4 ++--
fs/nfsd/nfs4idmap.c | 4 ++--
include/linux/sunrpc/cache.h | 2 +-
net/sunrpc/auth_gss/svcauth_gss.c | 4 ++--
net/sunrpc/cache.c | 2 +-
net/sunrpc/svcauth_unix.c | 4 ++--
7 files changed, 11 insertions(+), 11 deletions(-)

--
1.9.1



2017-10-17 16:14:41

by Bhumika Goyal

[permalink] [raw]
Subject: [PATCH 4/4] SUNRPC: make cache_detail structures const

Make these const as they are only getting passed to the function
cache_create_net having the argument as const.

Signed-off-by: Bhumika Goyal <[email protected]>
---
net/sunrpc/auth_gss/svcauth_gss.c | 4 ++--
net/sunrpc/svcauth_unix.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 7b1ee5a..e242cb4 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -264,7 +264,7 @@ static int rsi_parse(struct cache_detail *cd,
return status;
}

-static struct cache_detail rsi_cache_template = {
+static const struct cache_detail rsi_cache_template = {
.owner = THIS_MODULE,
.hash_size = RSI_HASHMAX,
.name = "auth.rpcsec.init",
@@ -524,7 +524,7 @@ static int rsc_parse(struct cache_detail *cd,
return status;
}

-static struct cache_detail rsc_cache_template = {
+static const struct cache_detail rsc_cache_template = {
.owner = THIS_MODULE,
.hash_size = RSC_HASHMAX,
.name = "auth.rpcsec.context",
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index f81eaa8..740b67d 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -569,7 +569,7 @@ static int unix_gid_show(struct seq_file *m,
return 0;
}

-static struct cache_detail unix_gid_cache_template = {
+static const struct cache_detail unix_gid_cache_template = {
.owner = THIS_MODULE,
.hash_size = GID_HASHMAX,
.name = "auth.unix.gid",
@@ -862,7 +862,7 @@ struct auth_ops svcauth_unix = {
.set_client = svcauth_unix_set_client,
};

-static struct cache_detail ip_map_cache_template = {
+static const struct cache_detail ip_map_cache_template = {
.owner = THIS_MODULE,
.hash_size = IP_HASHMAX,
.name = "auth.unix.ip",
--
1.9.1


2017-10-17 16:14:39

by Bhumika Goyal

[permalink] [raw]
Subject: [PATCH 3/4] NFSD: make cache_detail structures const

Make these const as they are only getting passed to the function
cache_create_net having the argument as const.

Signed-off-by: Bhumika Goyal <[email protected]>
---
fs/nfsd/export.c | 4 ++--
fs/nfsd/nfs4idmap.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 3bc08c3..06bb39c 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -231,7 +231,7 @@ static struct cache_head *expkey_alloc(void)
return NULL;
}

-static struct cache_detail svc_expkey_cache_template = {
+static const struct cache_detail svc_expkey_cache_template = {
.owner = THIS_MODULE,
.hash_size = EXPKEY_HASHMAX,
.name = "nfsd.fh",
@@ -747,7 +747,7 @@ static struct cache_head *svc_export_alloc(void)
return NULL;
}

-static struct cache_detail svc_export_cache_template = {
+static const struct cache_detail svc_export_cache_template = {
.owner = THIS_MODULE,
.hash_size = EXPORT_HASHMAX,
.name = "nfsd.export",
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 6b9b6cc..a5bb765 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -178,7 +178,7 @@ struct ent {
static struct ent *idtoname_update(struct cache_detail *, struct ent *,
struct ent *);

-static struct cache_detail idtoname_cache_template = {
+static const struct cache_detail idtoname_cache_template = {
.owner = THIS_MODULE,
.hash_size = ENT_HASHMAX,
.name = "nfs4.idtoname",
@@ -341,7 +341,7 @@ static struct ent *nametoid_update(struct cache_detail *, struct ent *,
struct ent *);
static int nametoid_parse(struct cache_detail *, char *, int);

-static struct cache_detail nametoid_cache_template = {
+static const struct cache_detail nametoid_cache_template = {
.owner = THIS_MODULE,
.hash_size = ENT_HASHMAX,
.name = "nfs4.nametoid",
--
1.9.1


2017-10-17 16:14:37

by Bhumika Goyal

[permalink] [raw]
Subject: [PATCH 2/4] NFS: make cache_detail structure const

Make it const as it is only getting passed to the function
cache_create_net having the argument as const.

Signed-off-by: Bhumika Goyal <[email protected]>
---
fs/nfs/dns_resolve.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c
index d25f10f..477934a 100644
--- a/fs/nfs/dns_resolve.c
+++ b/fs/nfs/dns_resolve.c
@@ -353,7 +353,7 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name,
return ret;
}

-static struct cache_detail nfs_dns_resolve_template = {
+static const struct cache_detail nfs_dns_resolve_template = {
.owner = THIS_MODULE,
.hash_size = NFS_DNS_HASHTBL_SIZE,
.name = "dns_resolve",
--
1.9.1


2017-10-17 16:14:34

by Bhumika Goyal

[permalink] [raw]
Subject: [PATCH 1/4] sunrpc: make the function arg as const

Make the struct cache_detail *tmpl argument of the function
cache_create_net as const as it is only getting passed to kmemup having
the argument as const void *.
Add const to the prototype too.

Signed-off-by: Bhumika Goyal <[email protected]>
---
include/linux/sunrpc/cache.h | 2 +-
net/sunrpc/cache.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 270bad0..40d2822 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -213,7 +213,7 @@ extern int cache_check(struct cache_detail *detail,
extern int cache_register_net(struct cache_detail *cd, struct net *net);
extern void cache_unregister_net(struct cache_detail *cd, struct net *net);

-extern struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net);
+extern struct cache_detail *cache_create_net(const struct cache_detail *tmpl, struct net *net);
extern void cache_destroy_net(struct cache_detail *cd, struct net *net);

extern void sunrpc_init_cache_detail(struct cache_detail *cd);
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 79d55d9..e689438 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1674,7 +1674,7 @@ void cache_unregister_net(struct cache_detail *cd, struct net *net)
}
EXPORT_SYMBOL_GPL(cache_unregister_net);

-struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net)
+struct cache_detail *cache_create_net(const struct cache_detail *tmpl, struct net *net)
{
struct cache_detail *cd;
int i;
--
1.9.1


2017-10-17 16:40:29

by Jeff Layton

[permalink] [raw]
Subject: Re: [PATCH 0/4] make function arg and structures as const

On Tue, 2017-10-17 at 18:14 +0200, Bhumika Goyal wrote:
> Make the function argument as const. After thing change, make
> the cache_detail structures as const.
>
> Bhumika Goyal (4):
> sunrpc: make the function arg as const
> NFS: make cache_detail structures const
> NFSD: make cache_detail structures const
> SUNRPC: make cache_detail structures const
>
> fs/nfs/dns_resolve.c | 2 +-
> fs/nfsd/export.c | 4 ++--
> fs/nfsd/nfs4idmap.c | 4 ++--
> include/linux/sunrpc/cache.h | 2 +-
> net/sunrpc/auth_gss/svcauth_gss.c | 4 ++--
> net/sunrpc/cache.c | 2 +-
> net/sunrpc/svcauth_unix.c | 4 ++--
> 7 files changed, 11 insertions(+), 11 deletions(-)
>

Looks pretty straightforward. You can add this to the set:

Reviewed-by: Jeff Layton <[email protected]>

2017-11-10 02:21:26

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 0/4] make function arg and structures as const

On Tue, Oct 17, 2017 at 12:40:27PM -0400, Jeff Layton wrote:
> On Tue, 2017-10-17 at 18:14 +0200, Bhumika Goyal wrote:
> > Make the function argument as const. After thing change, make
> > the cache_detail structures as const.
> >
> > Bhumika Goyal (4):
> > sunrpc: make the function arg as const
> > NFS: make cache_detail structures const
> > NFSD: make cache_detail structures const
> > SUNRPC: make cache_detail structures const
> >
> > fs/nfs/dns_resolve.c | 2 +-
> > fs/nfsd/export.c | 4 ++--
> > fs/nfsd/nfs4idmap.c | 4 ++--
> > include/linux/sunrpc/cache.h | 2 +-
> > net/sunrpc/auth_gss/svcauth_gss.c | 4 ++--
> > net/sunrpc/cache.c | 2 +-
> > net/sunrpc/svcauth_unix.c | 4 ++--
> > 7 files changed, 11 insertions(+), 11 deletions(-)
> >
>
> Looks pretty straightforward. You can add this to the set:
>
> Reviewed-by: Jeff Layton <[email protected]>

Thanks, I've applied 1, 3, and 4 and could take #2 as well if it's OK
with Trond/Anna.

--b.

2017-11-10 15:10:35

by Anna Schumaker

[permalink] [raw]
Subject: Re: [PATCH 0/4] make function arg and structures as const



On 11/09/2017 09:21 PM, J. Bruce Fields wrote:
> On Tue, Oct 17, 2017 at 12:40:27PM -0400, Jeff Layton wrote:
>> On Tue, 2017-10-17 at 18:14 +0200, Bhumika Goyal wrote:
>>> Make the function argument as const. After thing change, make
>>> the cache_detail structures as const.
>>>
>>> Bhumika Goyal (4):
>>> sunrpc: make the function arg as const
>>> NFS: make cache_detail structures const
>>> NFSD: make cache_detail structures const
>>> SUNRPC: make cache_detail structures const
>>>
>>> fs/nfs/dns_resolve.c | 2 +-
>>> fs/nfsd/export.c | 4 ++--
>>> fs/nfsd/nfs4idmap.c | 4 ++--
>>> include/linux/sunrpc/cache.h | 2 +-
>>> net/sunrpc/auth_gss/svcauth_gss.c | 4 ++--
>>> net/sunrpc/cache.c | 2 +-
>>> net/sunrpc/svcauth_unix.c | 4 ++--
>>> 7 files changed, 11 insertions(+), 11 deletions(-)
>>>
>>
>> Looks pretty straightforward. You can add this to the set:
>>
>> Reviewed-by: Jeff Layton <[email protected]>
>
> Thanks, I've applied 1, 3, and 4 and could take #2 as well if it's OK
> with Trond/Anna.

I don't mind taking #2, it's already in my branch :)

Anna

>
> --b.
>

2017-11-10 15:29:10

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 0/4] make function arg and structures as const

On Fri, Nov 10, 2017 at 10:09:46AM -0500, Anna Schumaker wrote:
>
>
> On 11/09/2017 09:21 PM, J. Bruce Fields wrote:
> > On Tue, Oct 17, 2017 at 12:40:27PM -0400, Jeff Layton wrote:
> >> On Tue, 2017-10-17 at 18:14 +0200, Bhumika Goyal wrote:
> >>> Make the function argument as const. After thing change, make
> >>> the cache_detail structures as const.
> >>>
> >>> Bhumika Goyal (4):
> >>> sunrpc: make the function arg as const
> >>> NFS: make cache_detail structures const
> >>> NFSD: make cache_detail structures const
> >>> SUNRPC: make cache_detail structures const
> >>>
> >>> fs/nfs/dns_resolve.c | 2 +-
> >>> fs/nfsd/export.c | 4 ++--
> >>> fs/nfsd/nfs4idmap.c | 4 ++--
> >>> include/linux/sunrpc/cache.h | 2 +-
> >>> net/sunrpc/auth_gss/svcauth_gss.c | 4 ++--
> >>> net/sunrpc/cache.c | 2 +-
> >>> net/sunrpc/svcauth_unix.c | 4 ++--
> >>> 7 files changed, 11 insertions(+), 11 deletions(-)
> >>>
> >>
> >> Looks pretty straightforward. You can add this to the set:
> >>
> >> Reviewed-by: Jeff Layton <[email protected]>
> >
> > Thanks, I've applied 1, 3, and 4 and could take #2 as well if it's OK
> > with Trond/Anna.
>
> I don't mind taking #2, it's already in my branch :)

OK, thanks.--b.