#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
+
#define VFS 1
#include <afs/cmd.h>
#include "afsd.h"
#include <assert.h>
-#include <potpourri.h>
#include <afs/afsutil.h>
#include <stdlib.h>
#include <stdio.h>
#include <mach/mach_port.h>
#include <mach/mach_interface.h>
#include <mach/mach_init.h>
-
-#include <CoreFoundation/CoreFoundation.h>
-
-#include <SystemConfiguration/SystemConfiguration.h>
-#include <SystemConfiguration/SCDynamicStore.h>
-
-#include <IOKit/pwr_mgt/IOPMLib.h>
-#include <IOKit/IOMessage.h>
-
-#include <dns_sd.h>
-
-typedef struct DNSSDState
-{
- DNSServiceRef service;
- CFRunLoopSourceRef source;
- CFSocketRef socket;
-} DNSSDState;
-
#endif /* AFS_DARWIN_ENV */
#ifndef MOUNT_AFS
#endif /* MOUNT_AFS */
#ifdef AFS_SGI65_ENV
+# include <sched.h>
# define SET_RTPRI(P) { \
struct sched_param sp; \
sp.sched_priority = P; \
#endif
error=syscall_data.retval;
}
+# elif defined(AFS_SUN511_ENV)
+ {
+ int rval;
+ rval = ioctl_sun_afs_syscall(AFSCALL_CALL, param1, param2, param3,
+ param4, param5, param6, &error);
+ if (rval) {
+ error = rval;
+ }
+ }
# else /* AFS_DARWIN80_ENV */
- error =
+ error =
syscall(AFS_SYSCALL, AFSCALL_CALL, param1, param2, param3, param4,
param5, param6, param7);
# endif /* !AFS_DARWIN80_ENV */
#define ROUNDUP(x) (((x) + 3) & ~3)
-aix_vmount()
+aix_vmount(const char *cacheMountDir)
{
struct vmount *vmountp;
int size, error;
#ifdef AFS_HPUX_ENV
#define MOUNTED_TABLE MNT_MNTTAB
#else
-#ifdef AFS_SUN5_ENV
-#define MOUNTED_TABLE MNTTAB
-#else
#define MOUNTED_TABLE MOUNTED
#endif
-#endif
static int
HandleMTab(char *cacheMountDir)
{
-#if (defined (AFS_SUN_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)) && !defined(AFS_SUN58_ENV)
+#if (defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV))
FILE *tfilep;
-#ifdef AFS_SUN5_ENV
- char tbuf[16];
- struct mnttab tmntent;
-
- memset(&tmntent, '\0', sizeof(struct mnttab));
- if (!(tfilep = fopen(MOUNTED_TABLE, "a+"))) {
- printf("Can't open %s\n", MOUNTED_TABLE);
- perror(MNTTAB);
- exit(-1);
- }
- tmntent.mnt_special = "AFS";
- tmntent.mnt_mountp = cacheMountDir;
- tmntent.mnt_fstype = "xx";
- tmntent.mnt_mntopts = "rw";
- sprintf(tbuf, "%ld", (long)time((time_t *) 0));
- tmntent.mnt_time = tbuf;
- putmntent(tfilep, &tmntent);
- fclose(tfilep);
-#else
#if defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)
struct mntent tmntent;
+ char *dir;
+ int i;
tfilep = setmntent("/etc/mtab", "a+");
+ if (!tfilep) {
+ printf("Can't open /etc/mtab for writing (errno %d); not adding "
+ "an entry for AFS\n", errno);
+ return 1;
+ }
+
+ dir = strdup(cacheMountDir);
+
+ /* trim trailing slashes; don't look at dir[0] in case we are somehow
+ * just "/" */
+ for (i = strlen(dir)-1; i > 0; i--) {
+ if (dir[i] == '/') {
+ dir[i] = '\0';
+ } else {
+ break;
+ }
+ }
+
tmntent.mnt_fsname = "AFS";
- tmntent.mnt_dir = cacheMountDir;
+ tmntent.mnt_dir = dir;
tmntent.mnt_type = "afs";
tmntent.mnt_opts = "rw";
tmntent.mnt_freq = 1;
tmntent.mnt_passno = 3;
addmntent(tfilep, &tmntent);
endmntent(tfilep);
+
+ free(dir);
+ dir = NULL;
#else
struct mntent tmntent;
addmntent(tfilep, &tmntent);
endmntent(tfilep);
#endif /* AFS_SGI_ENV */
-#endif /* AFS_SUN5_ENV */
#endif /* unreasonable systems */
#ifdef AFS_DARWIN_ENV
#ifndef AFS_DARWIN100_ENV
#elif defined(AFS_FBSD_ENV)
if ((mount("AFS", cacheMountDir, mountFlags, (caddr_t) 0)) < 0) {
#elif defined(AFS_AIX_ENV)
- if (aix_vmount()) {
+ if (aix_vmount(cacheMountDir)) {
#elif defined(AFS_HPUX100_ENV)
if ((mount("", cacheMountDir, mountFlags, "afs", NULL, 0)) < 0) {
#elif defined(AFS_SUN5_ENV)
}
int
+afsd_check_mount(const char *rn, const char *mountdir)
+{
+ struct stat statbuf;
+
+ if (stat(mountdir, &statbuf)) {
+ printf("%s: Mountpoint %s missing.\n", rn, mountdir);
+ return -1;
+ } else if (!S_ISDIR(statbuf.st_mode)) {
+ printf("%s: Mountpoint %s is not a directory.\n", rn, mountdir);
+ return -1;
+ }
+ return 0;
+}
+
+int
main(int argc, char **argv)
{
int code;