Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107166993
D24408.id70571.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D24408.id70571.diff
View Options
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
@@ -7333,6 +7333,6 @@
DECLARE_MODULE(zfsctrl, zfs_mod, SI_SUB_VFS, SI_ORDER_ANY);
MODULE_VERSION(zfsctrl, 1);
MODULE_DEPEND(zfsctrl, opensolaris, 1, 1, 1);
-MODULE_DEPEND(zfsctrl, krpc, 1, 1, 1);
+MODULE_DEPEND(zfsctrl, xdr, 1, 1, 1);
MODULE_DEPEND(zfsctrl, acl_nfs4, 1, 1, 1);
MODULE_DEPEND(zfsctrl, zlib, 1, 1, 1);
Index: sys/conf/files
===================================================================
--- sys/conf/files
+++ sys/conf/files
@@ -4983,9 +4983,9 @@
xen/xenbus/xenbusb_front.c optional xenhvm
xen/xenbus/xenbusb_back.c optional xenhvm
xen/xenmem/xenmem_if.m optional xenhvm
-xdr/xdr.c optional krpc | nfslockd | nfscl | nfsd
-xdr/xdr_array.c optional krpc | nfslockd | nfscl | nfsd
-xdr/xdr_mbuf.c optional krpc | nfslockd | nfscl | nfsd
-xdr/xdr_mem.c optional krpc | nfslockd | nfscl | nfsd
-xdr/xdr_reference.c optional krpc | nfslockd | nfscl | nfsd
-xdr/xdr_sizeof.c optional krpc | nfslockd | nfscl | nfsd
+xdr/xdr.c optional xdr | krpc | nfslockd | nfscl | nfsd
+xdr/xdr_array.c optional xdr | krpc | nfslockd | nfscl | nfsd
+xdr/xdr_mbuf.c optional xdr | krpc | nfslockd | nfscl | nfsd
+xdr/xdr_mem.c optional xdr | krpc | nfslockd | nfscl | nfsd
+xdr/xdr_reference.c optional xdr | krpc | nfslockd | nfscl | nfsd
+xdr/xdr_sizeof.c optional xdr | krpc | nfslockd | nfscl | nfsd
Index: sys/conf/options
===================================================================
--- sys/conf/options
+++ sys/conf/options
@@ -469,6 +469,7 @@
TCP_RFC7413_MAX_PSKS opt_inet.h
TCP_SIGNATURE opt_ipsec.h
VLAN_ARRAY opt_vlan.h
+XDR
XBONEHACK
#
Index: sys/modules/Makefile
===================================================================
--- sys/modules/Makefile
+++ sys/modules/Makefile
@@ -385,6 +385,7 @@
${_wpi} \
${_wpifw} \
${_x86bios} \
+ xdr \
xl \
xz \
zlib
Index: sys/modules/krpc/Makefile
===================================================================
--- sys/modules/krpc/Makefile
+++ sys/modules/krpc/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.PATH: ${SRCTOP}/sys/rpc ${SRCTOP}/sys/xdr
+.PATH: ${SRCTOP}/sys/rpc
KMOD= krpc
SRCS= auth_none.c \
auth_unix.c \
@@ -23,13 +23,6 @@
svc_generic.c \
svc_vc.c \
-SRCS+= xdr.c \
- xdr_array.c \
- xdr_mbuf.c \
- xdr_mem.c \
- xdr_reference.c \
- xdr_sizeof.c
-
SRCS+= opt_inet6.h
.include <bsd.kmod.mk>
Index: sys/modules/xdr/Makefile
===================================================================
--- /dev/null
+++ sys/modules/xdr/Makefile
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/xdr
+KMOD= xdr
+SRCS= xdr.c \
+ xdr_array.c \
+ xdr_mbuf.c \
+ xdr_mem.c \
+ xdr_reference.c \
+ xdr_sizeof.c
+
+.include <bsd.kmod.mk>
Index: sys/rpc/rpc_generic.c
===================================================================
--- sys/rpc/rpc_generic.c
+++ sys/rpc/rpc_generic.c
@@ -882,3 +882,4 @@
/* So that loader and kldload(2) can find us, wherever we are.. */
MODULE_VERSION(krpc, 1);
+MODULE_DEPEND(krpc, xdr, 1, 1, 1);
Index: sys/rpc/rpc_prot.c
===================================================================
--- sys/rpc/rpc_prot.c
+++ sys/rpc/rpc_prot.c
@@ -83,9 +83,12 @@
assert(xdrs != NULL);
assert(ap != NULL);
- if (xdr_enum(xdrs, &(ap->oa_flavor)))
+ if (xdr_enum(xdrs, &(ap->oa_flavor))) {
+ if (ap->oa_base == NULL)
+ ap->oa_base = mem_alloc(ap->oa_length);
return (xdr_bytes(xdrs, &ap->oa_base,
&ap->oa_length, MAX_AUTH_BYTES));
+ }
return (FALSE);
}
Index: sys/rpc/rpcb_prot.c
===================================================================
--- sys/rpc/rpcb_prot.c
+++ sys/rpc/rpcb_prot.c
@@ -68,6 +68,11 @@
return (FALSE);
}
+#if 0
+/*
+ * Not used in kernel. If ever to be enabled, check that objp->r_foo
+ * is preallocate, otherwise XDR would malloc memory of its internal type.
+ */
bool_t
xdr_rpcb(XDR *xdrs, RPCB *objp)
{
@@ -88,6 +93,7 @@
}
return (TRUE);
}
+#endif
/*
* rpcblist_ptr implements a linked list. The RPCL definition from
@@ -175,6 +181,11 @@
}
#endif
+#if 0
+/*
+ * Not used in kernel. If ever to be enabled, check that objp->r_foo
+ * is preallocated, otherwise XDR would malloc memory of its internal type.
+ */
bool_t
xdr_rpcb_entry(XDR *xdrs, rpcb_entry *objp)
{
@@ -195,6 +206,7 @@
}
return (TRUE);
}
+#endif
bool_t
xdr_rpcb_entry_list_ptr(XDR *xdrs, rpcb_entry_list_ptr *rp)
Index: sys/xdr/xdr.c
===================================================================
--- sys/xdr/xdr.c
+++ sys/xdr/xdr.c
@@ -50,6 +50,7 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/module.h>
#include <rpc/rpc.h>
#include <rpc/rpc_com.h>
@@ -65,6 +66,8 @@
#define XDR_FALSE ((long) 0)
#define XDR_TRUE ((long) 1)
+MALLOC_DEFINE(M_XDR, "xdr", "eXternal Data Representation");
+
/*
* for unit alignment
*/
@@ -527,7 +530,7 @@
return (TRUE);
}
if (sp == NULL) {
- *cpp = sp = mem_alloc(nodesize);
+ *cpp = sp = malloc(nodesize, M_XDR, M_WAITOK | M_ZERO);
allocated = TRUE;
}
if (sp == NULL) {
@@ -540,7 +543,7 @@
ret = xdr_opaque(xdrs, sp, nodesize);
if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) {
if (allocated == TRUE) {
- mem_free(sp, nodesize);
+ free(sp, M_XDR);
*cpp = NULL;
}
}
@@ -548,7 +551,7 @@
case XDR_FREE:
if (sp != NULL) {
- mem_free(sp, nodesize);
+ free(sp, M_XDR);
*cpp = NULL;
}
return (TRUE);
@@ -667,7 +670,7 @@
return (TRUE);
}
if (sp == NULL) {
- *cpp = sp = mem_alloc(nodesize);
+ *cpp = sp = malloc(nodesize, M_XDR, M_WAITOK | M_ZERO);
allocated = TRUE;
}
if (sp == NULL) {
@@ -681,14 +684,14 @@
ret = xdr_opaque(xdrs, sp, size);
if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) {
if (allocated == TRUE) {
- mem_free(sp, nodesize);
+ free(sp, M_XDR);
*cpp = NULL;
}
}
return (ret);
case XDR_FREE:
- mem_free(sp, nodesize);
+ free(sp, M_XDR);
*cpp = NULL;
return (TRUE);
}
@@ -834,3 +837,20 @@
*/
return (xdr_uint64_t(xdrs, (uint64_t *)ullp));
}
+
+/*
+ * Kernel module glue
+ */
+static int
+xdr_modevent(module_t mod, int type, void *data)
+{
+
+ return (0);
+}
+static moduledata_t xdr_mod = {
+ "xdr",
+ xdr_modevent,
+ NULL,
+};
+DECLARE_MODULE(xdr, xdr_mod, SI_SUB_VFS, SI_ORDER_ANY);
+MODULE_VERSION(xdr, 1);
Index: sys/xdr/xdr_array.c
===================================================================
--- sys/xdr/xdr_array.c
+++ sys/xdr/xdr_array.c
@@ -53,6 +53,8 @@
#include <rpc/types.h>
#include <rpc/xdr.h>
+MALLOC_DECLARE(M_XDR);
+
/*
* XDR an array of arbitrary elements
* *addrp is a pointer to the array, *sizep is the number of elements.
@@ -94,7 +96,8 @@
case XDR_DECODE:
if (c == 0)
return (TRUE);
- *addrp = target = mem_alloc(nodesize);
+ *addrp = target = malloc(nodesize, M_XDR,
+ M_WAITOK | M_ZERO);
if (target == NULL) {
printf("xdr_array: out of memory");
return (FALSE);
@@ -121,7 +124,7 @@
* the array may need freeing
*/
if (xdrs->x_op == XDR_FREE) {
- mem_free(*addrp, nodesize);
+ free(*addrp, M_XDR);
*addrp = NULL;
}
return (stat);
Index: sys/xdr/xdr_reference.c
===================================================================
--- sys/xdr/xdr_reference.c
+++ sys/xdr/xdr_reference.c
@@ -52,6 +52,8 @@
#include <rpc/types.h>
#include <rpc/xdr.h>
+MALLOC_DECLARE(M_XDR);
+
/*
* XDR an indirect pointer
* xdr_reference is for recursively translating a structure that is
@@ -76,7 +78,7 @@
return (TRUE);
case XDR_DECODE:
- *pp = loc = (caddr_t) mem_alloc(size);
+ *pp = loc = malloc(size, M_XDR, M_WAITOK | M_ZERO);
if (loc == NULL) {
printf("xdr_reference: out of memory");
return (FALSE);
@@ -91,7 +93,7 @@
stat = (*proc)(xdrs, loc);
if (xdrs->x_op == XDR_FREE) {
- mem_free(loc, size);
+ free(loc, M_XDR);
*pp = NULL;
}
return (stat);
Index: sys/xdr/xdr_sizeof.c
===================================================================
--- sys/xdr/xdr_sizeof.c
+++ sys/xdr/xdr_sizeof.c
@@ -45,6 +45,8 @@
#include <rpc/types.h>
#include <rpc/xdr.h>
+MALLOC_DECLARE(M_XDR);
+
/* ARGSUSED */
static bool_t
x_putlong(XDR *xdrs, const long *longp)
@@ -96,8 +98,8 @@
} else {
/* Free the earlier space and allocate new area */
if (xdrs->x_private)
- free(xdrs->x_private, M_RPC);
- if ((xdrs->x_private = (caddr_t) malloc(len, M_RPC, M_WAITOK)) == NULL) {
+ free(xdrs->x_private, M_XDR);
+ if ((xdrs->x_private = malloc(len, M_XDR, M_WAITOK)) == NULL) {
xdrs->x_base = 0;
return (NULL);
}
@@ -122,7 +124,7 @@
xdrs->x_handy = 0;
xdrs->x_base = 0;
if (xdrs->x_private) {
- free(xdrs->x_private, M_RPC);
+ free(xdrs->x_private, M_XDR);
xdrs->x_private = NULL;
}
return;
@@ -157,6 +159,6 @@
stat = func(&x, data);
if (x.x_private)
- free(x.x_private, M_RPC);
+ free(x.x_private, M_XDR);
return (stat == TRUE ? (unsigned) x.x_handy: 0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 3:45 AM (20 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15760774
Default Alt Text
D24408.id70571.diff (8 KB)
Attached To
Mode
D24408: ZFS should depend on XDR, not full RPC
Attached
Detach File
Event Timeline
Log In to Comment