[6175] in Athena Bugs

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

attach patches for AIX 1.2

daemon@ATHENA.MIT.EDU (John Carr)
Sun Oct 7 14:11:25 1990

To: bugs@ATHENA.MIT.EDU
Date: Sun, 07 Oct 90 14:11:03 EDT
From: John Carr <jfc@ATHENA.MIT.EDU>


These patches are needed for attach to compile and work with AIX 1.2.  They
do not include changes for RVD support.

Changes:
	Replace "NFS" with "nfs" in some places (AIX mount is case
	sensitive).  This might break other operating systems.

	Fix the kerberos error message.

	Get correct include files.

	Conditional on _AIX, not AIX.

	unlink() may fail to remove a symlink.

	unmount() returns ENOTBLK when a non-mountpoint is the argument


*** rpc.c.71R	Mon Jul 16 09:21:30 1990
--- rpc.c	Thu Oct  4 16:13:46 1990
***************
*** 12,18 ****
--- 12,23 ----
  #ifdef NFS
  #include <sys/socket.h>
  #include <krb.h>
+ #ifdef _AIX
+ #include <rpc/rpcmount.h>
+ #include <rpc/nfsmount.h>
+ #else
  #include <rpcsvc/mount.h>
+ #endif
  #include <sys/param.h>
  
  extern bool_t	xdr_void();
***************
*** 320,328 ****
  		{
  		  fprintf(stderr, "%s: Could not get Kerberos ticket for filesystem %s\n",
  			  progname, errname);
! 		  fprintf(stderr, "%s: realm %s instance %s, kerberos error is: %s\n",
! 			  realm, instance,
! 			  krb_err_txt[status]);
  		}
  	    }
  	    error_status = ERR_KERBEROS;
--- 325,332 ----
  		{
  		  fprintf(stderr, "%s: Could not get Kerberos ticket for filesystem %s\n",
  			  progname, errname);
! 		  fprintf(stderr, "\trealm %s instance %s, kerberos error is: %s\n",
! 			  realm, instance, krb_err_txt[status]);
  		}
  	    }
  	    error_status = ERR_KERBEROS;
*** util.c.71R	Thu Aug 30 13:18:08 1990
--- util.c	Mon Oct  1 13:57:03 1990
***************
*** 1,12 ****
  /*	Created by:	Robert French
   *
   *	$Source: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/bin.athena/attach/RCS/util.c,v $
!  *	$Author: epeisach $
   *
   *	Copyright (c) 1988 by the Massachusetts Institute of Technology.
   */
  
! static char *rcsid_util_c = "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/bin.athena/attach/RCS/util.c,v 1.7 90/08/30 13:17:54 epeisach Exp $";
  
  #include "attach.h"
  #include <sys/file.h>
--- 1,12 ----
  /*	Created by:	Robert French
   *
   *	$Source: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/bin.athena/attach/RCS/util.c,v $
!  *	$Author: jfc $
   *
   *	Copyright (c) 1988 by the Massachusetts Institute of Technology.
   */
  
! static char *rcsid_util_c = "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/bin.athena/attach/RCS/util.c,v 1.6 90/07/16 07:25:04 jfc Exp $";
  
  #include "attach.h"
  #include <sys/file.h>
***************
*** 24,32 ****
  #define max(a,b) (((a) > (b)) ? (a) : (b))
  #endif
  
- extern int sys_nerr;
- extern char *sys_errlist[];
- 
  char exp_hesline[BUFSIZ];	/* Place to store explicit */
  char *exp_hesptr[2];		/* ``hesiod'' entry */
  char *abort_msg = "Operation aborted\n";
--- 24,29 ----
***************
*** 164,170 ****
  	    return (realhes);
      }
  
!     fsp = get_fs(filsys_type ? filsys_type : "NFS");
      if (!fsp)
  	return (NULL);
      if (!fsp->explicit) {
--- 161,167 ----
  	    return (realhes);
      }
  
