* -cachedir The base directory for the workstation cache.
* -mountdir The directory on which the AFS is to be mounted.
* -confdir The configuration directory .
- * -nosettime Don't keep checking the time to avoid drift.
+ * -nosettime Don't keep checking the time to avoid drift (default).
+ * -settime Keep checking the time to avoid drift.
* -verbose Be chatty.
* -debug Print out additional debugging info.
* -kerndev [OBSOLETE] The kernel device for AFS.
#include <sys/time.h>
#include <dirent.h>
+
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#endif
#endif
+
#undef VIRTUE
#undef VICE
+
#define CACHEINFOFILE "cacheinfo"
#define AFSLOGFILE "AFSLog"
#define DCACHEFILE "CacheItems"
#define MAX_CACHE_LOOPS 4
+
/*
* Internet address (old style... should be updated). This was pulled out of the old 4.2
* version of <netinet/in.h>, since it's still useful.
/*
* Global configuration variables.
*/
+afs_int32 enable_rxbind = 0;
afs_int32 afs_shutdown = 0;
afs_int32 cacheBlocks; /*Num blocks in the cache */
afs_int32 cacheFiles = 1000; /*Optimal # of files in workstation cache */
int sawBiod = 0;
char cacheMountDir[1024]; /*Mount directory for AFS */
char rootVolume[64] = "root.afs"; /*AFS root volume name */
-afs_int32 cacheSetTime = 1; /*Keep checking time to avoid drift? */
+afs_int32 cacheSetTime = FALSE; /*Keep checking time to avoid drift? */
afs_int32 isHomeCell; /*Is current cell info for the home cell? */
#ifdef AFS_XBSD_ENV
int createAndTrunc = O_RDWR | O_CREAT | O_TRUNC; /*Create & truncate on open */
* Sets globals.
*---------------------------------------------------------------------------*/
-int
-ParseCacheInfoFile()
+int ParseCacheInfoFile(void)
{
static char rn[] = "ParseCacheInfoFile"; /*This routine's name */
FILE *cachefd; /*Descriptor for cache info file */
("\tcacheMountDir: '%s'\n\tcacheBaseDir: '%s'\n\tcacheBlocks: %d\n",
tmd, tbd, tCacheBlocks);
}
- if (!(cacheFlags & AFSCALL_INIT_MEMCACHE))
- PartSizeOverflow(tbd, cacheBlocks);
+ if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)) {
+ return(PartSizeOverflow(tbd, cacheBlocks));
+ }
return (0);
}
* isn't a mounted partition it's also ignored since we can't guarantee
* what will be stored afterwards. Too many if's. This is now purely
* advisory. ODS with over 2G partition also gives warning message.
+ *
+ * Returns:
+ * 0 if everything went well,
+ * 1 otherwise.
*/
-PartSizeOverflow(path, cs)
- char *path;
- int cs;
+int PartSizeOverflow(char *path, int cs)
{
int bsize = -1, totalblks, mint;
#if AFS_HAVE_STATVFS
}
totalblks = statbuf.f_blocks;
bsize = statbuf.f_frsize;
-#else
+#if AFS_AIX51_ENV
+ if(strcmp(statbuf.f_basetype, "jfs")) {
+ fprintf(stderr, "Cache filesystem '%s' must be jfs (now %s)\n",
+ path, statbuf.f_basetype);
+ return 1;
+ }
+#endif /* AFS_AIX51_ENV */
+
+#else /* AFS_HAVE_STATVFS */
struct statfs statbuf;
if (statfs(path, &statbuf) < 0) {
printf
("Cache size (%d) must be less than 95%% of partition size (which is %d). Lower cache size\n",
cs, mint);
+ return 1;
}
+
+ return 0;
}
/*-----------------------------------------------------------------------------
#endif
mainproc(as, arock)
- register struct cmd_syndesc *as;
+ struct cmd_syndesc *as;
char *arock;
{
static char rn[] = "afsd"; /*Name of this routine */
/* -chunksize */
chunkSize = atoi(as->parms[12].items->data);
if (chunkSize < 0 || chunkSize > 30) {
- printf("afsd:invalid chunk size spec'd, using default\n");
+ printf("afsd:invalid chunk size (not in range 0-30), using default\n");
chunkSize = 0;
}
}
/* -backuptree */
enable_backuptree = 1;
}
+ if (as->parms[31].items) {
+ /* -rxbind */
+ enable_rxbind = 1;
+ }
+ if (as->parms[32].items) {
+ /* -settime */
+ cacheSetTime = TRUE;
+ }
+ /* set rx_extraPackets */
+ if (as->parms[33].items) {
+ /* -rxpck */
+ int rxpck = atoi(as->parms[33].items->data);
+ printf("afsd: set rxpck = %d\n",rxpck);
+ code = call_syscall(AFSOP_SET_RXPCK, rxpck);
+ if (code) {
+ printf("afsd: failed to set rxpck\n");
+ exit(1);
+ }
+ }
+
/*
* Pull out all the configuration info for the workstation's AFS cache and
* the cellular community we're willing to let our users see.
parseNetFiles(addrbuf, maskbuf, mtubuf, MAXIPADDRS, reason,
AFSDIR_CLIENT_NETINFO_FILEPATH,
AFSDIR_CLIENT_NETRESTRICT_FILEPATH);
- if (code > 0)
+ if (code > 0) {
+ if (enable_rxbind)
+ code = code | 0x80000000;
call_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
- else
+ } else
printf("ADVISEADDR: Error in specifying interface addresses:%s\n",
reason);
}
printf("%s: Forking AFSDB lookup handler.\n", rn);
code = fork();
if (code == 0) {
+ /* Since the AFSDB lookup handler runs as a user process,
+ * need to drop the controlling TTY, etc.
+ */
+ if (daemon(0, 0) == -1) {
+ printf("Error starting AFSDB lookup handler: %s\n",
+ strerror(errno));
+ exit(1);
+ }
AfsdbLookupHandler();
exit(1);
}
if (afsd_debug)
printf("%s: Calling AFSOP_VOLUMEINFO: volume info file is '%s'\n", rn,
fullpn_VolInfoFile);
- call_syscall(AFSOP_VOLUMEINFO, fullpn_VolInfoFile);
+ /* once again, meaningless for a memory-based cache. */
+ if (!(cacheFlags & AFSCALL_INIT_MEMCACHE))
+ call_syscall(AFSOP_VOLUMEINFO, fullpn_VolInfoFile);
/*
* Pass the kernel the name of the afs logging file holding the volume
if (afsd_verbose)
printf("%s: Mounting the AFS root on '%s', flags: %d.\n", rn,
cacheMountDir, mountFlags);
-#ifdef AFS_DEC_ENV
- if ((mount("AFS", cacheMountDir, mountFlags, GT_AFS, (caddr_t) 0)) <
- 0) {
-#else
#ifdef AFS_FBSD_ENV
if ((mount("AFS", cacheMountDir, mountFlags, (caddr_t) 0)) < 0) {
-#else
-#ifdef AFS_AUX_ENV
- if ((fsmount(MOUNT_AFS, cacheMountDir, mountFlags, (caddr_t) 0)) < 0) {
-#else
-#ifdef AFS_AIX_ENV
+#elif defined(AFS_AIX_ENV)
if (aix_vmount()) {
-#else
-#if defined(AFS_HPUX100_ENV)
+#elif defined(AFS_HPUX100_ENV)
if ((mount("", cacheMountDir, mountFlags, "afs", NULL, 0)) < 0) {
-#else
-#ifdef AFS_HPUX_ENV
-#if defined(AFS_HPUX90_ENV)
- {
- char buffer[80];
- int code;
-
- strcpy(buffer, "afs");
- code = vfsmount(-1, cacheMountDir, mountFlags, (caddr_t) buffer);
- sscanf(buffer, "%d", &vfs1_type);
- if (code < 0) {
- printf
- ("Can't find 'afs' type in the registered filesystem table!\n");
- exit(1);
- }
- sscanf(buffer, "%d", &vfs1_type);
- if (afsd_verbose)
- printf("AFS vfs slot number is %d\n", vfs1_type);
- }
- if ((vfsmount(vfs1_type, cacheMountDir, mountFlags, (caddr_t) 0)) < 0) {
-#else
- if (call_syscall
- (AFSOP_AFS_VFSMOUNT, MOUNT_AFS, cacheMountDir, mountFlags,
- (caddr_t) NULL) < 0) {
-#endif
-#else
-#ifdef AFS_SUN5_ENV
+#elif defined(AFS_SUN5_ENV)
if ((mount("AFS", cacheMountDir, mountFlags, "afs", NULL, 0)) < 0) {
-#else
-#if defined(AFS_SGI_ENV)
+#elif defined(AFS_SGI_ENV)
mountFlags = MS_FSS;
if ((mount(MOUNT_AFS, cacheMountDir, mountFlags, (caddr_t) MOUNT_AFS))
< 0) {
-#else
-#ifdef AFS_LINUX20_ENV
+#elif defined(AFS_LINUX20_ENV)
if ((mount("AFS", cacheMountDir, MOUNT_AFS, 0, NULL)) < 0) {
#else
/* This is the standard mount used by the suns and rts */
if ((mount(MOUNT_AFS, cacheMountDir, mountFlags, (caddr_t) 0)) < 0) {
-#endif /* AFS_LINUX20_ENV */
-#endif /* AFS_SGI_ENV */
-#endif /* AFS_SUN5_ENV */
-#endif /* AFS_HPUX100_ENV */
-#endif /* AFS_HPUX_ENV */
-#endif /* AFS_AIX_ENV */
-#endif /* AFS_AUX_ENV */
-#endif /* AFS_FBSD_ENV */
-#endif /* AFS_DEC_ENV */
+#endif
printf("%s: Can't mount AFS on %s(%d)\n", rn, cacheMountDir,
errno);
exit(1);
int argc;
char **argv;
{
- register struct cmd_syndesc *ts;
+ struct cmd_syndesc *ts;
ts = cmd_CreateSyntax(NULL, mainproc, NULL, "start AFS");
cmd_AddParm(ts, "-blocks", CMD_SINGLE, CMD_OPTIONAL,
cmd_AddParm(ts, "-nomount", CMD_FLAG, CMD_OPTIONAL, "Do not mount AFS");
cmd_AddParm(ts, "-backuptree", CMD_FLAG, CMD_OPTIONAL,
"Prefer backup volumes for mointpoints in backup volumes");
+ cmd_AddParm(ts, "-rxbind", CMD_FLAG, CMD_OPTIONAL, "Bind the Rx socket (one interface only)");
+ cmd_AddParm(ts, "-settime", CMD_FLAG, CMD_OPTIONAL,
+ "don't set the time");
+ cmd_AddParm(ts, "-rxpck", CMD_SINGLE, CMD_OPTIONAL, "set rx_extraPackets to this value");
return (cmd_Dispatch(argc, argv));
}
long eparm[4];
struct afsprocdata syscall_data;
int fd = open(PROC_SYSCALL_FNAME,O_RDWR);
-
+ if (fd < 0)
+ fd = open(PROC_SYSCALL_ARLA_FNAME,O_RDWR);
eparm[0] = param4;
eparm[1] = param5;
eparm[2] = param6;