Commit a613fa168afc19179a7547fbba45644c5b6912bf

Authored by Trond Myklebust
1 parent 080b794ce5

SUNRPC: constify the rpc_program

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

Showing 17 changed files with 54 additions and 54 deletions Side-by-side Diff

... ... @@ -598,7 +598,7 @@
598 598 PROC(GRANTED_RES, res, norep),
599 599 };
600 600  
601   -struct rpc_version nlm_version4 = {
  601 +const struct rpc_version nlm_version4 = {
602 602 .number = 4,
603 603 .nrprocs = ARRAY_SIZE(nlm4_procedures),
604 604 .procs = nlm4_procedures,
... ... @@ -596,19 +596,19 @@
596 596 PROC(GRANTED_RES, res, norep),
597 597 };
598 598  
599   -static struct rpc_version nlm_version1 = {
  599 +static const struct rpc_version nlm_version1 = {
600 600 .number = 1,
601 601 .nrprocs = ARRAY_SIZE(nlm_procedures),
602 602 .procs = nlm_procedures,
603 603 };
604 604  
605   -static struct rpc_version nlm_version3 = {
  605 +static const struct rpc_version nlm_version3 = {
606 606 .number = 3,
607 607 .nrprocs = ARRAY_SIZE(nlm_procedures),
608 608 .procs = nlm_procedures,
609 609 };
610 610  
611   -static struct rpc_version *nlm_versions[] = {
  611 +static const struct rpc_version *nlm_versions[] = {
612 612 [1] = &nlm_version1,
613 613 [3] = &nlm_version3,
614 614 #ifdef CONFIG_LOCKD_V4
... ... @@ -618,7 +618,7 @@
618 618  
619 619 static struct rpc_stat nlm_rpc_stats;
620 620  
621   -struct rpc_program nlm_program = {
  621 +const struct rpc_program nlm_program = {
622 622 .name = "lockd",
623 623 .number = NLM_PROGRAM,
624 624 .nrvers = ARRAY_SIZE(nlm_versions),
... ... @@ -47,7 +47,7 @@
47 47 u32 state;
48 48 };
49 49  
50   -static struct rpc_program nsm_program;
  50 +static const struct rpc_program nsm_program;
51 51 static LIST_HEAD(nsm_handles);
52 52 static DEFINE_SPINLOCK(nsm_lock);
53 53  
54 54  
55 55  
... ... @@ -534,19 +534,19 @@
534 534 },
535 535 };
536 536  
537   -static struct rpc_version nsm_version1 = {
  537 +static const struct rpc_version nsm_version1 = {
538 538 .number = 1,
539 539 .nrprocs = ARRAY_SIZE(nsm_procedures),
540 540 .procs = nsm_procedures
541 541 };
542 542  
543   -static struct rpc_version * nsm_version[] = {
  543 +static const struct rpc_version *nsm_version[] = {
544 544 [1] = &nsm_version1,
545 545 };
546 546  
547 547 static struct rpc_stat nsm_stats;
548 548  
549   -static struct rpc_program nsm_program = {
  549 +static const struct rpc_program nsm_program = {
550 550 .name = "statd",
551 551 .number = NSM_PROGRAM,
552 552 .nrvers = ARRAY_SIZE(nsm_version),
... ... @@ -89,7 +89,7 @@
89 89 /*
90 90 * RPC cruft for NFS
91 91 */
92   -static struct rpc_version *nfs_version[5] = {
  92 +static const struct rpc_version *nfs_version[5] = {
93 93 [2] = &nfs_version2,
94 94 #ifdef CONFIG_NFS_V3
95 95 [3] = &nfs_version3,
... ... @@ -99,7 +99,7 @@
99 99 #endif
100 100 };
101 101  
102   -struct rpc_program nfs_program = {
  102 +const struct rpc_program nfs_program = {
103 103 .name = "nfs",
104 104 .number = NFS_PROGRAM,
105 105 .nrvers = ARRAY_SIZE(nfs_version),
106 106  
... ... @@ -115,11 +115,11 @@
115 115  
116 116 #ifdef CONFIG_NFS_V3_ACL
117 117 static struct rpc_stat nfsacl_rpcstat = { &nfsacl_program };
118   -static struct rpc_version * nfsacl_version[] = {
  118 +static const struct rpc_version *nfsacl_version[] = {
119 119 [3] = &nfsacl_version3,
120 120 };
121 121  
122   -struct rpc_program nfsacl_program = {
  122 +const struct rpc_program nfsacl_program = {
123 123 .name = "nfsacl",
124 124 .number = NFS_ACL_PROGRAM,
125 125 .nrvers = ARRAY_SIZE(nfsacl_version),
... ... @@ -145,7 +145,7 @@
145 145 extern void nfs_umount(const struct nfs_mount_request *info);
146 146  
147 147 /* client.c */
148   -extern struct rpc_program nfs_program;
  148 +extern const struct rpc_program nfs_program;
149 149  
150 150 extern void nfs_cleanup_cb_ident_idr(void);
151 151 extern void nfs_put_client(struct nfs_client *);
... ... @@ -67,7 +67,7 @@
67 67 MOUNTPROC3_EXPORT = 5,
68 68 };
69 69  
70   -static struct rpc_program mnt_program;
  70 +static const struct rpc_program mnt_program;
71 71  
72 72 /*
73 73 * Defined by OpenGroup XNFS Version 3W, chapter 8
74 74  
75 75  
... ... @@ -488,19 +488,19 @@
488 488 };
489 489  
490 490  
491   -static struct rpc_version mnt_version1 = {
  491 +static const struct rpc_version mnt_version1 = {
492 492 .number = 1,
493 493 .nrprocs = ARRAY_SIZE(mnt_procedures),
494 494 .procs = mnt_procedures,
495 495 };
496 496  
497   -static struct rpc_version mnt_version3 = {
  497 +static const struct rpc_version mnt_version3 = {
498 498 .number = 3,
499 499 .nrprocs = ARRAY_SIZE(mnt3_procedures),
500 500 .procs = mnt3_procedures,
501 501 };
502 502  
503   -static struct rpc_version *mnt_version[] = {
  503 +static const struct rpc_version *mnt_version[] = {
504 504 NULL,
505 505 &mnt_version1,
506 506 NULL,
... ... @@ -509,7 +509,7 @@
509 509  
510 510 static struct rpc_stat mnt_stats;
511 511  
512   -static struct rpc_program mnt_program = {
  512 +static const struct rpc_program mnt_program = {
513 513 .name = "mount",
514 514 .number = NFS_MNT_PROGRAM,
515 515 .nrvers = ARRAY_SIZE(mnt_version),
... ... @@ -1150,7 +1150,7 @@
1150 1150 PROC(STATFS, fhandle, statfsres, 0),
1151 1151 };
1152 1152  
1153   -struct rpc_version nfs_version2 = {
  1153 +const struct rpc_version nfs_version2 = {
1154 1154 .number = 2,
1155 1155 .nrprocs = ARRAY_SIZE(nfs_procedures),
1156 1156 .procs = nfs_procedures
... ... @@ -2461,7 +2461,7 @@
2461 2461 PROC(COMMIT, commit, commit, 5),
2462 2462 };
2463 2463  
2464   -struct rpc_version nfs_version3 = {
  2464 +const struct rpc_version nfs_version3 = {
2465 2465 .number = 3,
2466 2466 .nrprocs = ARRAY_SIZE(nfs3_procedures),
2467 2467 .procs = nfs3_procedures
... ... @@ -2489,7 +2489,7 @@
2489 2489 },
2490 2490 };
2491 2491  
2492   -struct rpc_version nfsacl_version3 = {
  2492 +const struct rpc_version nfsacl_version3 = {
2493 2493 .number = 3,
2494 2494 .nrprocs = sizeof(nfs3_acl_procedures)/
2495 2495 sizeof(nfs3_acl_procedures[0]),
... ... @@ -7109,7 +7109,7 @@
7109 7109 #endif /* CONFIG_NFS_V4_1 */
7110 7110 };
7111 7111  
7112   -struct rpc_version nfs_version4 = {
  7112 +const struct rpc_version nfs_version4 = {
7113 7113 .number = 4,
7114 7114 .nrprocs = ARRAY_SIZE(nfs4_procedures),
7115 7115 .procs = nfs4_procedures
fs/nfsd/nfs4callback.c
... ... @@ -605,18 +605,18 @@
605 605 .procs = nfs4_cb_procedures
606 606 };
607 607  
608   -static struct rpc_version *nfs_cb_version[] = {
  608 +static const struct rpc_version *nfs_cb_version[] = {
609 609 &nfs_cb_version4,
610 610 };
611 611  
612   -static struct rpc_program cb_program;
  612 +static const struct rpc_program cb_program;
613 613  
614 614 static struct rpc_stat cb_stats = {
615 615 .program = &cb_program
616 616 };
617 617  
618 618 #define NFS4_CALLBACK 0x40000000
619   -static struct rpc_program cb_program = {
  619 +static const struct rpc_program cb_program = {
620 620 .name = "nfs4_cb",
621 621 .number = NFS4_CALLBACK,
622 622 .nrvers = ARRAY_SIZE(nfs_cb_version),
include/linux/lockd/lockd.h
... ... @@ -188,7 +188,7 @@
188 188 /*
189 189 * Global variables
190 190 */
191   -extern struct rpc_program nlm_program;
  191 +extern const struct rpc_program nlm_program;
192 192 extern struct svc_procedure nlmsvc_procedures[];
193 193 #ifdef CONFIG_LOCKD_V4
194 194 extern struct svc_procedure nlmsvc_procedures4[];
include/linux/lockd/xdr4.h
... ... @@ -42,7 +42,7 @@
42 42 int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *);
43 43 int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
44 44 */
45   -extern struct rpc_version nlm_version4;
  45 +extern const struct rpc_version nlm_version4;
46 46  
47 47 #endif /* LOCKD_XDR4_H */
include/linux/nfs_xdr.h
... ... @@ -1274,12 +1274,12 @@
1274 1274 extern const struct nfs_rpc_ops nfs_v2_clientops;
1275 1275 extern const struct nfs_rpc_ops nfs_v3_clientops;
1276 1276 extern const struct nfs_rpc_ops nfs_v4_clientops;
1277   -extern struct rpc_version nfs_version2;
1278   -extern struct rpc_version nfs_version3;
1279   -extern struct rpc_version nfs_version4;
  1277 +extern const struct rpc_version nfs_version2;
  1278 +extern const struct rpc_version nfs_version3;
  1279 +extern const struct rpc_version nfs_version4;
1280 1280  
1281   -extern struct rpc_version nfsacl_version3;
1282   -extern struct rpc_program nfsacl_program;
  1281 +extern const struct rpc_version nfsacl_version3;
  1282 +extern const struct rpc_program nfsacl_program;
1283 1283  
1284 1284 #endif
include/linux/sunrpc/clnt.h
... ... @@ -61,7 +61,7 @@
61 61 struct rpc_clnt * cl_parent; /* Points to parent of clones */
62 62 struct rpc_rtt cl_rtt_default;
63 63 struct rpc_timeout cl_timeout_default;
64   - struct rpc_program * cl_program;
  64 + const struct rpc_program *cl_program;
65 65 char *cl_principal; /* target to authenticate to */
66 66 };
67 67  
... ... @@ -73,7 +73,7 @@
73 73 const char * name; /* protocol name */
74 74 u32 number; /* program number */
75 75 unsigned int nrvers; /* number of versions */
76   - struct rpc_version ** version; /* version array */
  76 + const struct rpc_version ** version; /* version array */
77 77 struct rpc_stat * stats; /* statistics */
78 78 const char * pipe_dir_name; /* path to rpc_pipefs dir */
79 79 };
... ... @@ -109,7 +109,7 @@
109 109 struct sockaddr *saddress;
110 110 const struct rpc_timeout *timeout;
111 111 const char *servername;
112   - struct rpc_program *program;
  112 + const struct rpc_program *program;
113 113 u32 prognumber; /* overrides program->number */
114 114 u32 version;
115 115 rpc_authflavor_t authflavor;
... ... @@ -128,7 +128,7 @@
128 128  
129 129 struct rpc_clnt *rpc_create(struct rpc_create_args *args);
130 130 struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
131   - struct rpc_program *, u32);
  131 + const struct rpc_program *, u32);
132 132 void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
133 133 struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
134 134 void rpc_shutdown_client(struct rpc_clnt *);
include/linux/sunrpc/stats.h
... ... @@ -12,7 +12,7 @@
12 12 #include <linux/proc_fs.h>
13 13  
14 14 struct rpc_stat {
15   - struct rpc_program * program;
  15 + const struct rpc_program *program;
16 16  
17 17 unsigned int netcnt,
18 18 netudpcnt,
... ... @@ -60,7 +60,7 @@
60 60 #ifdef CONFIG_PROC_FS
61 61 struct proc_dir_entry * rpc_proc_register(struct net *,struct rpc_stat *);
62 62 void rpc_proc_unregister(struct net *,const char *);
63   -void rpc_proc_zero(struct rpc_program *);
  63 +void rpc_proc_zero(const struct rpc_program *);
64 64 struct proc_dir_entry * svc_proc_register(struct net *, struct svc_stat *,
65 65 const struct file_operations *);
66 66 void svc_proc_unregister(struct net *, const char *);
... ... @@ -71,7 +71,7 @@
71 71  
72 72 static inline struct proc_dir_entry *rpc_proc_register(struct net *net, struct rpc_stat *s) { return NULL; }
73 73 static inline void rpc_proc_unregister(struct net *net, const char *p) {}
74   -static inline void rpc_proc_zero(struct rpc_program *p) {}
  74 +static inline void rpc_proc_zero(const struct rpc_program *p) {}
75 75  
76 76 static inline struct proc_dir_entry *svc_proc_register(struct net *net, struct svc_stat *s,
77 77 const struct file_operations *f) { return NULL; }
... ... @@ -238,8 +238,8 @@
238 238  
239 239 static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt)
240 240 {
241   - struct rpc_program *program = args->program;
242   - struct rpc_version *version;
  241 + const struct rpc_program *program = args->program;
  242 + const struct rpc_version *version;
243 243 struct rpc_clnt *clnt = NULL;
244 244 struct rpc_auth *auth;
245 245 int err;
246 246  
... ... @@ -626,11 +626,11 @@
626 626 * The Sun NFSv2/v3 ACL protocol can do this.
627 627 */
628 628 struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old,
629   - struct rpc_program *program,
  629 + const struct rpc_program *program,
630 630 u32 vers)
631 631 {
632 632 struct rpc_clnt *clnt;
633   - struct rpc_version *version;
  633 + const struct rpc_version *version;
634 634 int err;
635 635  
636 636 BUG_ON(vers >= program->nrvers || !program->version[vers]);
net/sunrpc/rpcb_clnt.c
... ... @@ -112,7 +112,7 @@
112 112  
113 113 static void rpcb_getport_done(struct rpc_task *, void *);
114 114 static void rpcb_map_release(void *data);
115   -static struct rpc_program rpcb_program;
  115 +static const struct rpc_program rpcb_program;
116 116  
117 117 struct rpcbind_args {
118 118 struct rpc_xprt * r_xprt;
... ... @@ -137,8 +137,8 @@
137 137 struct rpc_procinfo * rpc_proc;
138 138 };
139 139  
140   -static struct rpcb_info rpcb_next_version[];
141   -static struct rpcb_info rpcb_next_version6[];
  140 +static const struct rpcb_info rpcb_next_version[];
  141 +static const struct rpcb_info rpcb_next_version6[];
142 142  
143 143 static const struct rpc_call_ops rpcb_getport_ops = {
144 144 .rpc_call_done = rpcb_getport_done,
... ... @@ -1051,7 +1051,7 @@
1051 1051 },
1052 1052 };
1053 1053  
1054   -static struct rpcb_info rpcb_next_version[] = {
  1054 +static const struct rpcb_info rpcb_next_version[] = {
1055 1055 {
1056 1056 .rpc_vers = RPCBVERS_2,
1057 1057 .rpc_proc = &rpcb_procedures2[RPCBPROC_GETPORT],
... ... @@ -1061,7 +1061,7 @@
1061 1061 },
1062 1062 };
1063 1063  
1064   -static struct rpcb_info rpcb_next_version6[] = {
  1064 +static const struct rpcb_info rpcb_next_version6[] = {
1065 1065 {
1066 1066 .rpc_vers = RPCBVERS_4,
1067 1067 .rpc_proc = &rpcb_procedures4[RPCBPROC_GETADDR],
1068 1068  
1069 1069  
1070 1070  
... ... @@ -1075,25 +1075,25 @@
1075 1075 },
1076 1076 };
1077 1077  
1078   -static struct rpc_version rpcb_version2 = {
  1078 +static const struct rpc_version rpcb_version2 = {
1079 1079 .number = RPCBVERS_2,
1080 1080 .nrprocs = ARRAY_SIZE(rpcb_procedures2),
1081 1081 .procs = rpcb_procedures2
1082 1082 };
1083 1083  
1084   -static struct rpc_version rpcb_version3 = {
  1084 +static const struct rpc_version rpcb_version3 = {
1085 1085 .number = RPCBVERS_3,
1086 1086 .nrprocs = ARRAY_SIZE(rpcb_procedures3),
1087 1087 .procs = rpcb_procedures3
1088 1088 };
1089 1089  
1090   -static struct rpc_version rpcb_version4 = {
  1090 +static const struct rpc_version rpcb_version4 = {
1091 1091 .number = RPCBVERS_4,
1092 1092 .nrprocs = ARRAY_SIZE(rpcb_procedures4),
1093 1093 .procs = rpcb_procedures4
1094 1094 };
1095 1095  
1096   -static struct rpc_version *rpcb_version[] = {
  1096 +static const struct rpc_version *rpcb_version[] = {
1097 1097 NULL,
1098 1098 NULL,
1099 1099 &rpcb_version2,
... ... @@ -1103,7 +1103,7 @@
1103 1103  
1104 1104 static struct rpc_stat rpcb_stats;
1105 1105  
1106   -static struct rpc_program rpcb_program = {
  1106 +static const struct rpc_program rpcb_program = {
1107 1107 .name = "rpcbind",
1108 1108 .number = RPCBIND_PROGRAM,
1109 1109 .nrvers = ARRAY_SIZE(rpcb_version),