#ifdef AFS_LINUX22_ENV
#include "h/smp_lock.h"
#endif
-
+#ifdef AFS_SUN510_ENV
+#include "h/ksynch.h"
+#include "h/sunddi.h"
+#endif
#if defined(AFS_SUN5_ENV) || defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV)
#define AFS_MINBUFFERS 100
char afs_rootVolumeName[64] = "";
afs_uint32 rx_bindhost;
+#ifdef AFS_SUN510_ENV
+ddi_taskq_t *afs_taskq;
+krwlock_t afsifinfo_lock;
+#endif
+
afs_int32 afs_initState = 0;
afs_int32 afs_termState = 0;
afs_int32 afs_setTime = 0;
extern struct interfaceAddr afs_cb_interface;
static int afs_RX_Running = 0;
static int afs_InitSetup_done = 0;
+afs_int32 afs_numcachefiles = -1;
+afs_int32 afs_numfilesperdir = -1;
+char afs_cachebasedir[1024];
afs_int32 afs_rx_deadtime = AFS_RXDEADTIME;
afs_int32 afs_rx_harddead = AFS_HARDDEADTIME;
+afs_int32 afs_rx_idledead = AFS_IDLEDEADTIME;
static int afscall_set_rxpck_received = 0;
static int
afs_InitSetup(int preallocs)
{
- extern void afs_InitStats();
int code;
if (afs_InitSetup_done)
return EAGAIN;
+#ifdef AFS_SUN510_ENV
+ /* Initialize a RW lock for the ifinfo global array */
+ rw_init(&afsifinfo_lock, NULL, RW_DRIVER, NULL);
+
+ /* Create a taskq */
+ afs_taskq = ddi_taskq_create(NULL, "afs_taskq", 2, TASKQ_DEFAULTPRI, 0);
+
+ osi_StartNetIfPoller();
+#endif
+
#ifndef AFS_NOSTATS
/*
* Set up all the AFS statistics variables. This should be done
#if defined(AFS_LINUX24_ENV) && defined(COMPLETION_H_EXISTS)
struct afsd_thread_info {
-#if !defined(INIT_WORK_HAS_DATA)
+#if defined(AFS_LINUX26_ENV) && !defined(INIT_WORK_HAS_DATA)
struct work_struct tq;
#endif
unsigned long parm;
}
void
-#if !defined(INIT_WORK_HAS_DATA)
+#if defined(AFS_LINUX26_ENV) && !defined(INIT_WORK_HAS_DATA)
afsd_launcher(struct work_struct *work)
#else
afsd_launcher(void *rock)
#endif
{
-#if !defined(INIT_WORK_HAS_DATA)
+#if defined(AFS_LINUX26_ENV) && !defined(INIT_WORK_HAS_DATA)
struct afsd_thread_info *rock = container_of(work, struct afsd_thread_info, tq);
#endif
{
int code;
DECLARE_COMPLETION(c);
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX26_ENV)
+#if defined(INIT_WORK_HAS_DATA)
struct work_struct tq;
+#endif
#else
struct tq_struct tq;
#endif
}
#endif
-/* leaving as is, probably will barf if we add prototypes here since it's likely being called
-with partial list */
+static void
+wait_for_cachedefs(void) {
+#ifdef AFS_CACHE_VNODE_PATH
+ if (cacheDiskType != AFS_FCACHE_TYPE_MEM)
+ while ((afs_numcachefiles < 1) || (afs_numfilesperdir < 1) ||
+ (afs_cachebasedir[0] != '/')) {
+ printf("afs: waiting for cache parameter definitions\n");
+ afs_osi_Sleep(&afs_initState);
+ }
+#endif
+}
+
int
-afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6)
- long parm, parm2, parm3, parm4, parm5, parm6;
+afs_syscall_call(long parm, long parm2, long parm3, long parm4, long parm5, long parm6)
{
afs_int32 code = 0;
#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
#endif /* AFS_SGI61_ENV */
AFS_STATCNT(afs_syscall_call);
+ if (
#ifdef AFS_SUN5_ENV
- if (!afs_suser(CRED()) && (parm != AFSOP_GETMTU)
- && (parm != AFSOP_GETMASK)) {
- /* only root can run this code */
- return (EACCES);
+ !afs_suser(CRED())
#else
- if (!afs_suser(NULL) && (parm != AFSOP_GETMTU)
- && (parm != AFSOP_GETMASK)) {
+ !afs_suser(NULL)
+#endif
+ && (parm != AFSOP_GETMTU) && (parm != AFSOP_GETMASK)) {
/* only root can run this code */
+#if defined(AFS_OSF_ENV) || defined(AFS_SUN5_ENV) || defined(KERNEL_HAVE_UERROR)
#if defined(KERNEL_HAVE_UERROR)
setuerror(EACCES);
- return (EACCES);
+#endif
+ code = EACCES;
#else
-#if defined(AFS_OSF_ENV)
- return EACCES;
-#else /* AFS_OSF_ENV */
- return EPERM;
-#endif /* AFS_OSF_ENV */
+ code = EPERM;
#endif
+ AFS_GLOCK();
+#ifdef AFS_DARWIN80_ENV
+ put_vfs_context();
#endif
+ goto out;
}
AFS_GLOCK();
#ifdef AFS_DARWIN80_ENV
#endif /* RXK_LISTENER_ENV */
afs_osi_Invisible();
afs_RXCallBackServer();
+ afs_osi_Visible();
}
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
afs_osi_RxkRegister();
#endif /* !UKERNEL */
rxk_Listener();
+ afs_osi_Visible();
}
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
afs_osi_Wakeup(&afs_initState);
afs_osi_Invisible();
afs_Daemon();
+ afs_osi_Visible();
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
} else if (parm == AFSOP_START_CS) {
afs_osi_Invisible();
afs_CheckServerDaemon();
+ afs_osi_Visible();
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
else
#endif /* AFS_AIX32_ENV */
afs_BackgroundDaemon();
+ afs_osi_Visible();
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
/* start the bkg daemon */
afs_osi_Invisible();
afs_CacheTruncateDaemon();
+ afs_osi_Visible();
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
afs_osi_Sleep(&afs_initState);
afs_osi_Invisible();
afs_rxevent_daemon();
+ afs_osi_Visible();
#ifdef AFS_SGI_ENV
AFS_GUNLOCK();
exit(CLD_EXITED, 0);
afs_CacheInit(cparms.cacheScaches, cparms.cacheFiles,
cparms.cacheBlocks, cparms.cacheDcaches,
cparms.cacheVolumes, cparms.chunkSize,
- cparms.memCacheFlag, cparms.inodes, cparms.users);
+ cparms.memCacheFlag, cparms.inodes, cparms.users,
+ cparms.dynamic_vcaches);
} else if (parm == AFSOP_CACHEINODE) {
ino_t ainode = parm2;
afs_osi_Sleep(&afs_initState);
#ifdef AFS_DARWIN80_ENV
- get_vfs_context();
+ get_vfs_context();
#endif
/* do it by inode */
#ifdef AFS_SGI62_ENV
#endif
code = afs_InitCacheFile(NULL, ainode);
#ifdef AFS_DARWIN80_ENV
- put_vfs_context();
+ put_vfs_context();
#endif
+ } else if (parm == AFSOP_CACHEDIRS) {
+ afs_numfilesperdir = parm2;
+ afs_osi_Wakeup(&afs_initState);
+ } else if (parm == AFSOP_CACHEFILES) {
+ afs_numcachefiles = parm2;
+ afs_osi_Wakeup(&afs_initState);
} else if (parm == AFSOP_ROOTVOLUME) {
/* wait for basic init */
while (afs_initState < AFSOP_START_BKG)
code = 0;
} else if (parm == AFSOP_CACHEFILE || parm == AFSOP_CACHEINFO
|| parm == AFSOP_VOLUMEINFO || parm == AFSOP_AFSLOG
- || parm == AFSOP_CELLINFO) {
+ || parm == AFSOP_CELLINFO || parm == AFSOP_CACHEBASEDIR) {
char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
code = 0;
#ifdef AFS_DARWIN80_ENV
get_vfs_context();
#endif
- if (parm == AFSOP_CACHEFILE)
+ if (parm == AFSOP_CACHEBASEDIR) {
+ strncpy(afs_cachebasedir, tbuffer, 1024);
+ afs_cachebasedir[1023] = '\0';
+ afs_osi_Wakeup(&afs_initState);
+ } else if (parm == AFSOP_CACHEFILE) {
+ wait_for_cachedefs();
code = afs_InitCacheFile(tbuffer, 0);
- else if (parm == AFSOP_CACHEINFO)
+ } else if (parm == AFSOP_CACHEINFO) {
+ wait_for_cachedefs();
code = afs_InitCacheInfo(tbuffer);
- else if (parm == AFSOP_VOLUMEINFO)
+ } else if (parm == AFSOP_VOLUMEINFO) {
+ wait_for_cachedefs();
code = afs_InitVolumeInfo(tbuffer);
- else if (parm == AFSOP_CELLINFO)
+ } else if (parm == AFSOP_CELLINFO) {
+ wait_for_cachedefs();
code = afs_InitCellInfo(tbuffer);
+ }
#ifdef AFS_DARWIN80_ENV
- put_vfs_context();
+ put_vfs_context();
#endif
}
osi_FreeSmallSpace(tbuffer);
} else if (parm == AFSOP_GO) {
+#ifdef AFS_CACHE_VNODE_PATH
+ if (cacheDiskType != AFS_FCACHE_TYPE_MEM) {
+ afs_int32 dummy;
+
+ wait_for_cachedefs();
+
+#ifdef AFS_DARWIN80_ENV
+ get_vfs_context();
+#endif
+ if ((afs_numcachefiles > 0) && (afs_numfilesperdir > 0) &&
+ (afs_cachebasedir[0] == '/')) {
+ for (dummy = 0; dummy < afs_numcachefiles; dummy++) {
+ code = afs_InitCacheFile(NULL, dummy);
+ }
+ }
+#ifdef AFS_DARWIN80_ENV
+ put_vfs_context();
+#endif
+ }
+#endif
/* the generic initialization calls come here. One parameter: should we do the
* set-time operation on this workstation */
if (afs_Go_Done)
#if (!defined(AFS_NONFSTRANS)) || defined(AFS_AIX_IAUTH_ENV)
afs_nfsclient_init();
#endif
+ afs_uuid_create(&afs_cb_interface.uuid);
printf("found %d non-empty cache files (%d%%).\n",
afs_stats_cmperf.cacheFilesReused,
(100 * afs_stats_cmperf.cacheFilesReused) /
} else if (parm == AFSOP_ADVISEADDR) {
/* pass in the host address to the rx package */
int rxbind = 0;
+ int refresh = 0;
+
afs_int32 count = parm2;
afs_int32 *buffer =
afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
int i;
+ /* This is a refresh */
+ if (count & 0x40000000) {
+ count &= ~0x40000000;
+ /* Can't bind after we start. Fix? */
+ count &= ~0x80000000;
+ refresh = 1;
+ }
+
/* Bind, but only if there's only one address configured */
if ( count & 0x80000000) {
count &= ~0x80000000;
afs_cb_interface.mtu[i] = (parm5 ? mtubuffer[i] : htonl(1500));
#endif
}
- afs_uuid_create(&afs_cb_interface.uuid);
rxi_setaddr(buffer[0]);
- if (rxbind)
- rx_bindhost = buffer[0];
- else
- rx_bindhost = htonl(INADDR_ANY);
+ if (!refresh) {
+ if (rxbind)
+ rx_bindhost = buffer[0];
+ else
+ rx_bindhost = htonl(INADDR_ANY);
+ }
afs_osi_Free(buffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
afs_osi_Free(maskbuffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
afs_osi_Free(mtubuffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
+
+ if (refresh) {
+ afs_CheckServers(1, NULL); /* check down servers */
+ afs_CheckServers(0, NULL); /* check down servers */
+ }
}
#ifdef AFS_SGI53_ENV
else if (parm == AFSOP_NFSSTATICADDR) {
} else if (parm == AFSOP_SET_RXPCK) {
rx_extraPackets = parm2;
afscall_set_rxpck_received = 1;
+ } else if (parm == AFSOP_SET_RXMAXMTU) {
+ rx_MyMaxSendSize = rx_maxReceiveSizeUser = rx_maxReceiveSize = parm2;
} else
code = EINVAL;
out:
-#ifdef AFS_DARWIN80_ENV /* to balance the put in afs3_syscall() */
- get_vfs_context();
-#endif
AFS_GUNLOCK();
#ifdef AFS_LINUX20_ENV
return -code;
#endif
afs_warn("\n");
- /* Close file only after daemons which can write to it are stopped. */
- if (afs_cacheInodep) { /* memcache won't set this */
- osi_UFSClose(afs_cacheInodep); /* Since we always leave it open */
- afs_cacheInodep = 0;
- }
- return; /* Just kill daemons for now */
+#ifdef AFS_AIX51_ENV
+ shutdown_daemons();
+#endif
+
#ifdef notdef
shutdown_CB();
shutdown_AFS();
shutdown_rxevent();
shutdown_rx();
afs_shutdown_BKG();
- shutdown_bufferpackage();
-#endif
-#ifdef AFS_AIX51_ENV
- shutdown_daemons();
#endif
-#ifdef notdef
+ shutdown_bufferpackage();
shutdown_cache();
shutdown_osi();
shutdown_osinet();
shutdown_osifile();
shutdown_vnodeops();
- shutdown_vfsops();
- shutdown_exporter();
shutdown_memcache();
#if (!defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV)) && !defined(AFS_OSF_ENV)
+ shutdown_exporter();
shutdown_nfsclnt();
#endif
shutdown_afstest();
memset(&afs_stats_cmfullperf, 0, sizeof(struct afs_stats_CMFullPerf));
*/
afs_warn(" ALL allocated tables\n");
+
+ /* Close file only after daemons which can write to it are stopped. */
+ if (afs_cacheInodep) { /* memcache won't set this */
+ osi_UFSClose(afs_cacheInodep); /* Since we always leave it open */
+ afs_cacheInodep = 0;
+ }
+
afs_shuttingdown = 0;
-#endif
+
+ return; /* Just kill daemons for now */
}
void