#define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
char FS_HostName[128] = "localhost";
+char *FS_configPath = NULL;
afs_uint32 FS_HostAddr_NBO;
afs_uint32 FS_HostAddr_HBO;
afs_uint32 FS_HostAddrs[ADDRSPERSITE], FS_HostAddr_cnt = 0, FS_registered = 0;
CheckDescriptors(NULL);
}
-/* check whether caller is authorized to manage RX statistics */
+/* check whether caller is authorized to perform admin operations */
int
-fs_rxstat_userok(struct rx_call *call)
+viced_SuperUser(struct rx_call *call)
{
return afsconf_SuperUser(confDir, call, NULL);
}
{
int code;
int optval;
- char *optstring;
+ char *optstring = NULL;
struct cmd_item *optlist;
struct cmd_syndesc *opts;
}
} /*InitPR */
-struct rx_connection *serverconns[MAXSERVERS];
-struct ubik_client *cstruct;
+static struct ubik_client *cstruct;
-afs_int32
-vl_Initialize(const char *confDir)
+static afs_int32
+vl_Initialize(struct afsconf_dir *dir)
{
afs_int32 code, i;
afs_int32 scIndex = RX_SECIDX_NULL;
- struct afsconf_dir *tdir;
- struct rx_securityClass *sc;
struct afsconf_cell info;
+ struct rx_securityClass *sc;
+ struct rx_connection *serverconns[MAXSERVERS];
- tdir = afsconf_Open(confDir);
- if (!tdir) {
- ViceLog(0,
- ("Could not open configuration directory (%s).\n", confDir));
- exit(1);
- }
- code = afsconf_ClientAuth(tdir, &sc, &scIndex);
+ memset(serverconns, 0, sizeof(serverconns));
+ code = afsconf_ClientAuth(dir, &sc, &scIndex);
if (code) {
ViceLog(0, ("Could not get security object for localAuth\n"));
exit(1);
}
- code = afsconf_GetCellInfo(tdir, NULL, AFSCONF_VLDBSERVICE, &info);
+ code = afsconf_GetCellInfo(dir, NULL, AFSCONF_VLDBSERVICE, &info);
if (info.numServers > MAXSERVERS) {
ViceLog(0,
("vl_Initialize: info.numServers=%d (> MAXSERVERS=%d)\n",
info.hostAddr[i].sin_port, USER_SERVICE_ID, sc,
scIndex);
code = ubik_ClientInit(serverconns, &cstruct);
- afsconf_Close(tdir);
if (code) {
ViceLog(0, ("vl_Initialize: ubik client init failed.\n"));
return code;
}
afs_int32
-InitVL(void)
+InitVL(struct afsconf_dir *dir)
{
afs_int32 code;
* If this fails, it's because something major is wrong, and is not
* likely to be time dependent.
*/
- code = vl_Initialize(AFSDIR_SERVER_ETC_DIRPATH);
+ code = vl_Initialize(dir);
if (code != 0) {
ViceLog(0,
("Couldn't initialize volume location library; code=%d.\n", code));
exit(1);
}
#endif
- confDir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
+ FS_configPath = strdup(AFSDIR_SERVER_ETC_DIRPATH);
+
+ confDir = afsconf_Open(FS_configPath);
if (!confDir) {
fprintf(stderr, "Unable to open config directory %s\n",
- AFSDIR_SERVER_ETC_DIRPATH);
+ FS_configPath);
exit(-1);
}
InitCallBack(numberofcbs);
ClearXStatValues();
- code = InitVL();
+ code = InitVL(confDir);
if (code && code != VL_MULTIPADDR) {
ViceLog(0, ("Fatal error in library initialization, exiting!!\n"));
exit(1);
}
/* allow super users to manage RX statistics */
- rx_SetRxStatUserOk(fs_rxstat_userok);
+ rx_SetRxStatUserOk(viced_SuperUser);
CV_INIT(&fsync_cond, "fsync", CV_DEFAULT, 0);
MUTEX_INIT(&fsync_glock_mutex, "fsync", MUTEX_DEFAULT, 0);