summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-03-18 21:22:12 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:27 +0200
commit8bb1bab7542944a3ce1b9c92fcb2ec6731806ae4 (patch)
tree5370d426ef2486d970c09f557a64dffcb857c414
parent3da72862b8cda600702815e6450add3906b98b59 (diff)
rpc: constify some more data
Comments in header were used by vda on a similar commit Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--include/rpc/auth.h4
-rw-r--r--include/rpc/xdr.h4
-rw-r--r--libc/inet/rpc/auth_unix.c4
-rw-r--r--libc/inet/rpc/svc_raw.c2
-rw-r--r--libc/inet/rpc/xdr_mem.c4
-rw-r--r--libc/inet/rpc/xdr_rec.c4
-rw-r--r--libc/inet/rpc/xdr_stdio.c4
7 files changed, 14 insertions, 12 deletions
diff --git a/include/rpc/auth.h b/include/rpc/auth.h
index 1d5198ca4..e2c7987dc 100644
--- a/include/rpc/auth.h
+++ b/include/rpc/auth.h
@@ -96,6 +96,10 @@ struct AUTH {
struct opaque_auth ah_cred;
struct opaque_auth ah_verf;
union des_block ah_key;
+ /* not sure whether non-const-ness is a part of the spec... if it is,
+ * enclose "const" in #ifdef _LIBC / #endif
+ * to make it effective only for libc compile */
+ const
struct auth_ops {
void (*ah_nextverf) (AUTH *);
int (*ah_marshal) (AUTH *, XDR *); /* nextverf & serialize */
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index ec6cd4c7e..f4756acd0 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -112,6 +112,10 @@ typedef struct XDR XDR;
struct XDR
{
enum xdr_op x_op; /* operation; fast additional param */
+ /* not sure whether non-const-ness is a part of the spec... if it is,
+ * enclose "const" in #ifdef _LIBC / #endif
+ * to make it effective only for libc compile */
+ const
struct xdr_ops
{
bool_t (*x_getlong) (XDR *__xdrs, long *__lp);
diff --git a/libc/inet/rpc/auth_unix.c b/libc/inet/rpc/auth_unix.c
index 3dc253030..72d7a7af9 100644
--- a/libc/inet/rpc/auth_unix.c
+++ b/libc/inet/rpc/auth_unix.c
@@ -59,7 +59,7 @@ static bool_t authunix_validate (AUTH *, struct opaque_auth *);
static bool_t authunix_refresh (AUTH *);
static void authunix_destroy (AUTH *);
-static struct auth_ops auth_unix_ops = {
+static const struct auth_ops auth_unix_ops = {
authunix_nextverf,
authunix_marshal,
authunix_validate,
@@ -314,7 +314,7 @@ marshal_new_auth (AUTH *auth)
xdrmem_create (xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
if ((!xdr_opaque_auth (xdrs, &(auth->ah_cred))) ||
(!xdr_opaque_auth (xdrs, &(auth->ah_verf))))
- perror (_("auth_none.c - Fatal marshalling problem"));
+ perror (_("auth_unix.c - Fatal marshalling problem"));
else
au->au_mpos = XDR_GETPOS (xdrs);
diff --git a/libc/inet/rpc/svc_raw.c b/libc/inet/rpc/svc_raw.c
index b76663d94..8156042fe 100644
--- a/libc/inet/rpc/svc_raw.c
+++ b/libc/inet/rpc/svc_raw.c
@@ -67,7 +67,7 @@ static bool_t svcraw_reply (SVCXPRT *, struct rpc_msg *);
static bool_t svcraw_freeargs (SVCXPRT *, xdrproc_t, caddr_t);
static void svcraw_destroy (SVCXPRT *);
-static struct xp_ops server_ops =
+static const struct xp_ops server_ops =
{
svcraw_recv,
svcraw_stat,
diff --git a/libc/inet/rpc/xdr_mem.c b/libc/inet/rpc/xdr_mem.c
index c58fc450a..6773b56e2 100644
--- a/libc/inet/rpc/xdr_mem.c
+++ b/libc/inet/rpc/xdr_mem.c
@@ -77,9 +77,7 @@ void
xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op)
{
xdrs->x_op = op;
- /* We have to add the const since the `struct xdr_ops' in `struct XDR'
- is not `const'. */
- xdrs->x_ops = (struct xdr_ops *) &xdrmem_ops;
+ xdrs->x_ops = &xdrmem_ops;
xdrs->x_private = xdrs->x_base = addr;
xdrs->x_handy = size;
}
diff --git a/libc/inet/rpc/xdr_rec.c b/libc/inet/rpc/xdr_rec.c
index 87d50abd0..3ad7d7275 100644
--- a/libc/inet/rpc/xdr_rec.c
+++ b/libc/inet/rpc/xdr_rec.c
@@ -177,9 +177,7 @@ xdrrec_create (XDR *xdrs, u_int sendsize,
/*
* now the rest ...
*/
- /* We have to add the const since the `struct xdr_ops' in `struct XDR'
- is not `const'. */
- xdrs->x_ops = (struct xdr_ops *) &xdrrec_ops;
+ xdrs->x_ops = &xdrrec_ops;
xdrs->x_private = (caddr_t) rstrm;
rstrm->tcp_handle = tcp_handle;
rstrm->readit = readit;
diff --git a/libc/inet/rpc/xdr_stdio.c b/libc/inet/rpc/xdr_stdio.c
index 6a5e06edc..6a18fce08 100644
--- a/libc/inet/rpc/xdr_stdio.c
+++ b/libc/inet/rpc/xdr_stdio.c
@@ -78,9 +78,7 @@ void
xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op)
{
xdrs->x_op = op;
- /* We have to add the const since the `struct xdr_ops' in `struct XDR'
- is not `const'. */
- xdrs->x_ops = (struct xdr_ops *) &xdrstdio_ops;
+ xdrs->x_ops = &xdrstdio_ops;
xdrs->x_private = (caddr_t) file;
xdrs->x_handy = 0;
xdrs->x_base = 0;