!     fsp = get_fs(filsys_type ? filsys_type : "nfs");
      if (!fsp)
  	return (NULL);
      if (!fsp->explicit) {
***************
*** 988,993 ****
--- 985,992 ----
  int e;
  
  {
+   extern int sys_nerr;
+ 
    if(e < sys_nerr)
      return sys_errlist[e];
    else
*** unmount.c.71R	Mon Jul 16 09:21:36 1990
--- unmount.c	Mon Oct  1 14:02:46 1990
***************
*** 19,27 ****
  #ifndef ultrix
  #include <mntent.h>
  #endif
  #include <rpcsvc/mount.h>
- #ifdef AIX
- #define unmount(x) umount(x)
  #endif
  /*
   * Unmount a filesystem.
--- 19,30 ----
  #ifndef ultrix
  #include <mntent.h>
  #endif
+ #ifdef _AIX
+ #include <rpc/nfsmount.h>
+ #include <rpc/rpcmount.h>
+ #define	unmount(x) umount(x)
+ #else
  #include <rpcsvc/mount.h>
  #endif
  /*
   * Unmount a filesystem.
***************
*** 59,65 ****
  #endif /* ultrix */
  
      if (unmount(mntpt) < 0) {
! 	if (errno == EINVAL || errno == ENOENT) {
  		fprintf(stderr,
  			"%s: Directory %s appears to already be unmounted\n",
  			errname, mntpt);
--- 62,72 ----
  #endif /* ultrix */
  
      if (unmount(mntpt) < 0) {
! 	if (errno == EINVAL || errno == ENOENT
! #ifdef _AIX
! 	    || errno == ENOTBLK
! #endif
! 	    ) {
  		fprintf(stderr,
  			"%s: Directory %s appears to already be unmounted\n",
  			errname, mntpt);
*** nfs.c.71R	Mon Jul 16 09:21:26 1990
--- nfs.c	Mon Oct  1 13:57:24 1990
***************
*** 195,201 ****
  		    sprintf(newmntpt, "%s/%s%s", nfs_mount_dir, temp, dir);
      }
      
!     sprintf(exp_hesline, "NFS %s %s %c %s", dir, host, override_mode ?
  	    override_mode : 'w',mntpt ? mntpt : newmntpt);
      exp_hesptr[0] = exp_hesline;
      exp_hesptr[1] = 0;
--- 195,201 ----
  		    sprintf(newmntpt, "%s/%s%s", nfs_mount_dir, temp, dir);
      }
      
!     sprintf(exp_hesline, "nfs %s %s %c %s", dir, host, override_mode ?
  	    override_mode : 'w',mntpt ? mntpt : newmntpt);
      exp_hesptr[0] = exp_hesline;
      exp_hesptr[1] = 0;
*** mount.c.71R	Mon Jul 16 09:21:25 1990
--- mount.c	Mon Oct  1 13:29:01 1990
***************
*** 20,29 ****
  #ifndef ultrix
  #include <mntent.h>
  #endif
! #ifdef AIX
  #include <sys/dstat.h>
! #endif
  #include <rpcsvc/mount.h>
  #ifdef _AUX_SOURCE
  #define	mount(type,dir,flags,data)	fsmount(type,dir,flags,data)
  #endif
--- 20,32 ----
  #ifndef ultrix
  #include <mntent.h>
  #endif
! #ifdef _AIX
  #include <sys/dstat.h>
! #include <rpc/rpcmount.h>
! #include <rpc/nfsmount.h>
! #else
  #include <rpcsvc/mount.h>
+ #endif
  #ifdef _AUX_SOURCE
  #define	mount(type,dir,flags,data)	fsmount(type,dir,flags,data)
  #endif
***************
*** 52,64 ****
  
  	mnt.mnt_fsname = fsname;
  	mnt.mnt_dir = at->mntpt;
! #ifndef ultrix
  	mnt.mnt_type = (at->fs->mount_type==MOUNT_NFS) ? MNTTYPE_NFS
  		: MNTTYPE_42;
  #endif
  	mnt.mnt_opts = stropt(*mopt);
  	mnt.mnt_freq = 0;
  	mnt.mnt_passno = 0;
  	
  	bzero(&data, sizeof(data));
  	/* Already mounted? Why lose? */
--- 55,72 ----
  
  	mnt.mnt_fsname = fsname;
  	mnt.mnt_dir = at->mntpt;
! #if !defined(_AIX) && !defined(ultrix)
  	mnt.mnt_type = (at->fs->mount_type==MOUNT_NFS) ? MNTTYPE_NFS
  		: MNTTYPE_42;
  #endif
  	mnt.mnt_opts = stropt(*mopt);
  	mnt.mnt_freq = 0;
+ #ifdef _AIX
+ 	mnt.mnt_type = at->fs->name;
+ 	mnt.mnt_checkno = 0;
+ #else
  	mnt.mnt_passno = 0;
+ #endif
  	
  	bzero(&data, sizeof(data));
  	/* Already mounted? Why lose? */
*** main.c.71R	Fri Jul 20 14:50:33 1990
--- main.c	Mon Oct  1 13:56:34 1990
***************
*** 61,67 ****
  struct _fstypes fstypes[] = {
      { "---", 0, -1, 0, (char *) 0, 0, null_detach, 0 },	/* The null type */
  #ifdef NFS
!     { "NFS", TYPE_NFS, MOUNT_NFS, FS_MNTPT | FS_REMOTE | FS_MNTPT_CANON, "rwnm",
  	      nfs_attach, nfs_detach, nfs_explicit },
  #endif
  #ifdef RVD
--- 61,67 ----
  struct _fstypes fstypes[] = {
      { "---", 0, -1, 0, (char *) 0, 0, null_detach, 0 },	/* The null type */
  #ifdef NFS
!     { "nfs", TYPE_NFS, MOUNT_NFS, FS_MNTPT | FS_REMOTE | FS_MNTPT_CANON, "rwnm",
  	      nfs_attach, nfs_detach, nfs_explicit },
  #endif
  #ifdef RVD
***************
*** 146,152 ****
  #ifdef KERBEROS
      if (!strcmp(progname, NFSID_CMD))
        {
! 	filsys_type = "NFS";
  	exit(nfsidcmd(argc, argv));
        } else if(!strcmp(progname, FSID_CMD)) {
  	exit(nfsidcmd(argc, argv));
--- 146,152 ----
  #ifdef KERBEROS
      if (!strcmp(progname, NFSID_CMD))
        {
! 	filsys_type = "nfs";
  	exit(nfsidcmd(argc, argv));
        } else if(!strcmp(progname, FSID_CMD)) {
  	exit(nfsidcmd(argc, argv));
*** afs.c.71R	Fri Jul 20 15:38:23 1990
--- afs.c	Mon Oct  1 14:33:25 1990
***************
*** 95,101 ****
  					error_status = ERR_ATTACHINUSE;
  					return(FAILURE);
  				}
! 				if (unlink(at->mntpt)) {
  					fprintf(stderr,
  	"%s: Couldn't remove existing symlink from %s to %s: %s\n",
  			at->hesiodname, at->mntpt, buf, sys_errlist[errno]);
--- 95,105 ----
  					error_status = ERR_ATTACHINUSE;
  					return(FAILURE);
  				}
! 				if (unlink(at->mntpt) == -1
! #ifdef _AIX
! 				    && rmslink(at->mntpt) == -1
! #endif
! 				    ) {
  					fprintf(stderr,
  	"%s: Couldn't remove existing symlink from %s to %s: %s\n",
  			at->hesiodname, at->mntpt, buf, sys_errlist[errno]);
***************
*** 258,263 ****
--- 262,268 ----
  }
  
  int afs_auth(hesname, afsdir)
+ 	const char *hesname, *afsdir;
  {
      return(afs_auth_internal(hesname, afsdir, AFSAUTH_DOAUTH));
  }
***************
*** 296,302 ****
    if(at->flags & FLAG_PERMANENT)
      return SUCCESS;
       
!   if(unlink(at->mntpt) == -1)
      {
        if(errno == ENOENT)
  	{
--- 301,311 ----
    if(at->flags & FLAG_PERMANENT)
      return SUCCESS;
       
!   if(unlink(at->mntpt) == -1
! #ifdef _AIX
!      && rmslink(at->mntpt) == -1
! #endif
!      )
      {
        if(errno == ENOENT)
  	{
*** config.h.71R	Thu Aug 30 13:17:21 1990
--- config.h	Wed Aug 15 19:10:57 1990
***************
*** 1,8 ****
  /*
   * Contains the local configuration information for attach/detach/nfsid
   *	$Source: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/bin.athena/attach/RCS/config.h,v $
!  *	$Author: epeisach $
!  *	$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/bin.athena/attach/RCS/config.h,v 1.5 90/08/30 13:17:10 epeisach Exp $
   */
  
  /*
--- 1,8 ----
  /*
   * Contains the local configuration information for attach/detach/nfsid
   *	$Source: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/bin.athena/attach/RCS/config.h,v $
!  *	$Author: probe $
!  *	$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/bin.athena/attach/RCS/config.h,v 1.4 90/07/20 14:50:14 probe Exp $
   */
  
  /*
***************
*** 24,47 ****
   */
  #define NFS
  #define AFS
! #if !defined(AIX) && !defined(_AUX_SOURCE)
  #define	RVD
  #define UFS
  #endif
- /* hack, we don't have the necessary header files yet */
- #ifdef ultrix
- #undef RVD
- #endif
  #define ZEPHYR
  #define HESIOD
  #define KERBEROS
  
- #ifdef AIX
- #define	_BSD
- #define	BSD
- #define	BSD_INCLUDES
- #endif
- 
  /*
   * Other external filenames
   */
--- 24,37 ----
   */
  #define NFS
  #define AFS
! #if !defined(_AIX) && !defined(_AUX_SOURCE)
  #define	RVD
  #define UFS
  #endif
  #define ZEPHYR
  #define HESIOD
  #define KERBEROS
  
  /*
   * Other external filenames
   */
***************
*** 51,57 ****
  #define MTAB		"/etc/mtab"
  #define FSCK_FULLNAME "/etc/fsck"
  #define FSCK_SHORTNAME "fsck"
! #define AKLOG_FULLNAME "/afs/athena.mit.edu/service/aklog"
  #define AKLOG_SHORTNAME "aklog"
  #define RVDGETM_FULLNAME "/etc/athena/rvdgetm"
  #define RVDGETM_SHORTNAME "rvdgetm"
--- 41,47 ----
  #define MTAB		"/etc/mtab"
  #define FSCK_FULLNAME "/etc/fsck"
  #define FSCK_SHORTNAME "fsck"
! #define AKLOG_FULLNAME "/bin/athena/aklog"
  #define AKLOG_SHORTNAME "aklog"
  #define RVDGETM_FULLNAME "/etc/athena/rvdgetm"
  #define RVDGETM_SHORTNAME "rvdgetm"
*** Imakefile.71R	Thu Aug 30 13:16:36 1990
--- Imakefile	Wed Aug 15 19:31:00 1990
***************
*** 6,15 ****
  CCFLG=
  CC=cc
  #endif
! #if defined(AIX) && defined(i386)
  CCFLG=-q
! CC=cc
  XLIBS=-L/usr/athena/lib -lbsd
  #endif
  #ifdef _AUX_SOURCE
  XSRCS = emul_re.c
--- 6,18 ----
  CCFLG=
  CC=cc
  #endif
! #if defined(i386)
  CCFLG=-q
! CC=/bin/acc
  XLIBS=-L/usr/athena/lib -lbsd
+ LRPC=
+ #else
+ LRPC=-lrpcsvc
  #endif
  #ifdef _AUX_SOURCE
  XSRCS = emul_re.c
***************
*** 25,36 ****
  DEFINES=
  
  INCLUDES= $(AFSINC) $(XINCLUDES)
! 
! #if defined(ultrix)
! LIBS = -lhesiod -lkrb -ldes -lzephyr -lcom_err $(XLIBS) $(AFSLIB)
! #else
! LIBS = -lhesiod -lkrb -ldes -lrpcsvc -lzephyr -lcom_err $(XLIBS) $(AFSLIB)
! #endif
  
  CFLAGS=$(CCFLG) $(DEFINES) $(INCLUDES) $(DEBUG)
  LDFLAGS= $(DEBUG) $(LDOPTS)
--- 28,34 ----
  DEFINES=
  
  INCLUDES= $(AFSINC) $(XINCLUDES)
! LIBS = -lhesiod -lkrb -ldes $(LRPC) -lzephyr -lcom_err $(XLIBS) $(AFSLIB)
  
  CFLAGS=$(CCFLG) $(DEFINES) $(INCLUDES) $(DEBUG)
  LDFLAGS= $(DEBUG) $(LDOPTS)

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