Index: src/afsd/Makefile.in
===================================================================
RCS file: /cvs/openafs/src/afsd/Makefile.in,v
retrieving revision 1.6.2.2
diff -u -r1.6.2.2 Makefile.in
--- src/afsd/Makefile.in	2001/10/13 04:20:44	1.6.2.2
+++ src/afsd/Makefile.in	2002/11/09 14:18:02
@@ -52,6 +52,8 @@
 		${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} /usr/lib/libdwarf.a /usr/lib/libelf.a ;; \
 	sgi_64 | sgi_65 ) \
 		${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} /usr/lib32/libdwarf.a /usr/lib32/libelf.a ;; \
+	ppc_darwin* ) \
+		${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} -F/System/Library/PrivateFrameworks -framework DiskArbitration ;; \
 	* ) \
 		${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} ;; \
 	esac
Index: src/afsd/afsd.c
===================================================================
RCS file: /cvs/openafs/src/afsd/afsd.c,v
retrieving revision 1.13.2.10
diff -u -r1.13.2.10 afsd.c
--- src/afsd/afsd.c	2002/08/21 19:24:55	1.13.2.10
+++ src/afsd/afsd.c	2002/11/09 14:18:11
@@ -146,6 +146,27 @@
 #ifdef AFS_LINUX20_ENV
 #include <sys/resource.h>
 #endif
+#ifdef AFS_DARWIN_ENV
+#include <mach/mach.h>
+/* Relevant definitions from DiskArbitration.h (not included with Mac OS X) */
+#ifndef __DISKARBITRATION_H
+typedef char    DiskArbDiskIdentifier[1024];
+typedef char    DiskArbMountpoint[1024];
+kern_return_t   DiskArbStart(mach_port_t * portPtr);
+kern_return_t   DiskArbDiskAppearedWithMountpointPing_auto(
+    DiskArbDiskIdentifier diskIdentifier,
+    unsigned flags,
+    DiskArbMountpoint mountpoint);
+kern_return_t   DiskArbDiskDisappearedPing_auto(
+    DiskArbDiskIdentifier diskIdentifier,
+    unsigned flags);
+enum {
+    kDiskArbDiskAppearedNoFlags = 0x00000000,
+    kDiskArbDiskAppearedEjectableMask = 1 << 1,
+    kDiskArbDiskAppearedNetworkDiskMask = 1 << 3
+};
+#endif /* __DISKARBITRATION_H */
+#endif /* AFS_DARWIN_ENV */
 
 #ifndef MOUNT_AFS
 #define	MOUNT_AFS AFS_MOUNT_AFS
@@ -245,6 +266,7 @@
 #endif
 static int enable_dynroot = 0;		/* enable dynroot support */
 static int enable_fakestat = 0;		/* enable fakestat support */
+static int enable_nomount = 0;		/* do not mount */
 #ifdef notdef
 static int inodes = 60;		        /* VERY conservative, but has to be */
 #endif
@@ -1337,6 +1359,10 @@
 	/* -fakestat */
 	enable_fakestat = 1;
     }
+    if (as->parms[28].items) {
+	/* -nomount */
+	enable_nomount = 1;
+    }
 
     /*
      * Pull out all the configuration info for the workstation's AFS cache and
@@ -1794,6 +1820,8 @@
 	exit(1);
     }
 
+    if (!enable_nomount) {
+
     mountFlags = 0;	/* Read/write file system, can do setuid() */
 #if	defined(AFS_SUN_ENV) || defined(AFS_SUN5_ENV)
 #ifdef	AFS_SUN5_ENV
@@ -1876,6 +1904,8 @@
 
     HandleMTab();
 
+    }
+
     if (afsd_rmtsys) {
 	if (afsd_verbose)
 	    printf("%s: Forking 'rmtsys' daemon.\n", rn);
@@ -1938,6 +1968,7 @@
     cmd_AddParm(ts, "-files_per_subdir", CMD_SINGLE, CMD_OPTIONAL, "log(2) of the number of cache files per cache subdirectory");
     cmd_AddParm(ts, "-dynroot", CMD_FLAG, CMD_OPTIONAL, "Enable dynroot support");
     cmd_AddParm(ts, "-fakestat", CMD_FLAG, CMD_OPTIONAL, "Enable fakestat support");
+    cmd_AddParm(ts, "-nomount", CMD_FLAG, CMD_OPTIONAL, "Do not mount AFS");
     return (cmd_Dispatch(argc, argv));
 }
 
@@ -2011,7 +2042,20 @@
 #endif	/* AFS_SGI_ENV */
 #endif	/* AFS_SUN5_ENV */
 #endif	/* unreasonable systems */
+#ifdef AFS_DARWIN_ENV
+    mach_port_t diskarb_port;
+    kern_return_t status;
+
+    status = DiskArbStart(&diskarb_port);
+    if (status == KERN_SUCCESS) {
+	status = DiskArbDiskAppearedWithMountpointPing_auto("AFS",
+	             kDiskArbDiskAppearedNetworkDiskMask, cacheMountDir);
+    }
+
+    return status;
+#else
     return 0;
+#endif /* AFS_DARWIN_ENV */
 }
 
 #if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV)
