1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 23:35:36 -08:00

Mark all the rpc 'ops' vectors, for auth, client, service, and xdr,

as const, moving them from .data to .data.rel.ro.  The other BSDs
did this a long time ago; NetBSD did a chunk in 1998, which is long
enough I didn't bother to get exact dates for others.

ok deraadt@ millert@
This commit is contained in:
guenther 2022-02-14 03:38:59 +00:00
parent 23ea498649
commit 8d4335cb9b
15 changed files with 32 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: auth.h,v 1.8 2015/09/13 12:29:03 guenther Exp $ */
/* $OpenBSD: auth.h,v 1.9 2022/02/14 03:38:59 guenther Exp $ */
/* $NetBSD: auth.h,v 1.7 1995/04/29 05:27:55 cgd Exp $ */
/*
@ -101,7 +101,7 @@ typedef struct __rpc_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 __rpc_auth *);
/* nextverf & serialize */
int (*ah_marshal)(struct __rpc_auth *, XDR *);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: clnt.h,v 1.11 2010/09/01 14:43:34 millert Exp $ */
/* $OpenBSD: clnt.h,v 1.12 2022/02/14 03:38:59 guenther Exp $ */
/* $NetBSD: clnt.h,v 1.6 1995/04/29 05:27:58 cgd Exp $ */
/*
@ -118,7 +118,7 @@ struct rpc_err {
*/
typedef struct __rpc_client {
AUTH *cl_auth; /* authenticator */
struct clnt_ops {
const struct clnt_ops {
/* call remote procedure */
enum clnt_stat (*cl_call)(struct __rpc_client *,
unsigned long, xdrproc_t, caddr_t,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: svc.h,v 1.16 2016/08/27 04:28:28 guenther Exp $ */
/* $OpenBSD: svc.h,v 1.17 2022/02/14 03:38:59 guenther Exp $ */
/* $NetBSD: svc.h,v 1.9 1995/04/29 05:28:01 cgd Exp $ */
/*
@ -78,7 +78,7 @@ enum xprt_stat {
typedef struct __rpc_svcxprt {
int xp_sock;
unsigned short xp_port; /* associated port number */
struct xp_ops {
const struct xp_ops {
/* receive incoming requests */
bool_t (*xp_recv)(struct __rpc_svcxprt *,
struct rpc_msg *);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: xdr.h,v 1.12 2010/09/01 14:43:34 millert Exp $ */
/* $OpenBSD: xdr.h,v 1.13 2022/02/14 03:38:59 guenther Exp $ */
/* $NetBSD: xdr.h,v 1.7 1995/04/29 05:28:06 cgd Exp $ */
/*
@ -99,7 +99,7 @@ enum xdr_op {
*/
typedef struct __rpc_xdr {
enum xdr_op x_op; /* operation; fast additional param */
struct xdr_ops {
const struct xdr_ops {
/* get a long from underlying stream */
bool_t (*x_getlong)(struct __rpc_xdr *, long *);
/* put a long to " */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: auth_none.c,v 1.14 2015/11/01 03:45:29 guenther Exp $ */
/* $OpenBSD: auth_none.c,v 1.15 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -53,7 +53,7 @@ static bool_t authnone_validate(struct __rpc_auth *, struct opaque_auth *);
static bool_t authnone_marshal(struct __rpc_auth *, XDR *);
static bool_t authnone_refresh(struct __rpc_auth *);
static struct auth_ops ops = {
static const struct auth_ops ops = {
authnone_verf,
authnone_marshal,
authnone_validate,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: auth_unix.c,v 1.29 2022/01/28 05:54:02 guenther Exp $ */
/* $OpenBSD: auth_unix.c,v 1.30 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -61,7 +61,7 @@ static bool_t authunix_validate(struct __rpc_auth *, struct opaque_auth *);
static bool_t authunix_refresh(struct __rpc_auth *);
static void authunix_destroy(struct __rpc_auth *);
static struct auth_ops auth_unix_ops = {
static const struct auth_ops auth_unix_ops = {
authunix_nextverf,
authunix_marshal,
authunix_validate,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: clnt_raw.c,v 1.20 2015/11/01 03:45:29 guenther Exp $ */
/* $OpenBSD: clnt_raw.c,v 1.21 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -66,7 +66,7 @@ static bool_t clntraw_freeres(CLIENT *, xdrproc_t, caddr_t);
static bool_t clntraw_control(CLIENT *, u_int, void *);
static void clntraw_destroy(CLIENT *);
static struct clnt_ops client_ops = {
static const struct clnt_ops client_ops = {
clntraw_call,
clntraw_abort,
clntraw_geterr,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: clnt_tcp.c,v 1.34 2020/07/06 13:33:06 pirofti Exp $ */
/* $OpenBSD: clnt_tcp.c,v 1.35 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -68,7 +68,7 @@ static bool_t clnttcp_freeres(CLIENT *, xdrproc_t, caddr_t);
static bool_t clnttcp_control(CLIENT *, u_int, void *);
static void clnttcp_destroy(CLIENT *);
static struct clnt_ops tcp_ops = {
static const struct clnt_ops tcp_ops = {
clnttcp_call,
clnttcp_abort,
clnttcp_geterr,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: clnt_udp.c,v 1.37 2020/07/06 13:33:06 pirofti Exp $ */
/* $OpenBSD: clnt_udp.c,v 1.38 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -57,7 +57,7 @@ static bool_t clntudp_freeres(CLIENT *, xdrproc_t, caddr_t);
static bool_t clntudp_control(CLIENT *, u_int, void *);
static void clntudp_destroy(CLIENT *);
static struct clnt_ops udp_ops = {
static const struct clnt_ops udp_ops = {
clntudp_call,
clntudp_abort,
clntudp_geterr,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: svc_raw.c,v 1.12 2015/11/01 03:45:29 guenther Exp $ */
/* $OpenBSD: svc_raw.c,v 1.13 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -61,7 +61,7 @@ static bool_t svcraw_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args,
caddr_t args_ptr);
static void svcraw_destroy(SVCXPRT *xprt);
static struct xp_ops server_ops = {
static const struct xp_ops server_ops = {
svcraw_recv,
svcraw_stat,
svcraw_getargs,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: svc_tcp.c,v 1.41 2020/07/06 13:33:06 pirofti Exp $ */
/* $OpenBSD: svc_tcp.c,v 1.42 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -63,7 +63,7 @@ static bool_t svctcp_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args,
caddr_t args_ptr);
static void svctcp_destroy(SVCXPRT *xprt);
static struct xp_ops svctcp_op = {
static const struct xp_ops svctcp_op = {
svctcp_recv,
svctcp_stat,
svctcp_getargs,
@ -78,7 +78,7 @@ static struct xp_ops svctcp_op = {
static bool_t rendezvous_request(SVCXPRT *xprt, struct rpc_msg *);
static enum xprt_stat rendezvous_stat(SVCXPRT *xprt);
static struct xp_ops svctcp_rendezvous_op = {
static const struct xp_ops svctcp_rendezvous_op = {
rendezvous_request,
rendezvous_stat,
/* XXX abort illegal in library */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: svc_udp.c,v 1.26 2019/06/28 13:32:42 deraadt Exp $ */
/* $OpenBSD: svc_udp.c,v 1.27 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -60,7 +60,7 @@ static void cache_set(SVCXPRT *, u_long);
static int cache_get(SVCXPRT *, struct rpc_msg *, char **,
u_long *);
static struct xp_ops svcudp_op = {
static const struct xp_ops svcudp_op = {
svcudp_recv,
svcudp_stat,
svcudp_getargs,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: xdr_mem.c,v 1.17 2015/11/01 03:45:29 guenther Exp $ */
/* $OpenBSD: xdr_mem.c,v 1.18 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -59,7 +59,7 @@ static int32_t *xdrmem_inline_aligned(XDR *, u_int);
static int32_t *xdrmem_inline_unaligned(XDR *, u_int);
static void xdrmem_destroy(XDR *);
static struct xdr_ops xdrmem_ops_aligned = {
static const struct xdr_ops xdrmem_ops_aligned = {
xdrmem_getlong_aligned,
xdrmem_putlong_aligned,
xdrmem_getbytes,
@ -71,7 +71,7 @@ static struct xdr_ops xdrmem_ops_aligned = {
NULL, /* xdrmem_control */
};
static struct xdr_ops xdrmem_ops_unaligned = {
static const struct xdr_ops xdrmem_ops_unaligned = {
xdrmem_getlong_unaligned,
xdrmem_putlong_unaligned,
xdrmem_getbytes,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: xdr_rec.c,v 1.22 2016/09/21 04:38:56 guenther Exp $ */
/* $OpenBSD: xdr_rec.c,v 1.23 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -80,7 +80,7 @@ PROTO_NORMAL(__xdrrec_getrec);
struct ct_data;
static struct xdr_ops xdrrec_ops = {
static const struct xdr_ops xdrrec_ops = {
xdrrec_getlong,
xdrrec_putlong,
xdrrec_getbytes,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: xdr_stdio.c,v 1.15 2019/06/28 13:32:42 deraadt Exp $ */
/* $OpenBSD: xdr_stdio.c,v 1.16 2022/02/14 03:38:59 guenther Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -55,7 +55,7 @@ static void xdrstdio_destroy(XDR *);
/*
* Ops vector for stdio type XDR
*/
static struct xdr_ops xdrstdio_ops = {
static const struct xdr_ops xdrstdio_ops = {
xdrstdio_getlong, /* deserialize a long int */
xdrstdio_putlong, /* serialize a long int */
xdrstdio_getbytes, /* deserialize counted bytes */