git: 20a8c236d102 - stable/13 - rpc: Make function tables const

Mark Johnston markj at FreeBSD.org
Sat Aug 21 17:59:12 UTC 2021


The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=20a8c236d1025f560c8418be92f72e0105003216

commit 20a8c236d1025f560c8418be92f72e0105003216
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-07-09 14:56:13 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-08-21 16:10:31 +0000

    rpc: Make function tables const
    
    No functional change intended.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 20d728b559178577869e50c7e3c1bf0ad24a750c)
---
 sys/rpc/auth.h                      |  2 +-
 sys/rpc/auth_none.c                 |  2 +-
 sys/rpc/auth_unix.c                 |  2 +-
 sys/rpc/clnt.h                      |  2 +-
 sys/rpc/clnt_bck.c                  |  2 +-
 sys/rpc/clnt_dg.c                   |  2 +-
 sys/rpc/clnt_rc.c                   |  2 +-
 sys/rpc/clnt_vc.c                   |  2 +-
 sys/rpc/rpcsec_gss/rpcsec_gss.c     |  2 +-
 sys/rpc/rpcsec_gss/svc_rpcsec_gss.c |  8 ++++----
 sys/rpc/rpcsec_tls/auth_tls.c       |  2 +-
 sys/rpc/svc.h                       |  2 +-
 sys/rpc/svc_auth.c                  | 10 +++++-----
 sys/rpc/svc_dg.c                    |  2 +-
 sys/rpc/svc_vc.c                    |  6 +++---
 15 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/sys/rpc/auth.h b/sys/rpc/auth.h
