#ifdef AFS_DARWIN_ENV
#ifdef AFS_DARWIN80_ENV
#include <sys/ioctl.h>
+#include <sys/xattr.h>
#endif
#include <mach/mach.h>
#ifndef AFS_DARWIN100_ENV
static int preallocs = 400; /* Def # of allocated memory blocks */
static int enable_peer_stats = 0; /* enable rx stats */
static int enable_process_stats = 0; /* enable rx stats */
-#ifdef AFS_AFSDB_ENV
static int enable_afsdb = 0; /* enable AFSDB support */
-#endif
static int enable_dynroot = 0; /* enable dynroot support */
static int enable_fakestat = 0; /* enable fakestat support */
static int enable_backuptree = 0; /* enable backup tree support */
return (0);
}
+static void
+SetNoBackupAttr(char *fullpn)
+{
+#ifdef AFS_DARWIN80_ENV
+ int ret;
+
+ ret = setxattr(fullpn, "com.apple.metadata:com_apple_backup_excludeItem",
+ "com.apple.backupd", strlen("com.apple.backupd"), 0,
+ XATTR_CREATE);
+ if(ret < 0)
+ {
+ if(errno != EEXIST)
+ fprintf(stderr, "afsd: Warning: failed to set attribute to preclude cache backup: %s\n", strerror(errno));
+ }
+#endif
+ return;
+}
+
static int
MoveCacheFile(char *basename, int fromDir, int toDir, int cacheFile,
int maxDir)
from, to, ret, errno);
return -1;
}
+ SetNoBackupAttr(to);
/* Reset directory pointer; fix file counts */
dir_for_V[cacheFile] = toDir;
* Found the file holding the dcache entries.
*/
missing_DCacheFile = 0;
+ SetNoBackupAttr(fullpn_DCacheFile);
} else if (dirNum < 0 && strcmp(currp->d_name, VOLINFOFILE) == 0) {
/*
* Found the file holding the volume info.
*/
missing_VolInfoFile = 0;
+ SetNoBackupAttr(fullpn_VolInfoFile);
} else if (dirNum < 0 && strcmp(currp->d_name, CELLINFOFILE) == 0) {
/*
* Found the file holding the cell info.
*/
missing_CellInfoFile = 0;
+ SetNoBackupAttr(fullpn_CellInfoFile);
} else if ((strcmp(currp->d_name, ".") == 0)
|| (strcmp(currp->d_name, "..") == 0) ||
#ifdef AFS_DECOSF_ENV
cache_dir_list[thisDir]++;
(*vFilesFound)++;
}
+ SetNoBackupAttr(fullpn_VFile);
}
} else if (dir_for_V[vFileNum] >= maxDir
return 0;
}
-#ifdef AFS_AFSDB_ENV
static void
AfsdbLookupHandler(void)
{
#endif
exit(1);
}
-#endif
#ifdef mac2
#include <sys/ioctl.h>
static char rn[] = "afsd"; /*Name of this routine */
afs_int32 code; /*Result of fork() */
int i;
-#ifndef AFS_CACHE_VNODE_PATH
int currVFile; /*Current AFS cache file number passed in */
-#endif
int mountFlags; /*Flags passed to mount() */
int lookupResult; /*Result of GetLocalCellName() */
int cacheIteration; /*How many times through cache verification */
}
if (as->parms[23].items) {
/* -mem_alloc_sleep */
- cacheFlags |= AFSCALL_INIT_MEMCACHE_SLEEP;
+ printf("afsd: -mem_alloc_sleep is deprecated -- ignored\n");
}
if (as->parms[24].items) {
/* -afsdb */
-#ifdef AFS_AFSDB_ENV
enable_afsdb = 1;
-#else
- printf("afsd: No AFSDB support; ignoring -afsdb");
-#endif
}
if (as->parms[25].items) {
/* -files_per_subdir */
}
#endif
-#ifdef AFS_AFSDB_ENV
if (enable_afsdb) {
if (afsd_verbose)
printf("%s: Forking AFSDB lookup handler.\n", rn);
exit(1);
}
}
-#endif
code = call_syscall(AFSOP_BASIC_INIT, 1);
if (code) {
rn, vFilesFound, cacheFiles, cacheIteration);
} while ((vFilesFound < cacheFiles)
&& (cacheIteration < MAX_CACHE_LOOPS));
-#ifdef AFS_CACHE_VNODE_PATH
- if (afsd_debug)
- printf
- ("%s: Calling AFSOP_CACHEBASEDIR with '%s'\n",
- rn, cacheBaseDir);
- call_syscall(AFSOP_CACHEBASEDIR, cacheBaseDir);
- if (afsd_debug)
- printf
- ("%s: Calling AFSOP_CACHEDIRS with %d dirs\n",
- rn, nFilesPerDir);
- call_syscall(AFSOP_CACHEDIRS, nFilesPerDir);
- if (afsd_debug)
- printf
- ("%s: Calling AFSOP_CACHEFILES with %d files\n",
- rn, cacheFiles);
- call_syscall(AFSOP_CACHEFILES, cacheFiles);
-#endif
} else if (afsd_verbose)
printf("%s: Using memory cache, not swept\n", rn);
if (!(cacheFlags & AFSCALL_INIT_MEMCACHE))
call_syscall(AFSOP_VOLUMEINFO, fullpn_VolInfoFile);
-#ifndef AFS_CACHE_VNODE_PATH
/*
* Give the kernel the names of the AFS files cached on the workstation's
* disk.
*/
if (afsd_debug)
printf
- ("%s: Calling AFSOP_CACHEINODE for each of the %d files in '%s'\n",
+ ("%s: Calling AFSOP_CACHEFILE for each of the %d files in '%s'\n",
rn, cacheFiles, cacheBaseDir);
- if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)) /* ... and again ... */
+ if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)) {
+ /* ... and again ... */
+ int nocachefile = 0;
for (currVFile = 0; currVFile < cacheFiles; currVFile++) {
+ if (!nocachefile) {
+ sprintf(fullpn_VFile, "%s/D%d/V%d", cacheBaseDir, dir_for_V[currVFile], currVFile);
+ code = call_syscall(AFSOP_CACHEFILE, fullpn_VFile);
+ if (code) {
+ if (currVFile == 0) {
+ if (afsd_debug)
+ printf
+ ("%s: Calling AFSOP_CACHEINODE for each of the %d files in '%s'\n",
+ rn, cacheFiles, cacheBaseDir);
+ nocachefile = 1;
+ } else {
+ printf
+ ("%s: Error calling AFSOP_CACHEFILE for '%s'\n",
+ rn, fullpn_VFile);
+ exit(1);
+ }
+ } else {
+ continue;
+ }
+ /* fall through to setup-by-inode */
+ }
#ifdef AFS_SGI62_ENV
call_syscall(AFSOP_CACHEINODE,
(afs_uint32) (inode_for_V[currVFile] >> 32),
(afs_uint32) (inode_for_V[currVFile] & 0xffffffff));
-#else
-#if defined(LINUX_USE_FH)
- sprintf(fullpn_VFile, "%s/D%d/V%d", cacheBaseDir, dir_for_V[currVFile], currVFile);
- call_syscall(AFSOP_CACHEFILE, fullpn_VFile);
-#else
+#elif !(defined(LINUX_USE_FH) || defined(AFS_CACHE_VNODE_PATH))
call_syscall(AFSOP_CACHEINODE, inode_for_V[currVFile]);
-#endif
+#else
+ printf
+ ("%s: Error calling AFSOP_CACHEINODE: not configured\n",
+ rn);
+ exit(1);
#endif
}
-#endif
-
+ }
/*end for */
/*
* All the necessary info has been passed into the kernel to run an AFS
"Collect rpc statistics for this process");
cmd_AddParm(ts, "-mem_alloc_sleep", CMD_FLAG, (CMD_OPTIONAL | CMD_HIDE),
"Allow sleeps when allocating memory cache");
- cmd_AddParm(ts, "-afsdb", CMD_FLAG, (CMD_OPTIONAL
-#ifndef AFS_AFSDB_ENV
- | CMD_HIDE
-#endif
- ), "Enable AFSDB support");
+ cmd_AddParm(ts, "-afsdb", CMD_FLAG, (CMD_OPTIONAL),
+ "Enable AFSDB support");
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,