An obvious patch

Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
07 Dec 1998 11:33:40 +0100


Everyone will agree that this patch does exactly The Right Thing(tm). :-)

--- linux/include/linux/sunrpc/xdr.h.~1~ Wed Apr 9 21:28:59 1997
+++ linux/include/linux/sunrpc/xdr.h Sun Dec 6 14:29:09 1998
@@ -10,6 +10,7 @@
#ifdef __KERNEL__

#include <linux/uio.h>
+#include <linux/in.h>

/*
* Buffer adjustment
@@ -34,25 +35,25 @@
typedef int (*kxdrproc_t)(void *rqstp, u32 *data, void *obj);

/*
- * These variables contain pre-xdr'ed values for faster operation.
- * FIXME: should be replaced by macros for big-endian machines.
+ * A few useless macros.
*/
-extern u32 xdr_zero, xdr_one, xdr_two;
-
-extern u32 rpc_success,
- rpc_prog_unavail,
- rpc_prog_mismatch,
- rpc_proc_unavail,
- rpc_garbage_args,
- rpc_system_err;
-
-extern u32 rpc_auth_ok,
- rpc_autherr_badcred,
- rpc_autherr_rejectedcred,
- rpc_autherr_badverf,
- rpc_autherr_rejectedverf,
- rpc_autherr_tooweak,
- rpc_autherr_dropit;
+#define xdr_zero htonl(0)
+#define xdr_one htonl(1)
+#define xdr_two htonl(2)
+
+#define rpc_success htonl(RPC_SUCCESS)
+#define rpc_prog_unavail htonl(RPC_PROG_UNAVAIL)
+#define rpc_prog_mismatch htonl(RPC_PROG_MISMATCH)
+#define rpc_proc_unavail htonl(RPC_PROC_UNAVAIL)
+#define rpc_garbage_args htonl(RPC_GARBAGE_ARGS)
+#define rpc_system_err htonl(RPC_SYSTEM_ERR)
+
+#define rpc_auth_ok htonl(RPC_AUTH_OK)
+#define rpc_autherr_badcred htonl(RPC_AUTH_BADCRED)
+#define rpc_autherr_rejectedcred htonl(RPC_AUTH_REJECTEDCRED)
+#define rpc_autherr_badverf htonl(RPC_AUTH_BADVERF)
+#define rpc_autherr_rejectedverf htonl(RPC_AUTH_REJECTEDVERF)
+#define rpc_autherr_tooweak htonl(RPC_AUTH_TOOWEAK)

void xdr_init(void);

--- linux/net/sunrpc/sunrpc_syms.c.~1~ Fri Aug 21 18:43:33 1998
+++ linux/net/sunrpc/sunrpc_syms.c Sun Dec 6 14:34:23 1998
@@ -91,13 +91,6 @@
EXPORT_SYMBOL(xdr_decode_string);
EXPORT_SYMBOL(xdr_decode_netobj);
EXPORT_SYMBOL(xdr_encode_netobj);
-EXPORT_SYMBOL(xdr_zero);
-EXPORT_SYMBOL(xdr_one);
-
-/* RPC errors */
-EXPORT_SYMBOL(rpc_success);
-EXPORT_SYMBOL(rpc_garbage_args);
-EXPORT_SYMBOL(rpc_system_err);

/* Debugging symbols */
EXPORT_SYMBOL(rpc_debug);
--- linux/net/sunrpc/xdr.c.~1~ Wed Apr 9 21:29:26 1997
+++ linux/net/sunrpc/xdr.c Sun Dec 6 14:28:57 1998
@@ -13,39 +13,9 @@
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/msg_prot.h>

-u32 rpc_success, rpc_prog_unavail, rpc_prog_mismatch, rpc_proc_unavail,
- rpc_garbage_args, rpc_system_err;
-u32 rpc_auth_ok, rpc_autherr_badcred, rpc_autherr_rejectedcred,
- rpc_autherr_badverf, rpc_autherr_rejectedverf, rpc_autherr_tooweak;
-u32 xdr_zero, xdr_one, xdr_two;
-
void
xdr_init(void)
{
- static int inited = 0;
-
- if (inited)
- return;
-
- xdr_zero = htonl(0);
- xdr_one = htonl(1);
- xdr_two = htonl(2);
-
- rpc_success = htonl(RPC_SUCCESS);
- rpc_prog_unavail = htonl(RPC_PROG_UNAVAIL);
- rpc_prog_mismatch = htonl(RPC_PROG_MISMATCH);
- rpc_proc_unavail = htonl(RPC_PROC_UNAVAIL);
- rpc_garbage_args = htonl(RPC_GARBAGE_ARGS);
- rpc_system_err = htonl(RPC_SYSTEM_ERR);
-
- rpc_auth_ok = htonl(RPC_AUTH_OK);
- rpc_autherr_badcred = htonl(RPC_AUTH_BADCRED);
- rpc_autherr_rejectedcred = htonl(RPC_AUTH_REJECTEDCRED);
- rpc_autherr_badverf = htonl(RPC_AUTH_BADVERF);
- rpc_autherr_rejectedverf = htonl(RPC_AUTH_REJECTEDVERF);
- rpc_autherr_tooweak = htonl(RPC_AUTH_TOOWEAK);
-
- inited = 1;
}

/*

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/