index fd56b33da52e..5444f6180c5e 100644
--- a/sys/rpc/auth.h
+++ b/sys/rpc/auth.h
@@ -189,7 +189,7 @@ typedef struct __auth {
 	struct	opaque_auth	ah_cred;
 	struct	opaque_auth	ah_verf;
 	union	des_block	ah_key;
-	struct auth_ops {
+	const struct auth_ops {
 		void	(*ah_nextverf) (struct __auth *);
 		/* nextverf & serialize */
 		int	(*ah_marshal) (struct __auth *, uint32_t, XDR *,
diff --git a/sys/rpc/auth_none.c b/sys/rpc/auth_none.c
index 236b4aa166ae..91597114c069 100644
--- a/sys/rpc/auth_none.c
+++ b/sys/rpc/auth_none.c
@@ -70,7 +70,7 @@ static bool_t authnone_validate (AUTH *, uint32_t, struct opaque_auth *,
 static bool_t authnone_refresh (AUTH *, void *);
 static void authnone_destroy (AUTH *);
 
-static struct auth_ops authnone_ops = {
+static const struct auth_ops authnone_ops = {
 	.ah_nextverf =		authnone_verf,
 	.ah_marshal =		authnone_marshal,
 	.ah_validate =		authnone_validate,
diff --git a/sys/rpc/auth_unix.c b/sys/rpc/auth_unix.c
index 4a3df5f70e3a..be0a241baa36 100644
--- a/sys/rpc/auth_unix.c
+++ b/sys/rpc/auth_unix.c
@@ -76,7 +76,7 @@ static bool_t authunix_refresh (AUTH *, void *);
 static void authunix_destroy (AUTH *);
 static void marshal_new_auth (AUTH *);
 
-static struct auth_ops authunix_ops = {
+static const struct auth_ops authunix_ops = {
 	.ah_nextverf =		authunix_nextverf,
 	.ah_marshal =		authunix_marshal,
 	.ah_validate =		authunix_validate,
diff --git a/sys/rpc/clnt.h b/sys/rpc/clnt.h
index 6f8f898ca918..a968c8f930fc 100644
--- a/sys/rpc/clnt.h
+++ b/sys/rpc/clnt.h
@@ -132,7 +132,7 @@ typedef struct __rpc_client {
 #ifdef _KERNEL
 	volatile u_int cl_refs;			/* reference count */
 	AUTH	*cl_auth;			/* authenticator */
-	struct clnt_ops {
+	const struct clnt_ops {
 		/* call remote procedure */
 		enum clnt_stat	(*cl_call)(struct __rpc_client *,
 		    struct rpc_callextra *, rpcproc_t,
diff --git a/sys/rpc/clnt_bck.c b/sys/rpc/clnt_bck.c
index 2414171bad37..514905bf1cc2 100644
--- a/sys/rpc/clnt_bck.c
+++ b/sys/rpc/clnt_bck.c
@@ -101,7 +101,7 @@ static bool_t clnt_bck_control(CLIENT *, u_int, void *);
 static void clnt_bck_close(CLIENT *);
 static void clnt_bck_destroy(CLIENT *);
 
-static struct clnt_ops clnt_bck_ops = {
+static const struct clnt_ops clnt_bck_ops = {
 	.cl_abort =	clnt_bck_abort,
 	.cl_geterr =	clnt_bck_geterr,
 	.cl_freeres =	clnt_bck_freeres,
diff --git a/sys/rpc/clnt_dg.c b/sys/rpc/clnt_dg.c
index 3a3662a02a39..63a26cc0b9ac 100644
--- a/sys/rpc/clnt_dg.c
+++ b/sys/rpc/clnt_dg.c
@@ -84,7 +84,7 @@ static void clnt_dg_close(CLIENT *);
 static void clnt_dg_destroy(CLIENT *);
 static int clnt_dg_soupcall(struct socket *so, void *arg, int waitflag);
 
-static struct clnt_ops clnt_dg_ops = {
+static const struct clnt_ops clnt_dg_ops = {
 	.cl_call =	clnt_dg_call,
 	.cl_abort =	clnt_dg_abort,
 	.cl_geterr =	clnt_dg_geterr,
diff --git a/sys/rpc/clnt_rc.c b/sys/rpc/clnt_rc.c
index ae3b2985a891..aa69356b8cd2 100644
--- a/sys/rpc/clnt_rc.c
+++ b/sys/rpc/clnt_rc.c
@@ -59,7 +59,7 @@ static bool_t clnt_reconnect_control(CLIENT *, u_int, void *);
 static void clnt_reconnect_close(CLIENT *);
 static void clnt_reconnect_destroy(CLIENT *);
 
-static struct clnt_ops clnt_reconnect_ops = {
+static const struct clnt_ops clnt_reconnect_ops = {
 	.cl_call =	clnt_reconnect_call,
 	.cl_abort =	clnt_reconnect_abort,
 	.cl_geterr =	clnt_reconnect_geterr,
diff --git a/sys/rpc/clnt_vc.c b/sys/rpc/clnt_vc.c
index 92c216e227d1..7d22c670b017 100644
--- a/sys/rpc/clnt_vc.c
+++ b/sys/rpc/clnt_vc.c
@@ -104,7 +104,7 @@ static bool_t time_not_ok(struct timeval *);
 static int clnt_vc_soupcall(struct socket *so, void *arg, int waitflag);
 static void clnt_vc_dotlsupcall(void *data);
 
-static struct clnt_ops clnt_vc_ops = {
+static const struct clnt_ops clnt_vc_ops = {
 	.cl_call =	clnt_vc_call,
 	.cl_abort =	clnt_vc_abort,
 	.cl_geterr =	clnt_vc_geterr,
diff --git a/sys/rpc/rpcsec_gss/rpcsec_gss.c b/sys/rpc/rpcsec_gss/rpcsec_gss.c
index b384a8347ef5..32121be21091 100644
--- a/sys/rpc/rpcsec_gss/rpcsec_gss.c
+++ b/sys/rpc/rpcsec_gss/rpcsec_gss.c
@@ -97,7 +97,7 @@ static bool_t	rpc_gss_validate(AUTH *, uint32_t, struct opaque_auth *,
 static void	rpc_gss_destroy(AUTH *);
 static void	rpc_gss_destroy_context(AUTH *, bool_t);
 
-static struct auth_ops rpc_gss_ops = {
+static const struct auth_ops rpc_gss_ops = {
 	.ah_nextverf =	rpc_gss_nextverf,
 	.ah_marshal =	rpc_gss_marshal,
 	.ah_validate =	rpc_gss_validate,
diff --git a/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c b/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
index 36ab8c5bcf87..c9a09438d907 100644
--- a/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
+++ b/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
@@ -90,10 +90,10 @@ static void     svc_rpc_gss_release(SVCAUTH *);
 static enum auth_stat svc_rpc_gss(struct svc_req *, struct rpc_msg *);
 static int rpc_gss_svc_getcred(struct svc_req *, struct ucred **, int *);
 
-static struct svc_auth_ops svc_auth_gss_ops = {
-	svc_rpc_gss_wrap,
-	svc_rpc_gss_unwrap,
-	svc_rpc_gss_release,
+static const struct svc_auth_ops svc_auth_gss_ops = {
+	.svc_ah_wrap =		svc_rpc_gss_wrap,
+	.svc_ah_unwrap =	svc_rpc_gss_unwrap,
+	.svc_ah_release =	svc_rpc_gss_release,
 };
 
 struct sx svc_rpc_gss_lock;
diff --git a/sys/rpc/rpcsec_tls/auth_tls.c b/sys/rpc/rpcsec_tls/auth_tls.c
index bd23784f5ebf..9afde553283e 100644
--- a/sys/rpc/rpcsec_tls/auth_tls.c
+++ b/sys/rpc/rpcsec_tls/auth_tls.c
@@ -70,7 +70,7 @@ static bool_t authtls_validate (AUTH *, uint32_t, struct opaque_auth *,
 static bool_t authtls_refresh (AUTH *, void *);
 static void authtls_destroy (AUTH *);
 
-static struct auth_ops authtls_ops = {
+static const struct auth_ops authtls_ops = {
 	.ah_nextverf =		authtls_verf,
 	.ah_marshal =		authtls_marshal,
 	.ah_validate =		authtls_validate,
diff --git a/sys/rpc/svc.h b/sys/rpc/svc.h
index 8a94d7058972..d92fa6953891 100644
--- a/sys/rpc/svc.h
+++ b/sys/rpc/svc.h
@@ -212,7 +212,7 @@ typedef struct __rpc_svcxprt {
  * Interface to server-side authentication flavors.
  */
 typedef struct __rpc_svcauth {
-	struct svc_auth_ops {
+	const struct svc_auth_ops {
 #ifdef _KERNEL
 		int   (*svc_ah_wrap)(struct __rpc_svcauth *,  struct mbuf **);
 		int   (*svc_ah_unwrap)(struct __rpc_svcauth *, struct mbuf **);
diff --git a/sys/rpc/svc_auth.c b/sys/rpc/svc_auth.c
index 0c5a68688d48..75d1f21d3484 100644
--- a/sys/rpc/svc_auth.c
+++ b/sys/rpc/svc_auth.c
@@ -60,7 +60,7 @@ static enum auth_stat (*_svcauth_rpcsec_gss)(struct svc_req *,
 static int (*_svcauth_rpcsec_gss_getcred)(struct svc_req *,
     struct ucred **, int *);
 
-static struct svc_auth_ops svc_auth_null_ops;
+static const struct svc_auth_ops svc_auth_null_ops;
 
 /*
  * The call rpc message, msg has been obtained from the wire.  The msg contains
@@ -145,10 +145,10 @@ svcauth_null_release(SVCAUTH *auth)
 
 }
 
-static struct svc_auth_ops svc_auth_null_ops = {
-	svcauth_null_wrap,
-	svcauth_null_unwrap,
-	svcauth_null_release,
+static const struct svc_auth_ops svc_auth_null_ops = {
+	.svc_ah_wrap = svcauth_null_wrap,
+	.svc_ah_unwrap = svcauth_null_unwrap,
+	.svc_ah_release = svcauth_null_release,
 };
 
 /*ARGSUSED*/
diff --git a/sys/rpc/svc_dg.c b/sys/rpc/svc_dg.c
index 2bdd0700c044..db1928655618 100644
--- a/sys/rpc/svc_dg.c
+++ b/sys/rpc/svc_dg.c
@@ -73,7 +73,7 @@ static void svc_dg_destroy(SVCXPRT *);
 static bool_t svc_dg_control(SVCXPRT *, const u_int, void *);
 static int svc_dg_soupcall(struct socket *so, void *arg, int waitflag);
 
-static struct xp_ops svc_dg_ops = {
+static const struct xp_ops svc_dg_ops = {
 	.xp_recv =	svc_dg_recv,
 	.xp_stat =	svc_dg_stat,
 	.xp_reply =	svc_dg_reply,
diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c
index 234feba5c8bd..d81c0b01d84d 100644
--- a/sys/rpc/svc_vc.c
+++ b/sys/rpc/svc_vc.c
@@ -105,7 +105,7 @@ static int svc_vc_accept(struct socket *head, struct socket **sop);
 static int svc_vc_soupcall(struct socket *so, void *arg, int waitflag);
 static int svc_vc_rendezvous_soupcall(struct socket *, void *, int);
 
-static struct xp_ops svc_vc_rendezvous_ops = {
+static const struct xp_ops svc_vc_rendezvous_ops = {
 	.xp_recv =	svc_vc_rendezvous_recv,
 	.xp_stat =	svc_vc_rendezvous_stat,
 	.xp_reply =	(bool_t (*)(SVCXPRT *, struct rpc_msg *,
@@ -114,7 +114,7 @@ static struct xp_ops svc_vc_rendezvous_ops = {
 	.xp_control =	svc_vc_rendezvous_control
 };
 
-static struct xp_ops svc_vc_ops = {
+static const struct xp_ops svc_vc_ops = {
 	.xp_recv =	svc_vc_recv,
 	.xp_stat =	svc_vc_stat,
 	.xp_ack =	svc_vc_ack,
@@ -123,7 +123,7 @@ static struct xp_ops svc_vc_ops = {
 	.xp_control =	svc_vc_control
 };
 
-static struct xp_ops svc_vc_backchannel_ops = {
+static const struct xp_ops svc_vc_backchannel_ops = {
 	.xp_recv =	svc_vc_backchannel_recv,
 	.xp_stat =	svc_vc_backchannel_stat,
 	.xp_reply =	svc_vc_backchannel_reply,


More information about the dev-commits-src-all mailing list