[7669] in Athena Bugs

home help back first fref pref prev next nref lref last post

attach diffs for a slightly moldy, slightly premature BSD44 interface

daemon@ATHENA.MIT.EDU (John T Kohl)
Mon Jun 17 15:22:00 1991

Date: Mon, 17 Jun 91 15:21:40 EDT
From: John T Kohl <jtkohl@MIT.EDU>
To: bugs@MIT.EDU

These are RCS diffs from sources snatched sometime around last February.
Your mileage will almost certainly vary.

*** /tmp/,RCSt1a04887	Mon Jun 17 15:16:53 1991
--- Makefile	Tue Feb 27 09:53:18 1990
***************
*** 2,20 ****
  #
  #	Makefile for attach, detach, and nfsid
  #
! #  $Header: /u2/source/attach/RCS/Makefile,v 1.1 89/11/16 08:00:14 probe Exp $
  #
  
! DEFINES =
! LIBDIR = 
! CFLAGS = ${DEFINES} -g
  LFLAGS = ${LIBDIR}
! LD = cc
  CC = cc
  MACHTYPE = /bin/athena/machtype
  
  # If ZEPHYR is not defined in config.h, remove -lzephyr and -lcom_err
! LIBS = -lhesiod -lkrb -ldes -lrpcsvc -lzephyr -lcom_err
  
  OBJS =	main.o \
  	util.o \
--- 2,22 ----
  #
  #	Makefile for attach, detach, and nfsid
  #
! #  $Header: /u2/scratch/attach/RCS/Makefile,v 1.3 90/02/09 08:43:49 epeisach Exp Locker: jtkohl $
  #
  
! DEFINES = -Uultrix -DBSD44
! INCLUDES= -I/machusr/include -I/machusr/mach/include
! LIBDIR = -L/machusr/mach/lib
! DBG= -g
! CFLAGS = ${DEFINES} ${DBG} ${INCLUDES}
  LFLAGS = ${LIBDIR}
! LD = cc ${DBG}
  CC = cc
  MACHTYPE = /bin/athena/machtype
  
  # If ZEPHYR is not defined in config.h, remove -lzephyr and -lcom_err
! LIBS = -lhesiod -lkrb -ldes -lrpc -lzephyr -lcom_err -lnewc ctype.o toupper.o mountxdr.o
  
  OBJS =	main.o \
  	util.o \
***************
*** 54,60 ****
  	config.c \
  	strtok.c
  
! all: attach machine-type
  
  clean:
  	rm -f *.bak *.o *~ \#* core *.sav tmp* attach machine-type
--- 56,62 ----
  	config.c \
  	strtok.c
  
! all: attach
  
  clean:
  	rm -f *.bak *.o *~ \#* core *.sav tmp* attach machine-type
***************
*** 65,71 ****
  attach: ${OBJS}
  	-/bin/mv -f attach attach.old
  	${LD} ${LFLAGS} -o attach ${OBJS} ${LIBS}
! 	-/bin/rm attach.old
  
  attach_saber:
  	#unsetopt win_io
--- 67,73 ----
  attach: ${OBJS}
  	-/bin/mv -f attach attach.old
  	${LD} ${LFLAGS} -o attach ${OBJS} ${LIBS}
! 	-/bin/rm -f attach.old
  
  attach_saber:
  	#unsetopt win_io

