Coda File System

assorted patches against 5.0.1

From: Greg Troxel <gdt_at_ir.bbn.com>
Date: Thu, 11 Feb 1999 12:02:53 -0500
Matt Fredette and myself of the BBN Technologies Internetwork Research
department have Coda 5.0.1 working with a FreeBSD/i386 2.2.6 server
and clients on FreeBSD/i386 2.2.6 and NetBSD/sparc 1.3.3.
Comments/kudos about the NetBSD/sparc issues should go to Matt.

I am attaching a patch file which

* adds NetBSD/sparc support to process.s
* fixes configure (I know this should be configure.in, sorry) to
  realize that NetBSD does not imply i386 
* fixes a few other NetBSD/sparc nits
* adds the case sensitivity stuff to the netbsd and freebsd kernel
  sources, and perhaps some other stuff from newer kernels (append bit?)
* makes venus not barf on the lack of version ioctl, since the
  provided sources for FreeBSD 2.2 and NetBSD 1.3 don't have this
  ioctl.  I suspect the ifdef tests the wrong thing, but I don't know
  the right answer.

With the below patches, things seem to mostly work fine.  Our only
problem is that a directory with lots of files (2400ish - a mirror of
RFCs) doesn't list correctly, even though the files are there.

fnord gdt 141 /coda/project/rfc/ftp.normos.org/ietf/rfc > ls|wc
     204     204    2396

Running a shell loop that runs 'md5' on rfc$i.txt for i=1 to 2400
seems to do the right thing.

Then:

fnord > cfs lc |grep ftp.normos.org/ietf/rfc|wc
    2005    2023   79533

So it appears that the venus->kernel path for directories is broken
somehow.
"Upgrading" to FreeBSD 3 is not an option.  Are there fixes for this
in the newer kernels we need to pull back?

I should point out that this is with a server with a few errors in its
log, whose server data files are from 4.6.5, but which is now running
5.0.1.

I had the same problem with a 4.7.4 venus and a 4.6.5 server, and
wrote it off to version incompatibility at the time.


        Greg Troxel <gdt_at_ir.bbn.com>

diff -c coda/coda-src/venus/fso_cfscalls2.cc:1.1.1.3 coda/coda-src/venus/fso_cfscalls2.cc:1.4
*** coda/coda-src/venus/fso_cfscalls2.cc:1.1.1.3	Thu Jan 28 18:23:01 1999
--- coda/coda-src/venus/fso_cfscalls2.cc	Thu Jan 28 18:43:51 1999
***************
*** 461,466 ****
--- 461,474 ----
  static char cputype [] = "arm32";
  static char systype [] = "arm32_nbsd1";
  #endif
+ #ifdef sparc
+ static char cputype [] = "sparc";
+ static char systype [] = "sparc_nbsd1";
+ #endif
+ #ifdef sun3
+ static char cputype [] = "sun3";
+ static char systype [] = "sun3_nbsd1";
+ #endif
  #endif /* __NetBSD__ */
  
  #ifdef __FreeBSD__
diff -c coda/coda-src/venus/worker.cc:1.1.1.3 coda/coda-src/venus/worker.cc:1.4
*** coda/coda-src/venus/worker.cc:1.1.1.3	Thu Jan 28 18:23:22 1999
--- coda/coda-src/venus/worker.cc	Wed Feb 10 16:48:23 1999
***************
*** 521,527 ****
          eprint("WorkerInit: worker::muxfd >= %d!", NFDS);
          exit(-1);
      }
! #ifdef  __BSD44__
      if (::ioctl(worker::muxfd, CIOC_KERNEL_VERSION, &kernel_version) < 0 ) {
          eprint("WorkerInit errno %d: Version IOCTL FAILED!  Get a newer Kernel!"
  , errno);
--- 521,527 ----
          eprint("WorkerInit: worker::muxfd >= %d!", NFDS);
          exit(-1);
      }
! #ifdef  notdef
      if (::ioctl(worker::muxfd, CIOC_KERNEL_VERSION, &kernel_version) < 0 ) {
          eprint("WorkerInit errno %d: Version IOCTL FAILED!  Get a newer Kernel!"
  , errno);
diff -c coda/configs/codaconf.m4:1.1.1.2 coda/configs/codaconf.m4:1.2
*** coda/configs/codaconf.m4:1.1.1.2	Thu Oct  8 11:20:05 1998
--- coda/configs/codaconf.m4	Thu Jan 28 16:32:56 1999
***************
*** 26,32 ****
  
  	*-*-netbsd* )
  	    	shortsys=nbsd
! 	    	sys=i386_nbsd1
  		vfsdir=bsd44
  		os=`uname -r`
  		initsuffix=../etc
