Commit f1c0a8615090359d57e096157feb9f900cbb233c

Authored by Trond Myklebust
1 parent de7a8ce38a

SUNRPC: Mark auth and cred operation tables as constant.

Also do the same for gss_api operation tables.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 8 changed files with 22 additions and 25 deletions Side-by-side Diff

include/linux/sunrpc/auth.h
... ... @@ -35,7 +35,7 @@
35 35 struct rpc_cred {
36 36 struct hlist_node cr_hash; /* hash chain */
37 37 struct rpc_auth * cr_auth;
38   - struct rpc_credops * cr_ops;
  38 + const struct rpc_credops *cr_ops;
39 39 unsigned long cr_expire; /* when to gc */
40 40 atomic_t cr_count; /* ref count */
41 41 unsigned short cr_flags; /* various flags */
... ... @@ -73,7 +73,7 @@
73 73 unsigned int au_verfsize;
74 74  
75 75 unsigned int au_flags; /* various flags */
76   - struct rpc_authops * au_ops; /* operations */
  76 + const struct rpc_authops *au_ops; /* operations */
77 77 rpc_authflavor_t au_flavor; /* pseudoflavor (note may
78 78 * differ from the flavor in
79 79 * au_ops->au_flavor in gss
80 80  
... ... @@ -119,14 +119,11 @@
119 119 void *, __be32 *, void *);
120 120 };
121 121  
122   -extern struct rpc_authops authunix_ops;
123   -extern struct rpc_authops authnull_ops;
124   -#ifdef CONFIG_SUNRPC_SECURE
125   -extern struct rpc_authops authdes_ops;
126   -#endif
  122 +extern const struct rpc_authops authunix_ops;
  123 +extern const struct rpc_authops authnull_ops;
127 124  
128   -int rpcauth_register(struct rpc_authops *);
129   -int rpcauth_unregister(struct rpc_authops *);
  125 +int rpcauth_register(const struct rpc_authops *);
  126 +int rpcauth_unregister(const struct rpc_authops *);
130 127 struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *);
131 128 void rpcauth_release(struct rpc_auth *);
132 129 struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int);
include/linux/sunrpc/gss_api.h
... ... @@ -77,7 +77,7 @@
77 77 struct module *gm_owner;
78 78 struct xdr_netobj gm_oid;
79 79 char *gm_name;
80   - struct gss_api_ops *gm_ops;
  80 + const struct gss_api_ops *gm_ops;
81 81 /* pseudoflavors supported by this mechanism: */
82 82 int gm_pf_num;
83 83 struct pf_desc * gm_pfs;
... ... @@ -19,7 +19,7 @@
19 19 #endif
20 20  
21 21 static DEFINE_SPINLOCK(rpc_authflavor_lock);
22   -static struct rpc_authops * auth_flavors[RPC_AUTH_MAXFLAVOR] = {
  22 +static const struct rpc_authops *auth_flavors[RPC_AUTH_MAXFLAVOR] = {
23 23 &authnull_ops, /* AUTH_NULL */
24 24 &authunix_ops, /* AUTH_UNIX */
25 25 NULL, /* others can be loadable modules */
... ... @@ -33,7 +33,7 @@
33 33 }
34 34  
35 35 int
36   -rpcauth_register(struct rpc_authops *ops)
  36 +rpcauth_register(const struct rpc_authops *ops)
37 37 {
38 38 rpc_authflavor_t flavor;
39 39 int ret = -EPERM;
... ... @@ -50,7 +50,7 @@
50 50 }
51 51  
52 52 int
53   -rpcauth_unregister(struct rpc_authops *ops)
  53 +rpcauth_unregister(const struct rpc_authops *ops)
54 54 {
55 55 rpc_authflavor_t flavor;
56 56 int ret = -EPERM;
... ... @@ -70,7 +70,7 @@
70 70 rpcauth_create(rpc_authflavor_t pseudoflavor, struct rpc_clnt *clnt)
71 71 {
72 72 struct rpc_auth *auth;
73   - struct rpc_authops *ops;
  73 + const struct rpc_authops *ops;
74 74 u32 flavor = pseudoflavor_to_flavor(pseudoflavor);
75 75  
76 76 auth = ERR_PTR(-EINVAL);
net/sunrpc/auth_gss/auth_gss.c
... ... @@ -54,9 +54,9 @@
54 54 #include <linux/sunrpc/gss_api.h>
55 55 #include <asm/uaccess.h>
56 56  
57   -static struct rpc_authops authgss_ops;
  57 +static const struct rpc_authops authgss_ops;
58 58  
59   -static struct rpc_credops gss_credops;
  59 +static const struct rpc_credops gss_credops;
60 60  
61 61 #ifdef RPC_DEBUG
62 62 # define RPCDBG_FACILITY RPCDBG_AUTH
... ... @@ -1193,7 +1193,7 @@
1193 1193 return status;
1194 1194 }
1195 1195  
1196   -static struct rpc_authops authgss_ops = {
  1196 +static const struct rpc_authops authgss_ops = {
1197 1197 .owner = THIS_MODULE,
1198 1198 .au_flavor = RPC_AUTH_GSS,
1199 1199 #ifdef RPC_DEBUG
... ... @@ -1205,7 +1205,7 @@
1205 1205 .crcreate = gss_create_cred
1206 1206 };
1207 1207  
1208   -static struct rpc_credops gss_credops = {
  1208 +static const struct rpc_credops gss_credops = {
1209 1209 .cr_name = "AUTH_GSS",
1210 1210 .crdestroy = gss_destroy_cred,
1211 1211 .cr_init = gss_cred_init,
net/sunrpc/auth_gss/gss_krb5_mech.c
... ... @@ -201,7 +201,7 @@
201 201 kfree(kctx);
202 202 }
203 203  
204   -static struct gss_api_ops gss_kerberos_ops = {
  204 +static const struct gss_api_ops gss_kerberos_ops = {
205 205 .gss_import_sec_context = gss_import_sec_context_kerberos,
206 206 .gss_get_mic = gss_get_mic_kerberos,
207 207 .gss_verify_mic = gss_verify_mic_kerberos,
net/sunrpc/auth_gss/gss_spkm3_mech.c
... ... @@ -202,7 +202,7 @@
202 202 return err;
203 203 }
204 204  
205   -static struct gss_api_ops gss_spkm3_ops = {
  205 +static const struct gss_api_ops gss_spkm3_ops = {
206 206 .gss_import_sec_context = gss_import_sec_context_spkm3,
207 207 .gss_get_mic = gss_get_mic_spkm3,
208 208 .gss_verify_mic = gss_verify_mic_spkm3,
net/sunrpc/auth_null.c
... ... @@ -101,7 +101,7 @@
101 101 return p;
102 102 }
103 103  
104   -struct rpc_authops authnull_ops = {
  104 +const struct rpc_authops authnull_ops = {
105 105 .owner = THIS_MODULE,
106 106 .au_flavor = RPC_AUTH_NULL,
107 107 #ifdef RPC_DEBUG
... ... @@ -122,7 +122,7 @@
122 122 };
123 123  
124 124 static
125   -struct rpc_credops null_credops = {
  125 +const struct rpc_credops null_credops = {
126 126 .cr_name = "AUTH_NULL",
127 127 .crdestroy = nul_destroy_cred,
128 128 .crmatch = nul_match,
net/sunrpc/auth_unix.c
... ... @@ -34,7 +34,7 @@
34 34  
35 35 static struct rpc_auth unix_auth;
36 36 static struct rpc_cred_cache unix_cred_cache;
37   -static struct rpc_credops unix_credops;
  37 +static const struct rpc_credops unix_credops;
38 38  
39 39 static struct rpc_auth *
40 40 unx_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
... ... @@ -205,7 +205,7 @@
205 205 return p;
206 206 }
207 207  
208   -struct rpc_authops authunix_ops = {
  208 +const struct rpc_authops authunix_ops = {
209 209 .owner = THIS_MODULE,
210 210 .au_flavor = RPC_AUTH_UNIX,
211 211 #ifdef RPC_DEBUG
... ... @@ -233,7 +233,7 @@
233 233 };
234 234  
235 235 static
236   -struct rpc_credops unix_credops = {
  236 +const struct rpc_credops unix_credops = {
237 237 .cr_name = "AUTH_UNIX",
238 238 .crdestroy = unx_destroy_cred,
239 239 .crmatch = unx_match,