#include <afs/procmgmt.h> /* signal(), kill(), wait(), etc. */
#include <lwp.h>
+#include <rx/rx.h>
#include <afs/audit.h>
#include <afs/afsutil.h>
#include <afs/fileutil.h>
extern char **environ; /* env structure */
#endif
+int hdl_notifier(struct bnode_proc *tp);
+
/* Remember the name of the process, if any, that failed last */
static void
RememberProcName(register struct bnode_proc *ap)
if (code) {
DIR *logdir;
struct dirent *file;
- char *p;
size_t length;
unsigned long pid;
/* wait for all bnodes to stabilize */
int
-bnode_WaitAll()
+bnode_WaitAll(void)
{
register struct bnode *tb;
register afs_int32 code;
/* apply a function to all bnodes in the system */
int
-bnode_ApplyInstance(int (*aproc) (), char *arock)
+bnode_ApplyInstance(int (*aproc) (struct bnode *tb, void *), void *arock)
{
register struct bnode *tb, *nb;
register afs_int32 code;
buf1 = "(null)";
(void)sprintf(bufp, "coreName: %s\n", buf1);
bufp += strlen(bufp);
- (void)sprintf(bufp, "pid: %ld\n", tp->pid);
+ (void)sprintf(bufp, "pid: %ld\n", (long int)tp->pid);
bufp += strlen(bufp);
- (void)sprintf(bufp, "lastExit: %ld\n", tp->lastExit);
+ (void)sprintf(bufp, "lastExit: %ld\n", (long int)tp->lastExit);
bufp += strlen(bufp);
#ifdef notdef
- (void)sprintf(bufp, "lastSignal: %ld\n", tp->lastSignal);
+ (void)sprintf(bufp, "lastSignal: %ld\n", (long int)tp->lastSignal);
bufp += strlen(bufp);
#endif
- (void)sprintf(bufp, "flags: %ld\n", tp->flags);
+ (void)sprintf(bufp, "flags: %ld\n", (long int)tp->flags);
bufp += strlen(bufp);
(void)sprintf(bufp, "END bnode_proc\n");
bufp += strlen(bufp);
bufp += strlen(bufp);
(void)sprintf(bufp, "name: %s\n", tb->name);
bufp += strlen(bufp);
- (void)sprintf(bufp, "rsTime: %ld\n", tb->rsTime);
+ (void)sprintf(bufp, "rsTime: %ld\n", (long int)tb->rsTime);
bufp += strlen(bufp);
- (void)sprintf(bufp, "rsCount: %ld\n", tb->rsCount);
+ (void)sprintf(bufp, "rsCount: %ld\n", (long int)tb->rsCount);
bufp += strlen(bufp);
- (void)sprintf(bufp, "procStartTime: %ld\n", tb->procStartTime);
+ (void)sprintf(bufp, "procStartTime: %ld\n", (long int)tb->procStartTime);
bufp += strlen(bufp);
- (void)sprintf(bufp, "procStarts: %ld\n", tb->procStarts);
+ (void)sprintf(bufp, "procStarts: %ld\n", (long int)tb->procStarts);
bufp += strlen(bufp);
- (void)sprintf(bufp, "lastAnyExit: %ld\n", tb->lastAnyExit);
+ (void)sprintf(bufp, "lastAnyExit: %ld\n", (long int)tb->lastAnyExit);
bufp += strlen(bufp);
- (void)sprintf(bufp, "lastErrorExit: %ld\n", tb->lastErrorExit);
+ (void)sprintf(bufp, "lastErrorExit: %ld\n", (long int)tb->lastErrorExit);
bufp += strlen(bufp);
- (void)sprintf(bufp, "errorCode: %ld\n", tb->errorCode);
+ (void)sprintf(bufp, "errorCode: %ld\n", (long int)tb->errorCode);
bufp += strlen(bufp);
- (void)sprintf(bufp, "errorSignal: %ld\n", tb->errorSignal);
+ (void)sprintf(bufp, "errorSignal: %ld\n", (long int)tb->errorSignal);
bufp += strlen(bufp);
/*
(void) sprintf(bufp, "lastErrorName: %s\n", tb->lastErrorName);
if (write(fd, buffer, len) < 0) {
return -1;
}
+ return 0;
}
int
hdl_notifier(struct bnode_proc *tp)
{
#ifndef AFS_NT40_ENV /* NT notifier callout not yet implemented */
- int code, pid, status;
+ int code, pid;
struct stat tstat;
if (stat(tp->bnode->notifier, &tstat)) {
/* intialize the whole system */
int
-bnode_Init()
+bnode_Init(void)
{
PROCESS junk;
register afs_int32 code;
struct sigaction newaction;
- static initDone = 0;
+ static int initDone = 0;
if (initDone)
return 0;
bnode_ParseLine(char *aline, struct bnode_token **alist)
{
char tbuffer[256];
- register char *tptr;
+ register char *tptr = NULL;
int inToken;
struct bnode_token *first, *last;
register struct bnode_token *ttok;
return 0;
}
}
+ return 0;
}
#define MAXVARGS 128
#define BOP_RESTARTP(bnode) ((*(bnode)->ops->restartp)((bnode)))
#define BOP_HASCORE(bnode) ((*(bnode)->ops->hascore)((bnode)))
+struct bnode_proc;
+
struct bnode_ops {
- struct bnode *(*create) ( /* variable args */ );
- int (*timeout) ( /* bnode */ );
- int (*getstat) ( /* bnode, status */ );
- int (*setstat) ( /* bnode, status */ );
- int (*delete) ( /* bnode */ );
- int (*procexit) ( /* bnode, proc */ );
- int (*getstring) ( /* bnode, buffer, bufLen */ );
- int (*getparm) ( /* bnode, parmIndex, buffer, bufLen */ );
- int (*restartp) ( /* bnode */ );
- int (*hascore) ( /* bnode */ );
+ struct bnode *(*create) ( char *, char *, char *, char *, char *, char *);
+ int (*timeout) ( struct bnode * );
+ int (*getstat) ( struct bnode *, afs_int32 * );
+ int (*setstat) ( struct bnode *, afs_int32 );
+ int (*delete) ( struct bnode * );
+ int (*procexit) ( struct bnode *, struct bnode_proc * );
+ int (*getstring) ( struct bnode *, char *abuffer, afs_int32 alen );
+ int (*getparm) ( struct bnode *, afs_int32 aindex, char *abuffer,
+ afs_int32 alen);
+ int (*restartp) ( struct bnode *);
+ int (*hascore) ( struct bnode *);
};
struct bnode_type {
#include <afs/com_err.h>
#include <ubik.h>
#include <afs/ktime.h>
+#include <des.h>
+#include <des_prototypes.h>
+#include <afs/kautils.h>
+#include <afs/volser.h>
-static IStatServer();
-static DoStat();
+static int IStatServer(register struct cmd_syndesc *as, int int32p);
+static int DoStat(char *aname, register struct rx_connection *aconn,
+ int aint32p, int firstTime);
#include "bosint.h"
/* dummy routine for the audit work. It should do nothing since audits */
/* occur at the server level and bos is not a server. */
-osi_audit()
+int osi_audit(void )
{
return 0;
}
/* keep those lines small */
static char *
-em(acode)
- afs_int32 acode;
+em(afs_int32 acode)
{
if (acode == -1)
return "communications failure (-1)";
}
/* get partition id from a name */
+/* XXX - unused code - could be removed? */
+#if 0
static afs_int32
-GetPartitionID(aname)
- char *aname;
+GetPartitionID(char *aname)
{
register char tc;
char ascii[3];
return (ascii[0] - 'a') * 26 + (ascii[1] - 'a') + 26;
}
}
+#endif
/* make ctime easier to use */
static char *
-DateOf(atime)
- afs_int32 atime;
+DateOf(afs_int32 atime)
{
static char tbuffer[30];
register char *tp;
* aencrypt is set if we want to encrypt the data on the wire.
*/
static struct rx_connection *
-GetConn(as, aencrypt)
- int aencrypt;
- struct cmd_syndesc *as;
+GetConn(struct cmd_syndesc *as, int aencrypt)
{
struct hostent *th;
char *hostname;
/* take a name (e.g. foo/bar, and a dir e.g. /usr/afs/bin, and construct
* /usr/afs/bin/bar */
-static
-ComputeDestDir(aname, adir, aresult, alen)
- char *aname, *adir, *aresult;
- afs_int32 alen;
+static int
+ComputeDestDir(char *aname, char *adir, char *aresult, afs_int32 alen)
{
register char *tp;
}
/* copy data from fd afd to rx call acall */
-static
-CopyBytes(afd, acall)
- int afd;
- register struct rx_call *acall;
+static int
+CopyBytes(int afd, register struct rx_call *acall)
{
register afs_int32 code;
register afs_int32 len;
}
static afs_int32
-GetServerGoal(aconn, aname)
- char *aname;
- struct rx_connection *aconn;
+GetServerGoal(struct rx_connection *aconn, char *aname)
{
char buffer[500];
char *tp;
hostp = as->parms[0].items->data; /* host name for messages */
tconn = GetConn(as, 0);
- code = BOZO_GetRestartTime(tconn, 1, &generalTime);
+ code = BOZO_GetRestartTime(tconn, 1, (struct bozo_netKTime *) &generalTime);
if (code) {
printf("bos: failed to retrieve restart information (%s)\n",
em(code));
return code;
}
- code = BOZO_GetRestartTime(tconn, 2, &newBinaryTime);
+ code = BOZO_GetRestartTime(tconn, 2, (struct bozo_netKTime *) &newBinaryTime);
if (code) {
printf("bos: failed to retrieve restart information (%s)\n",
em(code));
static int
SetRestartCmd(struct cmd_syndesc *as, void *arock)
{
- afs_int32 count;
+ afs_int32 count = 0;
register afs_int32 code;
struct ktime restartTime;
- afs_int32 type;
+ afs_int32 type = 0 ;
struct rx_connection *tconn;
count = 0;
if (count == 0)
type = 1; /* by default set general restart time */
- if (code = ktime_ParsePeriodic(as->parms[1].items->data, &restartTime)) {
+ if ((code = ktime_ParsePeriodic(as->parms[1].items->data, &restartTime))) {
printf("bos: failed to parse '%s' as periodic restart time(%s)\n",
as->parms[1].items->data, em(code));
return code;
}
- code = BOZO_SetRestartTime(tconn, type, &restartTime);
+ code = BOZO_SetRestartTime(tconn, type, (struct bozo_netKTime *) &restartTime);
if (code) {
printf("bos: failed to set restart time at server (%s)\n", em(code));
return code;
}
name = as->parms[1].items->data;
type = as->parms[2].items->data;
- if (ti = as->parms[4].items) {
+ if ((ti = as->parms[4].items)) {
notifier = ti->data;
}
code =
if (mrafsParm->OptDontAskFS)
strcat(tbuffer, " -DontAskFS");
if (mrafsParm->OptLogLevel) {
- sprintf(pbuffer, " -LogLevel %ld", mrafsParm->OptLogLevel);
+ sprintf(pbuffer, " -LogLevel %ld", (long int) mrafsParm->OptLogLevel);
strcat(tbuffer, pbuffer);
}
if (mrafsParm->OptRxDebug)
strcat(tbuffer, " -rxdebug");
if (mrafsParm->OptResidencies) {
- sprintf(pbuffer, " -Residencies %lu", mrafsParm->OptResidencies);
+ sprintf(pbuffer, " -Residencies %lu",
+ (long unsigned int) mrafsParm->OptResidencies);
strcat(tbuffer, pbuffer);
}
}
tp = &tname[0];
/* find out whether fileserver is running demand attach fs */
- if (code = BOZO_GetInstanceParm(tconn, "dafs", 0, &tp) == 0) {
+ if ((code = BOZO_GetInstanceParm(tconn, "dafs", 0, &tp) == 0)) {
dafs = 1;
serviceName = "dafs";
/* Find out whether fileserver is running MR-AFS (has a scanner instance) */
/* XXX this should really be done some other way, potentially by RPC */
- if (code = BOZO_GetInstanceParm(tconn, serviceName, 4, &tp) == 0)
+ if ((code = BOZO_GetInstanceParm(tconn, serviceName, 4, &tp) == 0))
mrafs = 1;
} else {
serviceName = "fs";
/* Find out whether fileserver is running MR-AFS (has a scanner instance) */
/* XXX this should really be done some other way, potentially by RPC */
- if (code = BOZO_GetInstanceParm(tconn, serviceName, 3, &tp) == 0)
+ if ((code = BOZO_GetInstanceParm(tconn, serviceName, 3, &tp) == 0))
mrafs = 1;
}
return 0;
}
-static
-IStatServer(as, int32p)
- int int32p;
- register struct cmd_syndesc *as;
+static int
+IStatServer(register struct cmd_syndesc *as, int int32p)
{
register struct rx_connection *tconn;
register struct cmd_item *ti;
return 0;
}
-static
-DoStat(aname, aconn, aint32p, firstTime)
- IN char *aname;
- IN register struct rx_connection *aconn;
- IN int aint32p;
- IN int firstTime; /* true iff first instance in cmd */
+static int
+DoStat(IN char *aname,
+ IN register struct rx_connection *aconn,
+ IN int aint32p,
+ IN int firstTime) /* true iff first instance in cmd */
{
afs_int32 temp;
char buffer[500];
#endif
static void
-add_std_args(ts)
- register struct cmd_syndesc *ts;
+add_std_args(register struct cmd_syndesc *ts)
{
cmd_Seek(ts, ADDPARMOFFSET);
/* + 0 */ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
#include "AFS_component_version_number.c"
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char **argv)
{
register afs_int32 code;
register struct cmd_syndesc *ts;
#include <rx/rxkad.h>
#include <afs/keys.h>
#include <afs/cellconfig.h>
+#include <afs/kautils.h>
+#include <des.h>
+#include <des_prototypes.h>
int
main(int argc, char **argv)
int kvno;
register afs_int32 code;
char buf[BUFSIZ], ver[BUFSIZ];
- char *tcell = NULL;
if (argc != 3) {
printf("bos_util adddes: usage is 'bos_util adddes <kvno>\n");
kvno = atoi(argv[2]);
code = afsconf_DeleteKey(tdir, kvno);
if (code) {
- printf("bos_util: failed to delete key %d, (code %d)\n", kvno,
+ printf("bos_util: failed to delete key %ld, (code %d)\n", kvno,
code);
exit(1);
}
memcpy(tbuffer, tkeys.key[i].key, 8);
tbuffer[8] = 0;
printf("kvno %4d: key is '%s' '", tkeys.key[i].kvno, tbuffer);
- strcpy(x, (char *)tbuffer);
+ strcpy((char *)x, (char *)tbuffer);
for (count = 0; count < 8; count++)
printf("\\%03o", x[count]);
printf("'\n");
#include <afs/fileutil.h>
#include <afs/ktime.h>
#include <afs/audit.h>
+#include <afs/kautils.h>
#include <string.h>
#include "bnode.h"
#endif
afs_int32
-SBOZO_GetRestartTime(acall, atype, aktime)
- struct rx_call *acall;
- afs_int32 atype;
- struct bozo_netKTime *aktime;
+SBOZO_GetRestartTime(struct rx_call *acall, afs_int32 atype, struct bozo_netKTime *aktime)
{
register afs_int32 code;
}
afs_int32
-SBOZO_SetRestartTime(acall, atype, aktime)
- struct rx_call *acall;
- afs_int32 atype;
- struct bozo_netKTime *aktime;
+SBOZO_SetRestartTime(struct rx_call *acall, afs_int32 atype, struct bozo_netKTime *aktime)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
}
afs_int32
-SBOZO_Exec(acall, acmd)
- struct rx_call *acall;
- char *acmd;
+SBOZO_Exec(struct rx_call *acall, char *acmd)
{
char caller[MAXKTCNAMELEN];
}
afs_int32
-SBOZO_GetDates(acall, aname, atime, abakTime, aoldTime)
- struct rx_call *acall;
- char *aname;
- afs_int32 *atime, *abakTime, *aoldTime;
+SBOZO_GetDates(struct rx_call *acall, char *aname, afs_int32 *atime,
+ afs_int32 *abakTime, afs_int32 *aoldTime)
{
struct stat tstat;
char *strp;
}
afs_int32
-SBOZO_UnInstall(acall, aname)
- struct rx_call *acall;
- register char *aname;
+SBOZO_UnInstall(struct rx_call *acall, register char *aname)
{
char *filepath;
char fpOld[AFSDIR_PATH_MAX], fpBak[AFSDIR_PATH_MAX];
}
afs_int32
-SBOZO_Install(acall, aname, asize, mode, amtime)
- struct rx_call *acall;
- char *aname;
- afs_int32 asize;
- afs_int32 amtime;
- afs_int32 mode;
+SBOZO_Install(struct rx_call *acall, char *aname, afs_int32 asize, afs_int32 mode, afs_int32 amtime)
{
afs_int32 code;
int fd;
}
afs_int32
-SBOZO_SetCellName(acall, aname)
- struct rx_call *acall;
- char *aname;
+SBOZO_SetCellName(struct rx_call *acall, char *aname)
{
struct afsconf_cell tcell;
register afs_int32 code;
}
afs_int32
-SBOZO_GetCellName(acall, aname)
- struct rx_call *acall;
- char **aname;
+SBOZO_GetCellName(struct rx_call *acall, char **aname)
{
register afs_int32 code;
char tname[MAXCELLCHARS];
}
afs_int32
-SBOZO_GetCellHost(acall, awhich, aname)
- struct rx_call *acall;
- afs_uint32 awhich;
- char **aname;
+SBOZO_GetCellHost(struct rx_call *acall, afs_uint32 awhich, char **aname)
{
register afs_int32 code;
struct afsconf_cell tcell;
}
afs_int32
-SBOZO_DeleteCellHost(acall, aname)
- struct rx_call *acall;
- char *aname;
+SBOZO_DeleteCellHost(struct rx_call *acall, char *aname)
{
register afs_int32 code;
struct afsconf_cell tcell;
}
afs_int32
-SBOZO_AddCellHost(acall, aname)
- struct rx_call *acall;
- char *aname;
+SBOZO_AddCellHost(struct rx_call *acall, char *aname)
{
register afs_int32 code;
struct afsconf_cell tcell;
}
afs_int32
-SBOZO_ListKeys(acall, an, akvno, akey, akeyinfo)
- struct rx_call *acall;
- afs_int32 an;
- afs_int32 *akvno;
- struct bozo_keyInfo *akeyinfo;
- struct bozo_key *akey;
+SBOZO_ListKeys(struct rx_call *acall, afs_int32 an, afs_int32 *akvno,
+ struct bozo_key *akey, struct bozo_keyInfo *akeyinfo)
{
struct afsconf_keys tkeys;
register afs_int32 code;
struct stat tstat;
- int noauth;
+ int noauth = 0;
char caller[MAXKTCNAMELEN];
rxkad_level enc_level = rxkad_clear;
}
afs_int32
-SBOZO_AddKey(acall, an, akey)
- struct rx_call *acall;
- afs_int32 an;
- struct bozo_key *akey;
+SBOZO_AddKey(struct rx_call *acall, afs_int32 an, struct bozo_key *akey)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
}
afs_int32
-SBOZO_SetNoAuthFlag(acall, aflag)
- register struct rx_call *acall;
- afs_int32 aflag;
+SBOZO_SetNoAuthFlag(register struct rx_call *acall, afs_int32 aflag)
{
register afs_int32 code = 0;
char caller[MAXKTCNAMELEN];
}
afs_int32
-SBOZO_DeleteKey(acall, an)
- struct rx_call *acall;
- afs_int32 an;
+SBOZO_DeleteKey(struct rx_call *acall, afs_int32 an)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
afs_int32
-SBOZO_ListSUsers(acall, an, aname)
- struct rx_call *acall;
- afs_int32 an;
- register char **aname;
+SBOZO_ListSUsers(struct rx_call *acall, afs_int32 an, register char **aname)
{
register afs_int32 code;
register char *tp;
}
afs_int32
-SBOZO_AddSUser(acall, aname)
- struct rx_call *acall;
- char *aname;
+SBOZO_AddSUser(struct rx_call *acall, char *aname)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
}
afs_int32
-SBOZO_DeleteSUser(acall, aname)
- struct rx_call *acall;
- char *aname;
+SBOZO_DeleteSUser(struct rx_call *acall, char *aname)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
}
afs_int32
-SBOZO_CreateBnode(acall, atype, ainstance, ap1, ap2, ap3, ap4, ap5, notifier)
- struct rx_call *acall;
- char *atype;
- char *ainstance;
- char *ap1, *ap2, *ap3, *ap4, *ap5;
- char *notifier;
+SBOZO_CreateBnode(struct rx_call *acall, char *atype, char *ainstance,
+ char *ap1, char *ap2, char *ap3, char *ap4, char *ap5,
+ char *notifier)
{
struct bnode *tb;
afs_int32 code;
}
afs_int32
-SBOZO_WaitAll(acall)
- register struct rx_call *acall;
+SBOZO_WaitAll(register struct rx_call *acall)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
}
afs_int32
-SBOZO_DeleteBnode(acall, ainstance)
- struct rx_call *acall;
- char *ainstance;
+SBOZO_DeleteBnode(struct rx_call *acall, char *ainstance)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
return code;
}
-static
-swproc(abnode, arock)
- register struct bnode *abnode;
- char *arock;
+static int
+swproc(register struct bnode *abnode, void *arock)
{
if (abnode->goal == BSTAT_NORMAL)
return 0; /* this one's not shutting down */
return 0; /* don't stop apply function early, no matter what */
}
-static
-stproc(abnode, arock)
- struct bnode *abnode;
- char *arock;
+static int
+stproc(struct bnode *abnode, void *arock)
{
if (abnode->fileGoal == BSTAT_SHUTDOWN)
return 0; /* don't do these guys */
return 0;
}
-static
-sdproc(abnode, arock)
- struct bnode *abnode;
- char *arock;
+static int
+sdproc(struct bnode *abnode, void *arock)
{
bnode_Hold(abnode);
bnode_SetStat(abnode, BSTAT_SHUTDOWN);
/* shutdown and leave down */
afs_int32
-SBOZO_ShutdownAll(acall)
- struct rx_call *acall;
+SBOZO_ShutdownAll(struct rx_call *acall)
{
/* iterate over all bnodes, setting the status to temporarily disabled */
register afs_int32 code;
/* shutdown and restart */
afs_int32
-SBOZO_RestartAll(acall)
- struct rx_call *acall;
+SBOZO_RestartAll(struct rx_call *acall)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
}
afs_int32
-SBOZO_ReBozo(acall)
- register struct rx_call *acall;
+SBOZO_ReBozo(struct rx_call *acall)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
/* make sure all are running */
afs_int32
-SBOZO_StartupAll(acall)
- struct rx_call *acall;
+SBOZO_StartupAll(struct rx_call *acall)
{
register afs_int32 code;
char caller[MAXKTCNAMELEN];
}
afs_int32
-SBOZO_Restart(acall, ainstance)
- struct rx_call *acall;
- register char *ainstance;
+SBOZO_Restart(struct rx_call *acall, register char *ainstance)
{
register struct bnode *tb;
register afs_int32 code;
/* set temp status */
afs_int32
-SBOZO_SetTStatus(acall, ainstance, astatus)
- struct rx_call *acall;
- char *ainstance;
- afs_int32 astatus;
+SBOZO_SetTStatus(struct rx_call *acall, char *ainstance, afs_int32 astatus)
{
register struct bnode *tb;
register afs_int32 code;
}
afs_int32
-SBOZO_SetStatus(acall, ainstance, astatus)
- struct rx_call *acall;
- char *ainstance;
- afs_int32 astatus;
+SBOZO_SetStatus(struct rx_call *acall, char *ainstance, afs_int32 astatus)
{
register struct bnode *tb;
register afs_int32 code;
}
afs_int32
-SBOZO_GetStatus(acall, ainstance, astat, astatDescr)
- struct rx_call *acall;
- char *ainstance;
- afs_int32 *astat;
- char **astatDescr;
+SBOZO_GetStatus(struct rx_call *acall, char *ainstance, afs_int32 *astat,
+ char **astatDescr)
{
register struct bnode *tb;
register afs_int32 code;
int counter;
};
-static
-eifunc(abnode, arock)
- struct bnode *abnode;
- struct eidata *arock;
+static int
+eifunc(struct bnode *abnode, void *param)
{
+ struct eidata *arock = (struct eidata *)param;
+
if (arock->counter-- == 0) {
/* done */
strcpy(arock->iname, abnode->name);
}
}
-static
-ZapFile(adir, aname)
- register char *adir;
- register char *aname;
+static int
+ZapFile(const char *adir, const char *aname)
{
char tbuffer[256];
- strcpy(tbuffer, adir);
- strcat(tbuffer, "/");
- strcat(tbuffer, aname);
- return unlink(tbuffer);
+ if (snprintf(tbuffer, 256, "%s/%s", adir, aname)<256)
+ return unlink(tbuffer);
+ else
+ return -1;
}
afs_int32
-SBOZO_Prune(acall, aflags)
- struct rx_call *acall;
- afs_int32 aflags;
+SBOZO_Prune(struct rx_call *acall, afs_int32 aflags)
{
register afs_int32 code;
DIR *dirp;
}
afs_int32
-SBOZO_EnumerateInstance(acall, anum, ainstance)
- struct rx_call *acall;
- afs_int32 anum;
- char **ainstance;
+SBOZO_EnumerateInstance(struct rx_call *acall, afs_int32 anum,
+ char **ainstance)
{
struct eidata tdata;
* The other fields in the struct are however, statically initialized.
*/
int
-initBosEntryStats()
+initBosEntryStats(void)
{
bozo_bosEntryStats[0].path = AFSDIR_SERVER_AFS_DIRPATH;
bozo_bosEntryStats[1].path = AFSDIR_SERVER_ETC_DIRPATH;
* read. */
static int
-StatEachEntry(stats)
- IN struct bozo_bosEntryStats *stats;
+StatEachEntry(IN struct bozo_bosEntryStats *stats)
{
struct stat info;
if (stat(stats->path, &info)) {
* this check more often than every 5 seconds. */
int
-DirAccessOK()
+DirAccessOK(void)
{
#ifdef AFS_NT40_ENV
/* underlying filesystem may not support directory protection */
}
int
-GetRequiredDirPerm(path)
- IN char *path;
+GetRequiredDirPerm(const char *path)
{
int i;
for (i = 0; i < bozo_nbosEntryStats; i++)
}
afs_int32
-SBOZO_GetInstanceInfo(acall, ainstance, atype, astatus)
- IN struct rx_call *acall;
- IN char *ainstance;
- OUT char **atype;
- OUT struct bozo_status *astatus;
+SBOZO_GetInstanceInfo(IN struct rx_call *acall,
+ IN char *ainstance,
+ OUT char **atype,
+ OUT struct bozo_status *astatus)
{
register struct bnode *tb;
}
afs_int32
-SBOZO_GetInstanceParm(acall, ainstance, anum, aparm)
- struct rx_call *acall;
- char *ainstance;
- afs_int32 anum;
- char **aparm;
+SBOZO_GetInstanceParm(struct rx_call *acall,
+ char *ainstance,
+ afs_int32 anum,
+ char **aparm)
{
register struct bnode *tb;
register char *tp;
}
afs_int32
-SBOZO_GetLog(acall, aname)
- register struct rx_call *acall;
- char *aname;
+SBOZO_GetLog(register struct rx_call *acall, char *aname)
{
register afs_int32 code;
FILE *tfile;
}
afs_int32
-SBOZO_GetInstanceStrings(acall, abnodeName, as1, as2, as3, as4)
- struct rx_call *acall;
- char *abnodeName;
- char **as1, **as2, **as3, **as4;
+SBOZO_GetInstanceStrings(struct rx_call *acall, char *abnodeName,
+ char **as1, char **as2, char **as3, char **as4)
{
register struct bnode *tb;
#ifdef BOS_RESTRICTED_MODE
afs_int32
-SBOZO_GetRestrictedMode(acall, arestmode)
- struct rx_call *acall;
- afs_int32 *arestmode;
+SBOZO_GetRestrictedMode(struct rx_call *acall, afs_int32 *arestmode)
{
*arestmode = bozo_isrestricted;
return 0;
}
afs_int32
-SBOZO_SetRestrictedMode(acall, arestmode)
- struct rx_call *acall;
- afs_int32 arestmode;
+SBOZO_SetRestrictedMode(struct rx_call *acall, afs_int32 arestmode)
{
afs_int32 code;
char caller[MAXKTCNAMELEN];
}
#else
afs_int32
-SBOZO_GetRestrictedMode(acall, arestmode)
- struct rx_call *acall;
- afs_int32 *arestmode;
+SBOZO_GetRestrictedMode(struct rx_call *acall, afs_int32 *arestmode)
{
return RXGEN_OPCODE;
}
afs_int32
-SBOZO_SetRestrictedMode(acall, arestmode)
- struct rx_call *acall;
- afs_int32 arestmode;
+SBOZO_SetRestrictedMode(struct rx_call *acall, afs_int32 arestmode)
{
return RXGEN_OPCODE;
}
#ifndef _BOSPROTOTYPES_H_
#define _BOSPROTOTYPES_H_
+/* bnode.c */
+int bnode_CoreName(struct bnode *abnode, char *acoreName, char *abuffer);
+int bnode_GetString(struct bnode *abnode, char *abuffer, afs_int32 alen);
+int bnode_GetParm(struct bnode *abnode, afs_int32 aindex, char *abuffer,
+ afs_int32 alen);
+int bnode_GetStat(struct bnode *abnode, afs_int32 * astatus);
+int bnode_RestartP(struct bnode *abnode);
+int bnode_HasCore(struct bnode *abnode);
+int bnode_WaitAll(void);
+int bnode_SetGoal(struct bnode *abnode, int agoal);
+int bnode_SetFileGoal(struct bnode *abnode, int agoal);
+int bnode_ApplyInstance(int (*aproc)(struct bnode *, void *), void *arock);
+int bnode_Register(char *, struct bnode_ops *, int);
+int bnode_DeleteName(char *);
+int bnode_Hold(struct bnode *);
+int bnode_Release(struct bnode *);
+int bnode_Delete(struct bnode *);
+int bnode_PendingTimeout(struct bnode *abnode);
+void bnode_Int(int asignal);
+int bnode_Init(void);
+int bnode_FreeTokens(struct bnode_token *alist);
+int bnode_ParseLine(char *aline, struct bnode_token **alist);
+int bnode_NewProc(struct bnode *abnode, char *aexecString, char *coreName,
+ struct bnode_proc **aproc);
+int bnode_StopProc(struct bnode_proc *aproc, int asignal);
+int bnode_Deactivate(struct bnode *abnode);
+
+/* bosint.ss.c */
+struct rx_call;
+int BOZO_ExecuteRequest(register struct rx_call *z_call);
+
/* bosserver.c */
void bozo_Log(char *format, ... );
+int bozo_ReBozo(void);
+int WriteBozoFile(char *aname);
+
+/* bosoprocs.c */
+int GetRequiredDirPerm(const char *path);
+void *bozo_ShutdownAndExit(void *arock /* really int asignal */);
+int initBosEntryStats(void);
+int DirAccessOK(void);
+
+/* fsbnodeops.c */
+char *copystr(char *a);
/* bosoprocs.c */
void *bozo_ShutdownAndExit(void *arock /* really int asignal */);
#include "bnode.h"
#include "bosprototypes.h"
#include <rx/rxkad.h>
+#include <rx/rxstat.h>
+#include <rxstat/rxstat_prototype.h>
#include <afs/keys.h>
#include <afs/ktime.h>
#include <afs/afsutil.h>
#include <afs/fileutil.h>
#include <afs/procmgmt.h> /* signal(), kill(), wait(), etc. */
+#include <afs/audit.h>
+#include <afs/cellconfig.h>
#if defined(AFS_SGI_ENV)
#include <afs/afs_args.h>
#endif
#define BOZO_LWP_STACKSIZE 16000
-extern int BOZO_ExecuteRequest();
-extern int RXSTATS_ExecuteRequest();
extern struct bnode_ops fsbnode_ops, dafsbnode_ops, ezbnode_ops, cronbnode_ops;
struct afsconf_dir *bozo_confdir = 0; /* bozo configuration dir */
/* restart bozo process */
int
-bozo_ReBozo()
+bozo_ReBozo(void)
{
#ifdef AFS_NT40_ENV
/* exit with restart code; SCM integrator process will restart bosserver */
/* create all the bozo dirs */
static int
-CreateDirs()
+CreateDirs(void)
{
if ((!strncmp
(AFSDIR_USR_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
}
/* write one bnode's worth of entry into the file */
-static
-bzwrite(register struct bnode *abnode, register struct bztemp *at)
+static int
+bzwrite(register struct bnode *abnode, void *arock)
{
+ register struct bztemp *at = (struct bztemp *)arock;
register int i;
char tbuffer[BOZO_BSSIZE];
register afs_int32 code;
}
static int
-bdrestart(register struct bnode *abnode, char *arock)
+bdrestart(register struct bnode *abnode, void *arock)
{
register afs_int32 code;
#ifdef AFS_AIX32_ENV
static int
-tweak_config()
+tweak_config(void)
{
FILE *f;
char c[80];
rxMaxMTU = atoi(argv[++code]);
if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
(rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
- printf("rxMaxMTU %d invalid; must be between %d-%d\n",
+ printf("rxMaxMTU %d invalid; must be between %d-%lu\n",
rxMaxMTU, RX_MIN_PACKET_SIZE,
RX_MAX_PACKET_DATA_SIZE);
exit(1);
}
code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
- (void *) /*parm */ 0, "bozo-the-clown",
+ /* param */ NULL , "bozo-the-clown",
&bozo_pid);
/* try to read the key from the config file */
}
/* read init file, starting up programs */
- if (code = ReadBozoFile(0)) {
+ if ((code = ReadBozoFile(0))) {
bozo_Log
("bosserver: Something is wrong (%d) with the bos configuration file %s; aborting\n",
code, AFSDIR_SERVER_BOZCONF_FILEPATH);
#include "bnode.h"
#include "bosprototypes.h"
-static int cron_timeout(), cron_getstat(), cron_setstat(), cron_delete();
-static int cron_procexit(), cron_getstring(), cron_getparm(), cron_restartp();
-static int cron_hascore();
-struct bnode *cron_create();
+struct bnode *cron_create(char *, char *, char *, char *, char *, char *);
+static int cron_hascore(struct bnode *bnode);
+static int cron_restartp(struct bnode *bnode);
+static int cron_delete(struct bnode *bnode);
+static int cron_timeout(struct bnode *bnode);
+static int cron_getstat(struct bnode *bnode, afs_int32 *status);
+static int cron_setstat(struct bnode *bnode, afs_int32 status);
+static int cron_procexit(struct bnode *bnode, struct bnode_proc *proc);
+static int cron_getstring(struct bnode *bnode, char *abuffer, afs_int32 alen);
+static int cron_getparm(struct bnode *bnode, afs_int32, char *, afs_int32);
#define SDTIME 60 /* time in seconds given to a process to evaporate */
};
static int
-cron_hascore(register struct ezbnode *abnode)
+cron_hascore(struct bnode *abnode)
{
char tbuffer[256];
/* If this proc is shutdown, tell bproc() to no longer run this job */
if (abnode->b.goal == BSTAT_SHUTDOWN) {
- bnode_SetTimeout(abnode, 0);
+ bnode_SetTimeout((struct bnode *)abnode, 0);
return 0;
}
/* one shot */
if (abnode->everRun) {
/* once is enough */
- bnode_Delete(abnode);
+ bnode_Delete((struct bnode *)abnode);
return 0;
}
/* otherwise start it */
if (!abnode->running) {
/* start up */
abnode->lastStart = FT_ApproxTime();
- code = bnode_NewProc(abnode, abnode->command, NULL, &tp);
+ code = bnode_NewProc((struct bnode *)abnode, abnode->command, NULL, &tp);
if (code) {
bozo_Log("cron bnode %s failed to start (code %d)\n",
abnode->b.name, code);
temp = abnode->when - FT_ApproxTime();
if (temp < 1)
temp = 1; /* temp is when to start dude */
- bnode_SetTimeout(abnode, temp);
+ bnode_SetTimeout((struct bnode *)abnode, temp);
}
return 0;
}
static int
-cron_restartp(register struct cronbnode *abnode)
+cron_restartp(struct bnode *abnode)
{
return 0;
}
static int
-cron_delete(struct cronbnode *abnode)
+cron_delete(struct bnode *bn)
{
+ struct cronbnode *abnode = (struct cronbnode *)bn;
free(abnode->command);
free(abnode->whenString);
free(abnode);
}
struct bnode *
-cron_create(char *ainstance, char *acommand, char *awhen)
+cron_create(char *ainstance, char *acommand, char *awhen,
+ char *unused1, char *unused2, char *unused3)
{
struct cronbnode *te;
afs_int32 code;
char *cmdpath;
- extern char *copystr();
/* construct local path from canonical (wire-format) path */
if (ConstructLocalBinPath(acommand, &cmdpath)) {
te = (struct cronbnode *)malloc(sizeof(struct cronbnode));
memset(te, 0, sizeof(struct cronbnode));
code = ktime_ParsePeriodic(awhen, &te->whenToRun);
- if ((code < 0) || (bnode_InitBnode(te, &cronbnode_ops, ainstance) != 0)) {
+ if ((code < 0) || (bnode_InitBnode((struct bnode *)te, &cronbnode_ops, ainstance) != 0)) {
free(te);
free(cmdpath);
return NULL;
/* called to SIGKILL a process if it doesn't terminate normally. In cron, also
start up a process if it is time and not already running */
static int
-cron_timeout(struct cronbnode *abnode)
+cron_timeout(struct bnode *bn)
{
+ struct cronbnode *abnode = (struct cronbnode *)bn;
register afs_int32 temp;
register afs_int32 code;
struct bnode_proc *tp;
/* not running, perhaps we should start it */
if (FT_ApproxTime() >= abnode->when) {
abnode->lastStart = FT_ApproxTime();
- bnode_SetTimeout(abnode, 0);
- code = bnode_NewProc(abnode, abnode->command, NULL, &tp);
+ bnode_SetTimeout((struct bnode *)abnode, 0);
+ code = bnode_NewProc((struct bnode *)abnode, abnode->command, NULL, &tp);
if (code) {
bozo_Log("cron failed to start bnode %s (code %d)\n",
abnode->b.name, code);
temp = abnode->when - FT_ApproxTime();
if (temp < 1)
temp = 1;
- bnode_SetTimeout(abnode, temp);
+ bnode_SetTimeout((struct bnode *)abnode, temp);
}
} else {
if (!abnode->waitingForShutdown)
/* send kill and turn off timer */
bnode_StopProc(abnode->proc, SIGKILL);
abnode->killSent = 1;
- bnode_SetTimeout(abnode, 0);
+ bnode_SetTimeout((struct bnode *)abnode, 0);
}
return 0;
}
static int
-cron_getstat(struct cronbnode *abnode, afs_int32 * astatus)
+cron_getstat(struct bnode *bn, afs_int32 * astatus)
{
+ struct cronbnode *abnode = (struct cronbnode *)bn;
register afs_int32 temp;
if (abnode->waitingForShutdown)
temp = BSTAT_SHUTTINGDOWN;
}
static int
-cron_setstat(register struct cronbnode *abnode, afs_int32 astatus)
+cron_setstat(struct bnode *bn, afs_int32 astatus)
{
+ struct cronbnode *abnode = (struct cronbnode *)bn;
if (abnode->waitingForShutdown)
return BZBUSY;
if (astatus == BSTAT_SHUTDOWN) {
/* start shutdown */
bnode_StopProc(abnode->proc, SIGTERM);
abnode->waitingForShutdown = 1;
- bnode_SetTimeout(abnode, SDTIME);
+ bnode_SetTimeout((struct bnode *)abnode, SDTIME);
/* When shutdown is complete, bproc() calls BOP_PROCEXIT()
* [cron_procexit()] which will tell bproc() to no longer
* run this cron job.
*/
} else {
/* Tell bproc() to no longer run this cron job */
- bnode_SetTimeout(abnode, 0);
+ bnode_SetTimeout((struct bnode *)abnode, 0);
}
} else if (astatus == BSTAT_NORMAL) {
/* start the cron job
}
static int
-cron_procexit(struct cronbnode *abnode, struct bnode_proc *aproc)
+cron_procexit(struct bnode *bn, struct bnode_proc *aproc)
{
+ struct cronbnode *abnode = (struct cronbnode *) bn;
/* process has exited */
/* log interesting errors for folks */
}
static int
-cron_getstring(struct cronbnode *abnode, char *abuffer, afs_int32 alen)
+cron_getstring(struct bnode *bn, char *abuffer, afs_int32 alen)
{
+ struct cronbnode *abnode = (struct cronbnode *)bn;
if (abnode->running)
strcpy(abuffer, "running now");
else if (abnode->when == 0)
}
static int
-cron_getparm(struct cronbnode *abnode, afs_int32 aindex, char *abuffer,
+cron_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
afs_int32 alen)
{
+ struct cronbnode *abnode = (struct cronbnode *)bn;
if (aindex == 0)
strcpy(abuffer, abnode->command);
else if (aindex == 1) {
#include <errno.h>
#include <sys/stat.h>
#include <lwp.h>
+#include <rx/rx.h>
#ifdef AFS_NT40_ENV
#include <io.h>
#endif
#include "bnode.h"
#include "bosprototypes.h"
-static int ez_timeout(), ez_getstat(), ez_setstat(), ez_delete();
-static int ez_procexit(), ez_getstring(), ez_getparm(), ez_restartp();
-static int ez_hascore();
-struct bnode *ez_create();
+
+struct bnode *ez_create(char *, char *, char *, char *, char *, char *);
+static int ez_hascore(struct bnode *bnode);
+static int ez_restartp(struct bnode *bnode);
+static int ez_delete(struct bnode *bnode);
+static int ez_timeout(struct bnode *bnode);
+static int ez_getstat(struct bnode *bnode, afs_int32 *status);
+static int ez_setstat(struct bnode *bnode, afs_int32 status);
+static int ez_procexit(struct bnode *bnode, struct bnode_proc *proc);
+static int ez_getstring(struct bnode *bnode, char *abuffer, afs_int32 alen);
+static int ez_getparm(struct bnode *bnode, afs_int32, char *, afs_int32);
#define SDTIME 60 /* time in seconds given to a process to evaporate */
};
static int
-ez_hascore(register struct ezbnode *abnode)
+ez_hascore(struct bnode *abnode)
{
char tbuffer[256];
}
static int
-ez_restartp(register struct ezbnode *abnode)
+ez_restartp(struct bnode *bn)
{
+ struct ezbnode *abnode = (struct ezbnode *)bn;
struct bnode_token *tt;
register afs_int32 code;
struct stat tstat;
}
static int
-ez_delete(struct ezbnode *abnode)
+ez_delete(struct bnode *bn)
{
+ struct ezbnode *abnode = (struct ezbnode *)bn;
+
free(abnode->command);
free(abnode);
return 0;
}
struct bnode *
-ez_create(char *ainstance, char *acommand)
+ez_create(char *ainstance, char *acommand, char *unused1, char *unused2,
+ char *unused3, char *unused4)
{
struct ezbnode *te;
char *cmdpath;
te = (struct ezbnode *)malloc(sizeof(struct ezbnode));
memset(te, 0, sizeof(struct ezbnode));
- if (bnode_InitBnode(te, &ezbnode_ops, ainstance) != 0) {
+ if (bnode_InitBnode((struct bnode *)te, &ezbnode_ops, ainstance) != 0) {
free(te);
return NULL;
}
/* called to SIGKILL a process if it doesn't terminate normally */
static int
-ez_timeout(struct ezbnode *abnode)
+ez_timeout(struct bnode *bn)
{
+ struct ezbnode *abnode = (struct ezbnode *)bn;
+
if (!abnode->waitingForShutdown)
return 0; /* spurious */
/* send kill and turn off timer */
bnode_StopProc(abnode->proc, SIGKILL);
abnode->killSent = 1;
- bnode_SetTimeout(abnode, 0);
+ bnode_SetTimeout((struct bnode *)abnode, 0);
return 0;
}
static int
-ez_getstat(struct ezbnode *abnode, afs_int32 * astatus)
+ez_getstat(struct bnode *bn, afs_int32 * astatus)
{
+ struct ezbnode *abnode = (struct ezbnode *)bn;
+
register afs_int32 temp;
if (abnode->waitingForShutdown)
temp = BSTAT_SHUTTINGDOWN;
}
static int
-ez_setstat(register struct ezbnode *abnode, afs_int32 astatus)
+ez_setstat(struct bnode *bn, afs_int32 astatus)
{
+ struct ezbnode *abnode = (struct ezbnode *)bn;
+
struct bnode_proc *tp;
register afs_int32 code;
if (astatus == BSTAT_NORMAL && !abnode->running) {
/* start up */
abnode->lastStart = FT_ApproxTime();
- code = bnode_NewProc(abnode, abnode->command, NULL, &tp);
+ code = bnode_NewProc((struct bnode *)abnode, abnode->command, NULL, &tp);
if (code)
return code;
abnode->running = 1;
/* start shutdown */
bnode_StopProc(abnode->proc, SIGTERM);
abnode->waitingForShutdown = 1;
- bnode_SetTimeout(abnode, SDTIME);
+ bnode_SetTimeout((struct bnode *)abnode, SDTIME);
return 0;
}
return 0;
}
static int
-ez_procexit(struct ezbnode *abnode, struct bnode_proc *aproc)
+ez_procexit(struct bnode *bn, struct bnode_proc *aproc)
{
+ struct ezbnode *abnode = (struct ezbnode *)bn;
+
/* process has exited */
register afs_int32 code;
abnode->waitingForShutdown = 0;
abnode->running = 0;
abnode->killSent = 0;
- abnode->proc = (struct bnode_proc *)0;
- bnode_SetTimeout(abnode, 0); /* clear timer */
+ abnode->proc = NULL;
+ bnode_SetTimeout((struct bnode *) abnode, 0); /* clear timer */
if (abnode->b.goal)
- code = ez_setstat(abnode, BSTAT_NORMAL);
+ code = ez_setstat((struct bnode *) abnode, BSTAT_NORMAL);
else
code = 0;
return code;
}
static int
-ez_getstring(struct ezbnode *abnode, char *abuffer, afs_int32 alen)
+ez_getstring(struct bnode *abnode, char *abuffer, afs_int32 alen)
{
return -1; /* don't have much to add */
}
-static
-ez_getparm(struct ezbnode *abnode, afs_int32 aindex, char *abuffer,
+static int
+ez_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
afs_int32 alen)
{
+ struct ezbnode *abnode = (struct ezbnode *) bn;
if (aindex > 0)
return BZDOM;
strcpy(abuffer, abnode->command);
#include <sys/types.h>
#include <lwp.h>
+#include <rx/rx.h>
#include <errno.h>
#include <stdio.h>
#ifdef AFS_SUN5_ENV
char needsClock; /* do we need clock ticks */
};
-
-
struct bnode * fs_create(char *ainstance, char *afilecmd, char *avolcmd,
char *asalcmd, char *ascancmd);
struct bnode * dafs_create(char *ainstance, char *afilecmd, char *avolcmd,
char * asalsrvcmd, char *asalcmd, char *ascancmd);
-static int fs_hascore(register struct ezbnode *abnode);
-static int fs_restartp(register struct fsbnode *abnode);
-static int SetSalFlag(register struct fsbnode *abnode, register int aflag);
-static int RestoreSalFlag(register struct fsbnode *abnode);
-static int fs_delete(struct fsbnode *abnode);
-static int fs_timeout(struct fsbnode *abnode);
-static int fs_getstat(struct fsbnode *abnode, afs_int32 * astatus);
-static int fs_setstat(register struct fsbnode *abnode, afs_int32 astatus);
-static int fs_procexit(struct fsbnode *abnode, struct bnode_proc *aproc);
-static int fs_getstring(struct fsbnode *abnode, char *abuffer, afs_int32 alen);
-
-
-static int fs_getparm(struct fsbnode *abnode, afs_int32 aindex,
+static int fs_hascore(struct bnode *abnode);
+static int fs_restartp(struct bnode *abnode);
+static int fs_delete(struct bnode *abnode);
+static int fs_timeout(struct bnode *abnode);
+static int fs_getstat(struct bnode *abnode, afs_int32 * astatus);
+static int fs_setstat(struct bnode *abnode, afs_int32 astatus);
+static int fs_procexit(struct bnode *abnode, struct bnode_proc *aproc);
+static int fs_getstring(struct bnode *abnode, char *abuffer, afs_int32 alen);
+static int fs_getparm(struct bnode *abnode, afs_int32 aindex,
char *abuffer, afs_int32 alen);
-static int dafs_getparm(struct fsbnode *abnode, afs_int32 aindex,
+static int dafs_getparm(struct bnode *abnode, afs_int32 aindex,
char *abuffer, afs_int32 alen);
+static int SetSalFlag(struct fsbnode *abnode, int aflag);
+static int RestoreSalFlag(struct fsbnode *abnode);
+static void SetNeedsClock(struct fsbnode *);
+static int NudgeProcs(struct fsbnode *);
+
#ifdef AFS_NT40_ENV
static void AppendExecutableExtension(char *cmd);
#else
#define AppendExecutableExtension(x)
#endif
-static void SetNeedsClock(register struct fsbnode *ab);
-static int NudgeProcs(register struct fsbnode *abnode);
-
-
-
struct bnode_ops fsbnode_ops = {
fs_create,
fs_timeout,
fs_hascore,
};
+/* Quick inline function to safely convert a fsbnode to a bnode without
+ * dropping type information
+ */
+
+inline struct bnode * fsbnode2bnode(struct fsbnode *abnode) {
+ return (struct bnode *) abnode;
+}
/* Function to tell whether this bnode has a core file or not. You might
* think that this could be in bnode.c, and decide what core files to check
* time the query is done.
*/
static int
-fs_hascore(register struct ezbnode *abnode)
+fs_hascore(struct bnode *abnode)
{
char tbuffer[256];
}
static int
-fs_restartp(register struct fsbnode *abnode)
+fs_restartp(struct bnode *bn)
{
+ struct fsbnode *abnode = (struct fsbnode *)bn;
struct bnode_token *tt;
register afs_int32 code;
struct stat tstat;
}
static int
-fs_delete(struct fsbnode *abnode)
+fs_delete(struct bnode *bn)
{
+ struct fsbnode *abnode = (struct fsbnode *)bn;
+
free(abnode->filecmd);
free(abnode->volcmd);
free(abnode->salcmd);
char *fileCmdpath, *volCmdpath, *salCmdpath, *scanCmdpath;
int bailout = 0;
- te = fileCmdpath = volCmdpath = salCmdpath = scanCmdpath = NULL;
-
+ fileCmdpath = volCmdpath = salCmdpath = scanCmdpath = NULL;
+ te = NULL;
+
/* construct local paths from canonical (wire-format) paths */
if (ConstructLocalBinPath(afilecmd, &fileCmdpath)) {
bozo_Log("BNODE: command path invalid '%s'\n", afilecmd);
te->scancmd = scanCmdpath;
else
te->scancmd = NULL;
- if (bnode_InitBnode(te, &fsbnode_ops, ainstance) != 0) {
+ if (bnode_InitBnode(fsbnode2bnode(te), &fsbnode_ops, ainstance) != 0) {
bailout = 1;
goto done;
}
- bnode_SetTimeout(te, POLLTIME); /* ask for timeout activations every 10 seconds */
+ bnode_SetTimeout(fsbnode2bnode(te), POLLTIME);
+ /* ask for timeout activations every 10 seconds */
RestoreSalFlag(te); /* restore needsSalvage flag based on file's existence */
SetNeedsClock(te); /* compute needsClock field */
return NULL;
}
- return (struct bnode *)te;
+ return fsbnode2bnode(te);
}
/* create a demand attach fs bnode */
char *fileCmdpath, *volCmdpath, *salsrvCmdpath, *salCmdpath, *scanCmdpath;
int bailout = 0;
- te = fileCmdpath = volCmdpath = salsrvCmdpath = salCmdpath = scanCmdpath = NULL;
-
+ fileCmdpath = volCmdpath = salsrvCmdpath = salCmdpath = scanCmdpath = NULL;
+ te = NULL;
+
/* construct local paths from canonical (wire-format) paths */
if (ConstructLocalBinPath(afilecmd, &fileCmdpath)) {
bozo_Log("BNODE: command path invalid '%s'\n", afilecmd);
te->scancmd = scanCmdpath;
else
te->scancmd = NULL;
- if (bnode_InitBnode(te, &dafsbnode_ops, ainstance) != 0) {
+ if (bnode_InitBnode(fsbnode2bnode(te), &dafsbnode_ops, ainstance) != 0) {
bailout = 1;
goto done;
}
- bnode_SetTimeout(te, POLLTIME); /* ask for timeout activations every 10 seconds */
+ bnode_SetTimeout(fsbnode2bnode(te), POLLTIME);
+ /* ask for timeout activations every 10 seconds */
RestoreSalFlag(te); /* restore needsSalvage flag based on file's existence */
SetNeedsClock(te); /* compute needsClock field */
return NULL;
}
- return (struct bnode *)te;
+ return fsbnode2bnode(te);
}
/* called to SIGKILL a process if it doesn't terminate normally */
static int
-fs_timeout(struct fsbnode *abnode)
+fs_timeout(struct bnode *bn)
{
+ struct fsbnode *abnode = (struct fsbnode *)bn;
+
register afs_int32 now;
now = FT_ApproxTime();
}
static int
-fs_getstat(struct fsbnode *abnode, afs_int32 * astatus)
+fs_getstat(struct bnode *bn, afs_int32 * astatus)
{
+ struct fsbnode *abnode = (struct fsbnode *) bn;
+
register afs_int32 temp;
if (abnode->volSDW || abnode->fileSDW || abnode->salSDW
|| abnode->scanSDW || abnode->salsrvSDW)
}
static int
-fs_setstat(register struct fsbnode *abnode, afs_int32 astatus)
+fs_setstat(struct bnode *abnode, afs_int32 astatus)
{
- return NudgeProcs(abnode);
+ return NudgeProcs((struct fsbnode *) abnode);
}
static int
-fs_procexit(struct fsbnode *abnode, struct bnode_proc *aproc)
+fs_procexit(struct bnode *bn, struct bnode_proc *aproc)
{
+ struct fsbnode *abnode = (struct fsbnode *)bn;
+
/* process has exited */
if (aproc == abnode->volProc) {
ab->needsClock = 0; /* halted normally */
else
ab->needsClock = 1; /* other */
- if (ab->needsClock && !bnode_PendingTimeout(ab))
- bnode_SetTimeout(ab, POLLTIME);
+ if (ab->needsClock && !bnode_PendingTimeout(fsbnode2bnode(ab)))
+ bnode_SetTimeout(fsbnode2bnode(ab), POLLTIME);
if (!ab->needsClock)
- bnode_SetTimeout(ab, 0);
+ bnode_SetTimeout(fsbnode2bnode(ab), 0);
}
static int
bozo_Log("Salvager running along with file server!\n");
bozo_Log("Emergency shutdown\n");
emergency = 1;
- bnode_SetGoal(abnode, BSTAT_SHUTDOWN);
+ bnode_SetGoal(fsbnode2bnode(abnode), BSTAT_SHUTDOWN);
bnode_StopProc(abnode->salProc, SIGKILL);
SetNeedsClock(abnode);
return -1;
}
if (!abnode->volRunning) {
abnode->lastVolStart = FT_ApproxTime();
- code = bnode_NewProc(abnode, abnode->volcmd, "vol", &tp);
+ code = bnode_NewProc(fsbnode2bnode(abnode), abnode->volcmd, "vol", &tp);
if (code == 0) {
abnode->volProc = tp;
abnode->volRunning = 1;
if (!abnode->salsrvRunning) {
abnode->lastSalsrvStart = FT_ApproxTime();
code =
- bnode_NewProc(abnode, abnode->salsrvcmd, "salsrv",
+ bnode_NewProc(fsbnode2bnode(abnode), abnode->salsrvcmd, "salsrv",
&tp);
if (code == 0) {
abnode->salsrvProc = tp;
if (!abnode->scanRunning) {
abnode->lastScanStart = FT_ApproxTime();
code =
- bnode_NewProc(abnode, abnode->scancmd, "scanner",
+ bnode_NewProc(fsbnode2bnode(abnode), abnode->scancmd, "scanner",
&tp);
if (code == 0) {
abnode->scanProc = tp;
if (!abnode->fileRunning) {
abnode->lastFileStart = FT_ApproxTime();
code =
- bnode_NewProc(abnode, abnode->filecmd, "file", &tp);
+ bnode_NewProc(fsbnode2bnode(abnode), abnode->filecmd, "file", &tp);
if (code == 0) {
abnode->fileProc = tp;
abnode->fileRunning = 1;
}
if (!abnode->volRunning) {
abnode->lastVolStart = FT_ApproxTime();
- code = bnode_NewProc(abnode, abnode->volcmd, "vol", &tp);
+ code = bnode_NewProc(fsbnode2bnode(abnode), abnode->volcmd, "vol", &tp);
if (code == 0) {
abnode->volProc = tp;
abnode->volRunning = 1;
if (abnode->salsrvcmd && !abnode->salsrvRunning) {
abnode->lastSalsrvStart = FT_ApproxTime();
code =
- bnode_NewProc(abnode, abnode->salsrvcmd, "salsrv",
+ bnode_NewProc(fsbnode2bnode(abnode), abnode->salsrvcmd, "salsrv",
&tp);
if (code == 0) {
abnode->salsrvProc = tp;
if (abnode->scancmd && !abnode->scanRunning) {
abnode->lastScanStart = FT_ApproxTime();
code =
- bnode_NewProc(abnode, abnode->scancmd, "scanner",
+ bnode_NewProc(fsbnode2bnode(abnode), abnode->scancmd, "scanner",
&tp);
if (code == 0) {
abnode->scanProc = tp;
return 0;
/* otherwise, it is safe to start salvager */
if (!abnode->salRunning) {
- code = bnode_NewProc(abnode, abnode->salcmd, "salv", &tp);
+ code = bnode_NewProc(fsbnode2bnode(abnode), abnode->salcmd, "salv", &tp);
if (code == 0) {
abnode->salProc = tp;
abnode->salRunning = 1;
}
static int
-fs_getstring(struct fsbnode *abnode, char *abuffer, afs_int32 alen)
+fs_getstring(struct bnode *bn, char *abuffer, afs_int32 alen)
{
+ struct fsbnode *abnode = (struct fsbnode *)bn;
+
if (alen < 40)
return -1;
if (abnode->b.goal == 1) {
}
static int
-fs_getparm(struct fsbnode *abnode, afs_int32 aindex, char *abuffer,
+fs_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
afs_int32 alen)
{
+ struct fsbnode *abnode = (struct fsbnode *)bn;
+
if (aindex == 0)
strcpy(abuffer, abnode->filecmd);
else if (aindex == 1)
}
static int
-dafs_getparm(struct fsbnode *abnode, afs_int32 aindex, char *abuffer,
+dafs_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
afs_int32 alen)
{
+ struct fsbnode *abnode = (struct fsbnode *)bn;
+
if (aindex == 0)
strcpy(abuffer, abnode->filecmd);
else if (aindex == 1)