--- 26,36 ----
  
  	*-*-netbsd* )
  	    	shortsys=nbsd
! 		sys=nbsd
! 		case ${host_cpu} in
! 			i*6 )   arch=i386 ;;
! 			sparc ) arch=sparc ;;
! 		esac
  		vfsdir=bsd44
  		os=`uname -r`
  		initsuffix=../etc
diff -c coda/configure:1.1.1.2 coda/configure:1.2
*** coda/configure:1.1.1.2	Thu Oct  8 11:19:31 1998
--- coda/configure	Thu Jan 28 16:31:21 1999
***************
*** 1356,1362 ****
  
  	*-*-netbsd* )
  	    	shortsys=nbsd
! 	    	sys=i386_nbsd1
  		vfsdir=bsd44
  		os=`uname -r`
  		initsuffix=../etc
--- 1356,1366 ----
  
  	*-*-netbsd* )
  	    	shortsys=nbsd
! 		sys=nbsd
! 		case ${host_cpu} in
! 			i*6 )   arch=i386 ;;
! 			sparc ) arch=sparc ;;
! 		esac
  		vfsdir=bsd44
  		os=`uname -r`
  		initsuffix=../etc
diff -c coda/kernel-src/vfs/freebsd/cfs/cfs_venus.c:1.1.1.2 coda/kernel-src/vfs/freebsd/cfs/cfs_venus.c:1.2
*** coda/kernel-src/vfs/freebsd/cfs/cfs_venus.c:1.1.1.2	Tue Sep 15 13:25:47 1998
--- coda/kernel-src/vfs/freebsd/cfs/cfs_venus.c	Thu Feb 11 08:04:04 1999
***************
*** 409,414 ****
--- 409,415 ----
      /* send the open to venus. */
      INIT_IN(&inp->ih, CFS_LOOKUP, cred, p);
      inp->VFid = *fid;
+     inp->flags = CLU_CASE_SENSITIVE;
  
      inp->name = Isize;
      STRCPY(name, nm, len);		/* increments Isize */
diff -c coda/kernel-src/vfs/freebsd/cfs/coda.h:1.1.1.2 coda/kernel-src/vfs/freebsd/cfs/coda.h:1.2
*** coda/kernel-src/vfs/freebsd/cfs/coda.h:1.1.1.2	Tue Sep 15 13:25:48 1998
--- coda/kernel-src/vfs/freebsd/cfs/coda.h	Thu Feb 11 08:04:04 1999
***************
*** 78,89 ****
--- 78,91 ----
  #define	C_O_WRITE       0x002
  #define C_O_TRUNC       0x010
  #define C_O_EXCL	0x100
+ #define C_O_CREAT	0x200
  
  /* these are to find mode bits in Venus */ 
  #define C_M_READ  00400
  #define C_M_WRITE 00200
  
  /* for access Venus will use */
+ #define C_A_C_OK    8               /* Test for writing upon create.  */
  #define C_A_R_OK    4               /* Test for read permission.  */
  #define C_A_W_OK    2               /* Test for write permission.  */
  #define C_A_X_OK    1               /* Test for execute permission.  */
***************
*** 350,360 ****
--- 352,367 ----
      struct cfs_out_hdr out;
  };
  
+ /* lookup flags */
+ #define CLU_CASE_SENSITIVE	0x01
+ #define CLU_CASE_INSENSITIVE	0x02
+ 
  /* cfs_lookup: */
  struct  cfs_lookup_in {
      struct cfs_in_hdr ih;
      ViceFid	VFid;
      int         name;		/* Place holder for data. */
+     int		flags;
  };
  
  struct cfs_lookup_out {
diff -c coda/kernel-src/vfs/netbsd/cfs/cfs_venus.c:1.1.1.2 coda/kernel-src/vfs/netbsd/cfs/cfs_venus.c:1.2
*** coda/kernel-src/vfs/netbsd/cfs/cfs_venus.c:1.1.1.2	Tue Sep 15 13:25:53 1998
--- coda/kernel-src/vfs/netbsd/cfs/cfs_venus.c	Wed Feb 10 17:24:50 1999
***************
*** 409,414 ****
--- 409,415 ----
      /* send the open to venus. */
      INIT_IN(&inp->ih, CFS_LOOKUP, cred, p);
      inp->VFid = *fid;
+     inp->flags = CLU_CASE_SENSITIVE;
  
      inp->name = Isize;
      STRCPY(name, nm, len);		/* increments Isize */
diff -c coda/kernel-src/vfs/netbsd/cfs/coda.h:1.1.1.2 coda/kernel-src/vfs/netbsd/cfs/coda.h:1.2
*** coda/kernel-src/vfs/netbsd/cfs/coda.h:1.1.1.2	Tue Sep 15 13:25:53 1998
--- coda/kernel-src/vfs/netbsd/cfs/coda.h	Wed Feb 10 17:21:04 1999
***************
*** 78,89 ****
--- 78,91 ----
  #define	C_O_WRITE       0x002
  #define C_O_TRUNC       0x010
  #define C_O_EXCL	0x100
+ #define C_O_CREAT	0x200
  
  /* these are to find mode bits in Venus */ 
  #define C_M_READ  00400
  #define C_M_WRITE 00200
  
  /* for access Venus will use */
+ #define C_A_C_OK    8               /* Test for writing upon create.  */
  #define C_A_R_OK    4               /* Test for read permission.  */
  #define C_A_W_OK    2               /* Test for write permission.  */
  #define C_A_X_OK    1               /* Test for execute permission.  */
***************
*** 350,360 ****
--- 352,367 ----
      struct cfs_out_hdr out;
  };
  