*** /tmp/,RCSt1a04887	Mon Jun 17 15:16:54 1991
--- afs.c	Mon Nov 27 10:40:09 1989
***************
*** 157,162 ****
--- 157,168 ----
  	}
  	
  	if (unlink(at->mntpt)) {
+               if (errno == ENOENT) {
+                       fprintf(stderr,
+                               "%s: already detached, continuing....\n",
+                               at->hesiodname);
+                       return(SUCCESS);
+               }
  		perror(at->mntpt);
  		fprintf(stderr, "Couldn't detach afs filesystem %s.\n",
  			at->hesiodname);
*** /tmp/,RCSt1a04887	Mon Jun 17 15:16:56 1991
--- attach.h	Sat Feb 24 11:06:15 1990
***************
*** 17,22 ****
--- 17,25 ----
  #include <sys/types.h>
  #include <sys/time.h>
  #ifdef NFS
+ #ifdef BSD44
+ #include <nfs/nfsv2.h>
+ #endif
  #include <rpc/rpc.h>
  #include <nfs/nfs.h>
  #ifdef NeXT
*** /tmp/,RCSt1a04887	Mon Jun 17 15:16:57 1991
--- config.h	Sat Feb 24 11:36:25 1990
***************
*** 23,36 ****
   * kerberos libraries.
   */
  #define NFS
- #define RVD
  #define AFS
  #define UFS
  #define ZEPHYR
  #define HESIOD
  #define KERBEROS
! #define OLD_KERBEROS
! /* #undef NEED_STRTOK */
  
  /*
   * Other external filenames
--- 23,35 ----
   * kerberos libraries.
   */
  #define NFS
  #define AFS
  #define UFS
  #define ZEPHYR
  #define HESIOD
  #define KERBEROS
! /* #define OLD_KERBEROS */
! #undef NEED_STRTOK
  
  /*
   * Other external filenames
***************
*** 113,115 ****
--- 112,130 ----
  #define DEFPGTHRESH	64	/* default page threshhold */
  
  #endif /* ultrix compat stuff */
+ #ifdef BSD44
+ /* again, a convenience placeholder */
+ struct mntent {
+     char *mnt_fsname;
+     char *mnt_dir;
+     char *mnt_type;
+     char *mnt_opts;
+     int mnt_freq;
+     int mnt_passno;
+ };
+ 
+ #define	MNTTYPE_NFS	"nfs"
+ #define	MNTTYPE_42	"ufs"
+ #define	MNTTYPE_IGNORE	"ign"
+ 
+ #endif
*** /tmp/,RCSt1a04887	Mon Jun 17 15:16:57 1991
--- mount.c	Sat Feb 24 11:38:39 1990
***************
*** 14,27 ****
   */
  
  #ifndef lint
! static char rcsid_mount_c[] = "$Header: /u2/source/attach/RCS/mount.c,v 1.1 90/02/24 11:09:43 jtkohl Exp Locker: jtkohl $";
  #endif lint
  
  #include "attach.h"
  #include <sys/param.h>
! #ifndef ultrix
  #include <mntent.h>
  #endif
  #include <rpcsvc/mount.h>
  
  extern int sys_nerr;
--- 14,30 ----
   */
  
  #ifndef lint
! static char rcsid_mount_c[] = "$Header: /u2/scratch/attach/RCS/mount.c,v 1.1 90/02/24 11:09:43 jtkohl Exp Locker: jtkohl $";
  #endif lint
  
  #include "attach.h"
  #include <sys/param.h>
! #if !defined(ultrix) && !defined(BSD44)
  #include <mntent.h>
  #endif
+ #ifdef BSD44
+ #include <fstab.h>
+ #endif
  #include <rpcsvc/mount.h>
  
  extern int sys_nerr;
***************
*** 89,95 ****
  		return (FAILURE);
  	} 
  
! #ifndef ultrix
  	addtomtab(&mnt);
  #endif /* !ultrix */
  	return (SUCCESS);
--- 92,98 ----
  		return (FAILURE);
  	} 
  
! #if !defined(ultrix) && !defined(BSD44)
  	addtomtab(&mnt);
  #endif /* !ultrix */
  	return (SUCCESS);
***************
*** 120,125 ****
--- 123,131 ----
  	int errorout;
  {
  	static struct fhstatus fhs;
+ #ifdef BSD44
+ 	static nfsv2fh_t v2fh;
+ #endif
  	static struct sockaddr_in sin;
  	struct timeval timeout;
  	CLIENT *client;
***************
*** 203,209 ****
--- 209,220 ----
  
  	*args = mopt->tsa.nfs;
  	args->hostname = at->host;
+ #ifdef BSD44
+ 	v2fh.fh_generic = fhs.fhs_fh;
+ 	args->fh = &v2fh;
+ #else
  	args->fh = &fhs.fhs_fh;
+ #endif
  	args->flags |= NFSMNT_HOSTNAME;
  	if (mopt->nfs_port)
  		sin.sin_port = mopt->nfs_port;
***************
*** 241,246 ****
--- 252,295 ----
  		return(0);
  }
  
