arla-0.38 on FreeBSD/amd64

Garrett Wollman wollman at khavrinen.lcs.mit.edu
Fri Jan 7 01:25:28 CET 2005


[Third time's the charm....]

I ran into a few issues getting Arla to compile and (seemingly) work
on FreeBSD/amd64.  The most significant one has to do with the build
system for kernel modules on amd64.  I would suggest that, in general,
one cannot expect to use any build system for kernel modules other
than that supported by the operating system; my attempts to hack
correct module building into the existing makefile resulted in failure
(and in one case a kernel panic).  Since the infrastructure is there,
and it results in a dramatically simpler Makefile, it would probably
be better to use it.  (It's essential in my case since I need to
supply the KERNCOMPILEDIR variable to use the correct global compile
options for my custom kernel.)

There still remain a number of LP64 and other type bugs in the 0.38
release.  The enclosed patches fix the ones I noticed.  There may
still be others, as I noticed that writes did not work for anonymous
users with "system:anyuser rli" or "system:anyuser rlidwk".
(Interestingly, the *create* operation worked; it was just the write
that failed.)

The first patch may be essential, since register_t is 64 bits on LP64.
The other patches mostly fix debugging output; size_t != int on LP64.

#!/bin/sh
# This is a shell archive
echo x nnpfs-Makefile
sed 's/^X//' > nnpfs-Makefile << 'SHAR_END'
X#
X
XKMOD=	nnpfs
XSRCS=	vnode_if.h nnpfs_vopdefs.h \
X	nnpfs_deb.c nnpfs_message.c nnpfs_common.c nnpfs_node.c \
X	nnpfs_wrap-bsd.c nnpfs_common-bsd.c nnpfs_dev-common.c \
X	nnpfs_dev-bsd.c nnpfs_syscalls-common.c nnpfs_syscalls-wrap-freebsd.c \
X	nnpfs_node-bsd.c nnpfs_vfsops-common.c nnpfs_vfsops-bsd.c \
X	nnpfs_vfsops-freebsd.c nnpfs_vnodeops-common.c nnpfs_vnodeops-bsd.c
XSUBDIR=	bin
XCFLAGS=	-I${.CURDIR} -I${.CURDIR}/../../include -I${.CURDIR}/../include \
X	-DHAVE_CONFIG_H -DNNPFS_DEBUG -DINET6
XCLEANFILES=nnpfs_vopdefs.h
X
X.include <bsd.kmod.mk>
X
Xnnpfs_vopdefs.h: vnode_if.h
X	awk '/^struct vop_[a-z]*_args/ { vop=substr($$2,5,length($$2)-9); printf("#define HAVE_VOP_%s 1\n", toupper(vop)); printf("NNPFS_VOP_DEF(%s);\n", vop); }' vnode_if.h > ${.TARGET}
X	-mkdir nnpfs
X	test -d nnpfs && ( test -f nnpfs/nnpfs_vopdefs.h || ln -s ../nnpfs_vopdefs.h nnpfs/nnpfs_vopdefs.h )
SHAR_END
echo x patch-nnpfs_syscalls-wrap-freebsd.c
sed 's/^X//' > patch-nnpfs_syscalls-wrap-freebsd.c << 'SHAR_END'
X--- nnpfs/bsd/nnpfs_syscalls-wrap-freebsd.c.orig	Thu Jan  6 14:42:55 2005
X+++ nnpfs/bsd/nnpfs_syscalls-wrap-freebsd.c	Thu Jan  6 14:43:53 2005
X@@ -69,5 +69,5 @@
X nnpfs_setgroups_freebsd (d_thread_t *proc, void *varg)
X {
X-    int retval = 0;
X+    register_t retval = 0;
X     int ret;
X 
SHAR_END
echo x patch-rx.c
sed 's/^X//' > patch-rx.c << 'SHAR_END'
X--- rx/rx.c.orig	Thu Nov 18 00:09:21 2004
X+++ rx/rx.c	Thu Jan  6 15:10:33 2005
X@@ -3648,5 +3648,5 @@
X 				        * us! */
X     /* this is stupid  - sending an int as a pointer is begging for trouble */
X-    rxevent_Post(&tmp, rxi_DecongestionEvent, (void *) peer, (void *)nPackets);
X+    rxevent_Post(&tmp, rxi_DecongestionEvent, (void *) peer, (void *)(intptr_t)nPackets);
X }
X 
SHAR_END
echo x patch-bits.c
sed 's/^X//' > patch-bits.c << 'SHAR_END'
X--- include/bits.c.orig	Thu Jan  6 15:11:48 2005
X+++ include/bits.c	Thu Jan  6 15:12:13 2005
X@@ -141,5 +141,5 @@
X     }
X     fprintf(f, "/* %s -- this file was generated for %s by\n", fn, HOST);
X-    fprintf(f, "   %*s    %s */\n\n", strlen(fn), "", 
X+    fprintf(f, "   %*s    %s */\n\n", (int)strlen(fn), "", 
X 	    "$Id: bits.c,v 1.7 2002/02/07 17:59:15 lha Exp $");
X     fprintf(f, "#ifndef %s\n", hb);
SHAR_END
echo x patch-rx_multi.c
sed 's/^X//' > patch-rx_multi.c << 'SHAR_END'
X--- rx/rx_multi.c.orig	Thu Jan  6 15:13:28 2005
X+++ rx/rx_multi.c	Thu Jan  6 15:13:57 2005
X@@ -52,5 +52,5 @@
X 
X 	call = mh->calls[i] = rx_NewCall(conns[i]);
X-	rx_SetArrivalProc(call, multi_Ready, (void *) mh, (void *) i);
X+	rx_SetArrivalProc(call, multi_Ready, (void *) mh, (void *) (intptr_t)i);
X     }
X     return mh;
SHAR_END
echo x patch-rxperf.c
sed 's/^X//' > patch-rxperf.c << 'SHAR_END'
X--- rx/rxperf.c.orig	Thu Jan  6 15:15:04 2005
X+++ rx/rxperf.c	Thu Jan  6 15:16:43 2005
X@@ -777,6 +777,6 @@
X 		errx (1, "can't resolve readsize");
X 	    if (rxread_size > sizeof(somebuf))
X-	      errx(1, "%d > sizeof(somebuf) (%d)",
X-		   rxread_size, sizeof(somebuf));
X+	      errx(1, "%d > sizeof(somebuf) (%lu)",
X+		   rxread_size, (unsigned long)sizeof(somebuf));
X 	    break;
X 	case 'p':
X@@ -790,6 +790,6 @@
X 		errx (1, "can't resolve writesize");
X 	    if (rxwrite_size > sizeof(somebuf))
X-		errx(1, "%d > sizeof(somebuf) (%d)",
X-		     rxwrite_size, sizeof(somebuf));
X+		errx(1, "%d > sizeof(somebuf) (%lu)",
X+		     rxwrite_size, (unsigned long)sizeof(somebuf));
X 	    break;
X 	default:
X@@ -871,6 +871,6 @@
X 		errx (1, "can't resolve readsize");
X 	    if (rxread_size > sizeof(somebuf))
X-		errx(1, "%d > sizeof(somebuf) (%d)",
X-		     rxread_size, sizeof(somebuf));
X+		errx(1, "%d > sizeof(somebuf) (%lu)",
X+		     rxread_size, (unsigned long)sizeof(somebuf));
X 	    break;
X 	case 's':
X@@ -884,6 +884,6 @@
X 		errx (1, "can't resolve writesize");
X 	    if (rxwrite_size > sizeof(somebuf))
X-		errx(1, "%d > sizeof(somebuf) (%d)",
X-		     rxwrite_size, sizeof(somebuf));
X+		errx(1, "%d > sizeof(somebuf) (%lu)",
X+		     rxwrite_size, (unsigned long)sizeof(somebuf));
X 	    break;
X 	case 'T':
SHAR_END
echo x patch-arla_local.h
sed 's/^X//' > patch-arla_local.h << 'SHAR_END'
X--- arlad/arla_local.h.orig	Thu Jan  6 15:19:10 2005
X+++ arlad/arla_local.h	Thu Jan  6 15:19:38 2005
X@@ -53,5 +53,7 @@
X #include <dirent.h>
X #if DIRENT_AND_SYS_DIR_H
X+#ifndef __FreeBSD__		/* configure test ok, but compiler warns */
X #include <sys/dir.h>
X+#endif
X #endif
X #elif defined(HAVE_SYS_DIR_H)
SHAR_END
exit





More information about the Arla-drinkers mailing list