+ /* lookup flags */
+ #define CLU_CASE_SENSITIVE	0x01
+ #define CLU_CASE_INSENSITIVE	0x02
+ 
  /* cfs_lookup: */
  struct  cfs_lookup_in {
      struct cfs_in_hdr ih;
      ViceFid	VFid;
      int         name;		/* Place holder for data. */
+     int		flags;
  };
  
  struct cfs_lookup_out {
diff -c coda/lib-src/mlwp/process.s:1.1.1.3 coda/lib-src/mlwp/process.s:1.4
*** coda/lib-src/mlwp/process.s:1.1.1.3	Thu Jan 28 18:25:17 1999
--- coda/lib-src/mlwp/process.s	Thu Jan 28 18:44:02 1999
***************
*** 122,137 ****
  #endif sun3
  
  #if defined(sun4) || defined(sparc)
! #ifdef __linux__
  /* This info from Miguel de Icaza (and SunOS header files/libc) */
  #define STACK_ALIGN 8
  #define WINDOWSIZE (4*16)
  #define ARGPUSHSIZE (6*4)
  #define MINFRAME  (WINDOWSIZE+ARGPUSHSIZE+4) /* min frame */
  #define SA(X)     (((X)+(STACK_ALIGN-1)) & ~(STACK_ALIGN-1))
  #define NAME(x) x
  #define ENTRY(x) .type x,@function; .global x; x:
  #include <asm/traps.h>
  #else
  #include <sun4/asm_linkage.h>
  #include <sun4/trap.h>
--- 122,144 ----
  #endif sun3
  
  #if defined(sun4) || defined(sparc)
! #if defined(__linux__) || defined(__NetBSD__)
  /* This info from Miguel de Icaza (and SunOS header files/libc) */
  #define STACK_ALIGN 8
  #define WINDOWSIZE (4*16)
  #define ARGPUSHSIZE (6*4)
  #define MINFRAME  (WINDOWSIZE+ARGPUSHSIZE+4) /* min frame */
  #define SA(X)     (((X)+(STACK_ALIGN-1)) & ~(STACK_ALIGN-1))
+ #ifdef __linux__
  #define NAME(x) x
  #define ENTRY(x) .type x,@function; .global x; x:
  #include <asm/traps.h>
+ #else  /* __NetBSD__ */
+ #include <machine/asm.h>
+ #include <machine/trap.h>
+ #define NAME(x) _C_LABEL(x)
+ #define ST_FLUSH_WINDOWS T_FLUSHWIN
+ #endif /* __NetBSD__ */
  #else
  #include <sun4/asm_linkage.h>
  #include <sun4/trap.h>
***************
*** 157,164 ****
  	tst	%i2
  	be	1f
  	st	%sp, [%i1]
! 	and	%i2, -STACK_ALIGN, %sp
! 	sub	%sp, SA(MINFRAME), %sp
  1:
  	call	.ptr_call, 0
  	mov	%i0, %g1
--- 164,171 ----
  	tst	%i2
  	be	1f
  	st	%sp, [%i1]
! 	and	%i2, -STACK_ALIGN, %o0
! 	sub	%o0, SA(MINFRAME), %sp
  1:
  	call	.ptr_call, 0
  	mov	%i0, %g1
***************
*** 174,181 ****
--- 181,192 ----
  	retl
  	restore
  
+ #if defined(__linux__) || defined(__NetBSD__)
  #ifdef __linux__
  ENTRY(.ptr_call)
+ #else  /* __NetBSD__ */
+ ASENTRY(.ptr_call)
+ #endif /* __NetBSD__ */
  	jmp %g1
  	nop
  #endif
Received on 1999-02-11 12:03:39