+ #ifdef BSD44
+ mounted(mntck)
+ struct mntent *mntck;
+ {
+     long mntsize;
+     register int i;
+     struct statfs statfsbuf, *mntbuf;
+     if ((mntsize = getfsstat(0, 0)) < 0) {
+ 	perror("mount");
+ 	exit(1);
+     }
+     mntbuf = 0;
+     do {
+ 	if (mntbuf)
+ 	    free(mntbuf);
+ 	i = (mntsize + 1) * sizeof(struct statfs);
+ 	if ((mntbuf = (struct statfs *)malloc(i)) == 0) {
+ 	    fprintf(stderr,
+ 		    "no space for mount table buffer\n");
+ 	    exit(ERR_FATAL);
+ 	}
+ 	if ((mntsize = getfsstat(mntbuf, i)) < 0) {
+ 	    perror("attach getfsstat");
+ 	    exit(ERR_FATAL);
+ 	}
+     } while (i == mntsize * sizeof(struct statfs));
+     for (i = 0; i < mntsize; i++) {
+ 	if (!strcmp(mntbuf[i].f_mntonname, mntck->mnt_dir) &&
+ 	    !strcmp(mntbuf[i].f_mntfromname, mntck->mnt_fsname)) {
+ 	    free(mntbuf);
+ 	    return 1;
+ 	}
+     }
+     free(mntbuf);
+     return 0;
+ }
+ 
+ #else /* ! BSD44 */
  #ifdef ultrix
  mounted(mntck)
      struct mntent *mntck;
***************
*** 320,322 ****
--- 369,372 ----
  }
  
  #endif /* ultrix */
+ #endif /* BSD44 */
*** /tmp/,RCSt1a04887	Mon Jun 17 15:16:58 1991
--- rvdlib.h	Mon Dec 11 12:32:40 1989
***************
*** 37,45 ****
  #define RVD_GETM "/etc/athena/rvdgetm","rvdgetm"
  #define RVD_GETMOTD "operation=get_message\n"
  
! #define vdnam(_d_,_n_)	((char *)sprintf((_d_),"/dev/vd%da",(_n_)))
  
! #define rvdnam(_d_,_n_)	((char *)sprintf((_d_),"/dev/rvd%da",(_n_)))
  
  #define VDCONTROL "/dev/rvdcontrol"
  #endif
--- 37,45 ----
  #define RVD_GETM "/etc/athena/rvdgetm","rvdgetm"
  #define RVD_GETMOTD "operation=get_message\n"
  
! #define vdnam(_d_,_n_)        (((void)sprintf((_d_),"/dev/vd%da",(_n_))),_d_)
  
! #define rvdnam(_d_,_n_)       (((void)sprintf((_d_),"/dev/rvd%da",(_n_))),_d_)
  
  #define VDCONTROL "/dev/rvdcontrol"
  #endif
*** /tmp/,RCSt1a04887	Mon Jun 17 15:16:59 1991
--- unmount.c	Sat Feb 24 11:42:08 1990
***************
*** 12,26 ****
   */
  
  #ifndef lint
! static char rcsid_mount_c[] = "$Header: /u2/source/attach/RCS/unmount.c,v 1.1 90/02/24 11:37:10 jtkohl Exp Locker: jtkohl $";
  #endif lint
  
  #include "attach.h"
  #include <sys/file.h>
  #include <sys/param.h>
  #ifndef ultrix
  #include <mntent.h>
  #endif
  #include <rpcsvc/mount.h>
  
  /*
--- 12,30 ----
   */
  
  #ifndef lint
! static char rcsid_mount_c[] = "$Header: /u2/scratch/attach/RCS/unmount.c,v 1.1 90/02/24 11:37:10 jtkohl Exp Locker: jtkohl $";
  #endif lint
  
  #include "attach.h"
  #include <sys/file.h>
  #include <sys/param.h>
+ #ifdef BSD44
+ #include <fstab.h>
+ #else
  #ifndef ultrix
  #include <mntent.h>
  #endif
+ #endif
  #include <rpcsvc/mount.h>
  
  /*
***************
*** 57,63 ****
  /* this hack to avoid ugly ifdef's */
  #define unmount(x) umount(fsdata.fd_dev)
  #endif /* ultrix */
! 
      if (unmount(mntpt) < 0) {
  	if (errno == EINVAL) {
  		fprintf(stderr,
--- 61,69 ----
  /* this hack to avoid ugly ifdef's */
  #define unmount(x) umount(fsdata.fd_dev)
  #endif /* ultrix */
! #ifdef BSD44
! #define unmount(x) umount(x, 0)
! #endif
      if (unmount(mntpt) < 0) {
  	if (errno == EINVAL) {
  		fprintf(stderr,
***************
*** 71,77 ****
  	}
      }
  
! #ifdef ultrix
  #undef unmount
      return(SUCCESS);
  #else /* !ultrix */
--- 77,83 ----
  	}
      }
  
! #if defined(ultrix) || defined(BSD44)
  #undef unmount
      return(SUCCESS);
  #else /* !ultrix */

home help back first fref pref prev next nref lref last post