Coda File System

Patch: FreeBSD support for Coda 5.2.20

From: Tim Robbins <tjr_at_FreeBSD.ORG>
Date: Fri, 7 Mar 2003 16:51:40 +1100
This patch against Coda 5.2.20 makes it compile on FreeBSD 5. It changes
three things:
  - Does not access the `struct stat' (non-)field st_qspare.
  - scandir()'s third argument is a function that takes a non-const
    struct dirent pointer as an argument.
  - Define __BIT_TYPES_DEFINED__ on FreeBSD 5 to avoid duplicate
    definitions of int8_t, etc.

All three of these changes could potentially be made into autoconf
tests.

Index: coda-src/venus/vproc.cc
===================================================================
RCS file: /home/tim/coda/repo/coda/coda-src/venus/vproc.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- coda-src/venus/vproc.cc	7 Mar 2003 04:27:39 -0000	1.1.1.1
+++ coda-src/venus/vproc.cc	7 Mar 2003 04:55:35 -0000	1.2
@@ -784,8 +784,10 @@
 #if !defined(NetBSD1_3) && !defined(__NetBSD_Version__)
     sp->st_lspare = 0;
 #endif
+#if __FreeBSD__ < 5
     sp->st_qspare[0] = 0;
     sp->st_qspare[1] = 0;
+#endif
 #endif /* __BSD44__ */
 }
 
Index: coda-src/vice/srv.cc
===================================================================
RCS file: /home/tim/coda/repo/coda/coda-src/vice/srv.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- coda-src/vice/srv.cc	7 Mar 2003 04:27:39 -0000	1.1.1.1
+++ coda-src/vice/srv.cc	7 Mar 2003 05:01:33 -0000	1.2
@@ -1267,8 +1267,13 @@
     char buf[100], buf2[100]; /* can't believe there will be more logs! */
     struct dirent **namelist = NULL;
 
+#if __FreeBSD__ >= 5
+    count = scandir(".", &namelist, (int (*)(dirent *)) xselect,
+		    (int (*)(const void *, const void *)) compar);
+#else
     count = scandir(".", &namelist, (int (*)(const dirent *)) xselect,
 		    (int (*)(const void *, const void *)) compar);
+#endif
     /* It is safe now to blindly rename */
     for (i = 0; i < count; i++) {
 	sprintf(buf, "SrvLog-%d", count-i);
Index: lib-src/kernel-includes/coda.h
===================================================================
RCS file: /home/tim/coda/repo/coda/lib-src/kernel-includes/coda.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- lib-src/kernel-includes/coda.h	7 Mar 2003 04:27:41 -0000	1.1.1.1
+++ lib-src/kernel-includes/coda.h	7 Mar 2003 04:40:46 -0000	1.2
@@ -125,6 +125,10 @@
 #define __BIT_TYPES_DEFINED__
 #endif
 
+#if __FreeBSD__ >= 5
+#define	__BIT_TYPES_DEFINED__
+#endif
+
 #ifndef __BIT_TYPES_DEFINED__
 #define __BIT_TYPES_DEFINED__
 typedef signed char	      int8_t;
Received on 2003-03-07 00:52:16