patch-2.1.32 linux/include/linux/sunrpc/xdr.h

Next file: linux/include/linux/sunrpc/xprt.h
Previous file: linux/include/linux/sunrpc/types.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.31/linux/include/linux/sunrpc/xdr.h linux/include/linux/sunrpc/xdr.h
@@ -0,0 +1,79 @@
+/*
+ * include/linux/sunrpc/xdr.h
+ *
+ * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
+ */
+
+#ifndef _SUNRPC_XDR_H_
+#define _SUNRPC_XDR_H_
+
+#ifdef __KERNEL__
+
+#include <linux/uio.h>
+
+/*
+ * Buffer adjustment
+ */
+#define XDR_QUADLEN(l)		(((l) + 3) >> 2)
+
+/*
+ * Generic opaque `network object.' At the kernel level, this type
+ * is used only by lockd.
+ */
+#define XDR_MAX_NETOBJ		1024
+struct xdr_netobj {
+	unsigned int		len;
+	u8 *			data;
+};
+
+/*
+ * This is the generic XDR function. rqstp is either a rpc_rqst (client
+ * side) or svc_rqst pointer (server side).
+ * Encode functions always assume there's enough room in the buffer.
+ */
+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.
+ */
+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;
+
+void		xdr_init(void);
+
+/*
+ * Miscellaneous XDR helper functions
+ */
+u32 *	xdr_encode_string(u32 *p, const char *s);
+u32 *	xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen);
+u32 *	xdr_encode_netobj(u32 *p, const struct xdr_netobj *);
+u32 *	xdr_decode_netobj(u32 *p, struct xdr_netobj *);
+u32 *	xdr_decode_netobj_fixed(u32 *p, void *obj, unsigned int len);
+
+/*
+ * Adjust iovec to reflect end of xdr'ed data (RPC client XDR)
+ */
+static inline int
+xdr_adjust_iovec(struct iovec *iov, u32 *p)
+{
+	return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base);
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* _SUNRPC_XDR_H_ */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov