/* This work should be handled by physstrat in ca/machdep.c.
This routine written from the RT NFS port strategy routine.
It has been generalized a bit, but should still be pretty clear. */
-int afs_osi_MapStrategy(int (*aproc)(), register struct buf *bp)
+int afs_osi_MapStrategy(int (*aproc)(struct buf *bp), register struct buf *bp)
{
afs_int32 returnCode;
extern struct usr_inode *iget();
struct usr_fileops {
- int (*vno_rw)();
- int (*vno_ioctl)();
- int (*vno_select)();
- int (*vno_closex)();
+ int (*vno_rw)(void);
+ int (*vno_ioctl)(void);
+ int (*vno_select)(void);
+ int (*vno_closex)(void);
};
struct usr_file {
pid_t l_pid;
};
-extern struct usr_ucred *usr_crget();
+extern struct usr_ucred *usr_crget(void);
extern struct usr_ucred *usr_crcopy(struct usr_ucred *);
extern int usr_crhold(struct usr_ucred *);
extern int usr_crfree(struct usr_ucred *);
((sizeof (struct usr_dirent)+4 - (MAXNAMLEN+1)) + (((len)+1 + 3) &~ 3))
struct usr_vnodeops {
- int (*vn_open)();
- int (*vn_close)();
+ int (*vn_open)(char *path, int flags, int mode);
+ int (*vn_close)(int fd);
int (*vn_rdwr)();
- int (*vn_ioctl)();
- int (*vn_select)();
+ int (*vn_ioctl)(void);
+ int (*vn_select)(void);
int (*vn_getattr)();
int (*vn_setattr)();
int (*vn_access)();
/* Note that we don't set CDirty here, this is OK because the rename
* RPC is called synchronously. */
-afsrename(aodp, aname1, andp, aname2, acred, areq)
- struct vcache *aodp, *andp;
- char *aname1, *aname2;
- struct AFS_UCRED *acred;
- struct vrequest *areq;
+int afsrename(struct vcache *aodp, char *aname1, struct vcache *andp,
+ char *aname2, struct AFS_UCRED *acred, struct vrequest *areq)
{
register struct conn *tc;
register afs_int32 code;
return tp;
}
-int afs_icl_EnumerateLogs(int (*aproc)(), char *arock)
+int afs_icl_EnumerateLogs(int (*aproc)(char *name,char *arock,struct afs_icl_log *tp), char *arock)
{
register struct afs_icl_log *tp;
register afs_int32 code;
return code;
}
-int afs_icl_EnumerateSets(int (*aproc)(), char *arock)
+int afs_icl_EnumerateSets(int (*aproc)(char *name,char *arock,struct afs_icl_log *tp), char *arock)
{
register struct afs_icl_set *tp, *np;
register afs_int32 code;
return 0;
}
-int afs_cellname_write()
+int afs_cellname_write(void)
{
struct osi_file *tfile;
struct cell_name *cn;
extern int afs_icl_ZeroLog(register struct afs_icl_log *logp);
extern int afs_icl_LogFree(register struct afs_icl_log *logp);
extern struct afs_icl_log *afs_icl_FindLog(char *name);
-extern int afs_icl_EnumerateLogs(int (*aproc)(), char *arock);
+extern int afs_icl_EnumerateLogs(int (*aproc)(char *name,char *arock,struct afs_icl_log *tp), char *arock);
extern int afs_icl_CreateSet(char *name, struct afs_icl_log *baseLogp,
struct afs_icl_log *fatalLogp, struct afs_icl_set **outSetpp);
extern int afs_icl_CreateSetWithFlags(char *name, struct afs_icl_log *baseLogp,
extern int afs_icl_GetEnable(struct afs_icl_set *setp, afs_int32 eventID,
int *getValuep);
extern int afs_icl_ZeroSet(struct afs_icl_set *setp);
-extern int afs_icl_EnumerateSets(int (*aproc)(), char *arock);
+extern int afs_icl_EnumerateSets(int (*aproc)(char *name,char *arock,struct afs_icl_log *tp), char *arock);
extern int afs_icl_AddLogToSet(struct afs_icl_set *setp, struct afs_icl_log *newlogp);
extern int afs_icl_SetSetStat(struct afs_icl_set *setp, int op);
extern int afs_icl_SetHold(register struct afs_icl_set *setp);
extern void afs_CellInit(void);
extern void shutdown_cell(void);
extern int afs_cellname_init(ino_t inode, int lookupcode);
-extern int afs_cellname_write();
+extern int afs_cellname_write(void);
extern afs_int32 afs_NewCell(char *acellName, afs_int32 *acellHosts,
int aflags, char *linkedcname, u_short fsport, u_short vlport,
int timeout);
extern void osi_DisableAtimes(struct vnode *avp);
extern int afs_osi_Read(register struct osi_file *afile, int offset, void *aptr, afs_int32 asize);
extern int afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr, afs_int32 asize);
-extern int afs_osi_MapStrategy(int (*aproc)(), register struct buf *bp);
+extern int afs_osi_MapStrategy(int (*aproc)(struct buf *bp), register struct buf *bp);
extern void shutdown_osifile(void);
/* VNOPS/afs_vnop_rename.c */
-extern int afsrename();
+extern int afsrename(struct vcache *aodp, char *aname1, struct vcache *andp,
+ char *aname2, struct AFS_UCRED *acred, struct vrequest *areq);
/* VNOPS/afs_vnop_symlink.c */
}
/* call aproc(entry, arock, adir) for all cells. Proc must return 0, or we'll stop early and return the code it returns */
-int afsconf_CellApply(struct afsconf_dir *adir, int (*aproc)(), char *arock)
+int afsconf_CellApply(struct afsconf_dir *adir, int (*aproc)(struct afsconf_cell *cell,
+ char *arock, struct afsconf_dir *dir), char *arock)
{
register struct afsconf_entry *tde;
register afs_int32 code;
/* call aproc(entry, arock, adir) for all cell aliases.
* Proc must return 0, or we'll stop early and return the code it returns
*/
-int afsconf_CellAliasApply(struct afsconf_dir *adir, int (*aproc)(), char *arock)
+int afsconf_CellAliasApply(struct afsconf_dir *adir, int (*aproc)(
+ struct afsconf_cellalias *alias, char *arock, struct afsconf_dir *dir), char *arock)
{
register struct afsconf_aliasentry *tde;
register afs_int32 code;
};
extern struct afsconf_dir *afsconf_Open(register const char *adir);
-extern int afsconf_CellApply(struct afsconf_dir *adir, int (*aproc)(), char *arock);
-extern int afsconf_CellAliasApply(struct afsconf_dir *adir, int (*aproc)(), char *arock);
+extern int afsconf_CellApply(struct afsconf_dir *adir, int (*aproc)(struct afsconf_cell *cell,
+ char *arock, struct afsconf_dir *dir), char *arock);
+extern int afsconf_CellAliasApply(struct afsconf_dir *adir, int (*aproc)(
+ struct afsconf_cellalias *alias, char *arock, struct afsconf_dir *dir), char *arock);
extern int afsconf_GetExtendedCellInfo(struct afsconf_dir *adir,
char *acellName, char *aservice, struct afsconf_cell *acellInfo,
char clones[]);
static int nbuffers;
static int calls=0, ios=0, lastb=0;
static char *BufferData;
-static struct buffer *newslot();
+static struct buffer *newslot (struct ubik_dbase *adbase, afs_int32 afid, afs_int32 apage);
static initd = 0;
#define BADFID 0xffffffff
-static DTrunc();
+static DTrunc(struct ubik_dbase *dbase, afs_int32 fid, afs_int32 length);
static struct ubik_trunc *freeTruncList=0;
/* remove a transaction from the database's active transaction list. Don't free it */
-static unthread(atrans)
- struct ubik_trans *atrans; {
+static int unthread(struct ubik_trans *atrans)
+{
struct ubik_trans **lt, *tt;
lt = &atrans->dbase->activeTrans;
for(tt = *lt; tt; lt = &tt->next, tt = *lt) {
}
/* some debugging assistance */
-udisk_Debug(aparm)
- struct ubik_debug *aparm; {
+int udisk_Debug(struct ubik_debug *aparm)
+{
struct buffer *tb;
int i;
*/
/* write an opcode to the log */
-udisk_LogOpcode(adbase, aopcode, async)
- struct ubik_dbase *adbase;
- afs_int32 aopcode;
- int async; {
+int udisk_LogOpcode(struct ubik_dbase *adbase, afs_int32 aopcode, int async)
+{
struct ubik_stat ustat;
afs_int32 code;
}
/* log a commit, never syncing */
-udisk_LogEnd(adbase, aversion)
- struct ubik_dbase *adbase;
- struct ubik_version *aversion; {
+int udisk_LogEnd(struct ubik_dbase *adbase, struct ubik_version *aversion)
+{
afs_int32 code;
afs_int32 data[3];
struct ubik_stat ustat;
}
/* log a truncate operation, never syncing */
-udisk_LogTruncate(adbase, afile, alength)
- struct ubik_dbase *adbase;
- afs_int32 afile, alength; {
+int udisk_LogTruncate(struct ubik_dbase *adbase, afs_int32 afile, afs_int32 alength)
+{
afs_int32 code;
afs_int32 data[3];
struct ubik_stat ustat;
}
/* write some data to the log, never syncing */
-udisk_LogWriteData(adbase, afile, abuffer, apos, alen)
- struct ubik_dbase *adbase;
- char *abuffer;
- afs_int32 afile;
- afs_int32 apos;
- afs_int32 alen; {
+int udisk_LogWriteData(struct ubik_dbase *adbase, afs_int32 afile, char *abuffer, afs_int32 apos, afs_int32 alen)
+{
struct ubik_stat ustat;
afs_int32 code;
afs_int32 data[4];
return 0;
}
-static int DInit (abuffers)
- int abuffers; {
+static int DInit (int abuffers)
+{
/* Initialize the venus buffer system. */
int i;
struct buffer *tb;
}
/* Take a buffer and mark it as the least recently used buffer */
-static void Dlru(abuf)
- struct buffer *abuf;
+static void Dlru(struct buffer *abuf)
{
if (LruBuffer == abuf)
return;
}
/* Take a buffer and mark it as the most recently used buffer */
-static void Dmru(abuf)
- struct buffer *abuf;
+static void Dmru(struct buffer *abuf)
{
if (LruBuffer == abuf) {
LruBuffer = LruBuffer->lru_next;
}
/* get a pointer to a particular buffer */
-static char *DRead(dbase, fid, page)
- struct ubik_dbase *dbase;
- afs_int32 fid;
- int page; {
+static char *DRead(struct ubik_dbase *dbase, afs_int32 fid, int page)
+{
/* Read a page from the disk. */
struct buffer *tb, *lastbuffer;
afs_int32 code;
}
/* zap truncated pages */
-static DTrunc(dbase, fid, length)
- struct ubik_dbase *dbase;
- afs_int32 fid;
- afs_int32 length; {
+static int DTrunc(struct ubik_dbase *dbase, afs_int32 fid, afs_int32 length)
+{
afs_int32 maxPage;
struct buffer *tb;
int i;
performing them immediately, so that we can abort a transaction easily by simply purging
the in-core memory buffers and discarding these truncation entries.
*/
-static struct ubik_trunc *GetTrunc() {
+static struct ubik_trunc *GetTrunc(void)
+{
struct ubik_trunc *tt;
if (!freeTruncList) {
freeTruncList = (struct ubik_trunc *) malloc(sizeof(struct ubik_trunc));
}
/* free a truncation entry */
-static PutTrunc(at)
- struct ubik_trunc *at; {
+static int PutTrunc(struct ubik_trunc *at)
+{
at->next = freeTruncList;
freeTruncList = at;
return 0;
}
/* find a truncation entry for a file, if any */
-static struct ubik_trunc *FindTrunc(atrans, afile)
- struct ubik_trans *atrans;
- afs_int32 afile; {
+static struct ubik_trunc *FindTrunc(struct ubik_trans *atrans, afs_int32 afile)
+{
struct ubik_trunc *tt;
for(tt=atrans->activeTruncs; tt; tt=tt->next) {
if (tt->file == afile) return tt;
}
/* do truncates associated with trans, and free them */
-static DoTruncs(atrans)
- struct ubik_trans *atrans; {
+static int DoTruncs(struct ubik_trans *atrans)
+{
struct ubik_trunc *tt, *nt;
int (*tproc)();
afs_int32 rcode=0, code;
}
/* mark a fid as invalid */
-udisk_Invalidate(adbase, afid)
-struct ubik_dbase *adbase;
-afs_int32 afid; {
+int udisk_Invalidate(struct ubik_dbase *adbase, afs_int32 afid)
+{
struct buffer *tb;
int i;
}
/* move this page into the correct hash bucket */
-static FixupBucket(ap)
- struct buffer *ap; {
+static int FixupBucket(struct buffer *ap)
+{
struct buffer **lp, *tp;
int i;
/* first try to get it out of its current hash bucket, in which it might not be */
}
/* create a new slot for a particular dbase page */
-static struct buffer *newslot (adbase, afid, apage)
- struct ubik_dbase *adbase;
- afs_int32 afid, apage; {
+static struct buffer *newslot (struct ubik_dbase *adbase, afs_int32 afid, afs_int32 apage)
+{
/* Find a usable buffer slot */
afs_int32 i;
struct buffer *pp, *tp;
}
/* Release a buffer, specifying whether or not the buffer has been modified by the locker. */
-static void DRelease (ap,flag)
- char *ap;
- int flag; {
+static void DRelease (char *ap, int flag)
+{
int index;
struct buffer *bp;
* files that were written, and to clear the dirty bits. You should
* always call DFlush/DSync as a pair.
*/
-static DFlush (adbase)
- struct ubik_dbase *adbase; {
+static int DFlush (struct ubik_dbase *adbase)
+{
int i;
afs_int32 code;
struct buffer *tb;
}
/* flush all modified buffers */
-static DAbort (adbase)
- struct ubik_dbase *adbase; {
+static int DAbort (struct ubik_dbase *adbase)
+{
int i;
struct buffer *tb;
}
/* must only be called after DFlush, due to its interpretation of dirty flag */
-static DSync(adbase)
- struct ubik_dbase *adbase; {
+static int DSync(struct ubik_dbase *adbase)
+{
int i;
afs_int32 code;
struct buffer *tb;
}
/* Same as read, only do not even try to read the page */
-static char *DNew (dbase, fid, page)
- struct ubik_dbase *dbase;
- int page;
- afs_int32 fid; {
+static char *DNew (struct ubik_dbase *dbase, afs_int32 fid, int page)
+{
struct buffer *tb;
if ((tb = newslot(dbase, fid, page)) == 0) return NULL;
}
/* read data from database */
-udisk_read(atrans, afile, abuffer, apos, alen)
- afs_int32 afile;
- char *abuffer;
- afs_int32 apos, alen;
- struct ubik_trans *atrans; {
+int udisk_read(struct ubik_trans *atrans, afs_int32 afile, char *abuffer, afs_int32 apos, afs_int32 alen)
+{
char *bp;
afs_int32 offset, len, totalLen;
struct ubik_dbase *dbase;
}
/* truncate file */
-udisk_truncate(atrans, afile, alength)
- struct ubik_trans *atrans;
- afs_int32 afile;
- afs_int32 alength; {
+int udisk_truncate(struct ubik_trans *atrans, afs_int32 afile, afs_int32 alength)
+{
afs_int32 code;
struct ubik_trunc *tt;
}
/* write data to database, using logs */
-udisk_write(atrans, afile, abuffer, apos, alen)
- afs_int32 afile;
- char *abuffer;
- afs_int32 apos, alen;
- struct ubik_trans *atrans; {
+int udisk_write(struct ubik_trans *atrans, afs_int32 afile, char *abuffer, afs_int32 apos, afs_int32 alen)
+{
char *bp;
afs_int32 offset, len, totalLen;
struct ubik_dbase *dbase;
}
/* begin a new local transaction */
-udisk_begin(adbase, atype, atrans)
- struct ubik_trans **atrans;
- int atype;
- struct ubik_dbase *adbase; {
+int udisk_begin(struct ubik_dbase *adbase, int atype, struct ubik_trans **atrans)
+{
afs_int32 code;
struct ubik_trans *tt;
}
/* commit transaction */
-udisk_commit(atrans)
- struct ubik_trans *atrans; {
+int udisk_commit(struct ubik_trans *atrans)
+{
struct ubik_dbase *dbase;
afs_int32 code=0;
struct ubik_version oldversion, newversion;
}
/* abort transaction */
-udisk_abort(atrans)
- struct ubik_trans *atrans;
+int udisk_abort(struct ubik_trans *atrans)
{
struct ubik_dbase *dbase;
afs_int32 code;
* it hasn't committed before you call this routine, we'll abort the
* transaction for you.
*/
-udisk_end(atrans)
- struct ubik_trans *atrans; {
+int udisk_end(struct ubik_trans *atrans)
+{
struct ubik_dbase *dbase;
#if defined(UBIK_PAUSE)
static char pbuffer[1024];
/* beware, when using this function, of the header in front of most files */
-static int uphys_open(adbase, afid)
- register struct ubik_dbase *adbase;
- afs_int32 afid; {
+static int uphys_open(register struct ubik_dbase *adbase, afs_int32 afid)
+{
char temp[20];
register int fd;
static int initd;
}
/* close the file, maintaining ref count in cache structure */
-uphys_close (afd)
-register int afd; {
+int uphys_close (register int afd)
+{
register int i;
register struct fdcache *tfd;
return close(afd);
}
-uphys_stat(adbase, afid, astat)
- struct ubik_stat *astat;
- afs_int32 afid;
- struct ubik_dbase *adbase; {
+int uphys_stat(struct ubik_dbase *adbase, afs_int32 afid, struct ubik_stat *astat)
+{
register int fd;
struct stat tstat;
register afs_int32 code;
return 0;
}
-uphys_read(adbase, afile, abuffer, apos, alength)
- register struct ubik_dbase *adbase;
- register char *abuffer;
- afs_int32 apos;
- afs_int32 afile;
- afs_int32 alength; {
+int uphys_read(register struct ubik_dbase *adbase, afs_int32 afile, register char *abuffer,
+ afs_int32 apos, afs_int32 alength)
+{
register int fd;
register afs_int32 code;
return code;
}
-uphys_write(adbase, afile, abuffer, apos, alength)
- register struct ubik_dbase *adbase;
- register char *abuffer;
- afs_int32 apos;
- afs_int32 afile;
- afs_int32 alength; {
+int uphys_write(register struct ubik_dbase *adbase, afs_int32 afile, register char *abuffer,
+ afs_int32 apos, afs_int32 alength)
+{
register int fd;
register afs_int32 code;
afs_int32 length;
else return length;
}
-uphys_truncate(adbase, afile, asize)
- afs_int32 asize;
- register struct ubik_dbase *adbase;
- afs_int32 afile; {
+int uphys_truncate(register struct ubik_dbase *adbase, afs_int32 afile, afs_int32 asize)
+{
register afs_int32 code, fd;
fd = uphys_open(adbase, afile);
if (fd < 0) return UNOENT;
}
/* get number of dbase files */
-uphys_getnfiles(adbase) {
+int uphys_getnfiles(register struct ubik_dbase *adbase)
+{
/* really should scan dir for data */
return 1;
}
/* get database label, with aversion in host order */
-uphys_getlabel(adbase, afile, aversion)
- register struct ubik_dbase *adbase;
- afs_int32 afile;
- struct ubik_version *aversion; {
+int uphys_getlabel(register struct ubik_dbase *adbase, afs_int32 afile, struct ubik_version *aversion)
+{
struct ubik_hdr thdr;
register afs_int32 code, fd;
}
/* label database, with aversion in host order */
-uphys_setlabel(adbase, afile, aversion)
- register struct ubik_dbase *adbase;
- afs_int32 afile;
- struct ubik_version *aversion; {
+int uphys_setlabel(register struct ubik_dbase *adbase, afs_int32 afile, struct ubik_version *aversion)
+{
struct ubik_hdr thdr;
register afs_int32 code, fd;
return 0;
}
-uphys_sync(adbase, afile)
- register struct ubik_dbase *adbase;
- afs_int32 afile; {
+int uphys_sync(register struct ubik_dbase *adbase, afs_int32 afile)
+{
register afs_int32 code, fd;
fd = uphys_open(adbase, afile);
code = fsync(fd);
*/
int ubikPrimaryAddrOnly;
-urecovery_ResetState() {
+int urecovery_ResetState(void)
+{
urecovery_state = 0;
LWP_NoYieldSignal(&urecovery_state);
return 0;
* process to send missing server the new db when it comes back up.
* This routine should not do anything with variables used by non-sync site servers.
*/
-urecovery_LostServer() {
+int urecovery_LostServer(void)
+{
LWP_NoYieldSignal(&urecovery_state);
return 0;
}
* site, then we must have a dbase labelled with the right version,
* and we must have a currently-good sync site.
*/
-urecovery_AllBetter(adbase, areadAny)
- int areadAny;
- register struct ubik_dbase *adbase; {
+int urecovery_AllBetter(register struct ubik_dbase *adbase, int areadAny)
+{
register afs_int32 rcode;
ubik_dprint("allbetter checking\n");
}
/* abort all transactions on this database */
-urecovery_AbortAll(adbase)
-struct ubik_dbase *adbase; {
+int urecovery_AbortAll(struct ubik_dbase *adbase)
+{
register struct ubik_trans *tt;
for(tt = adbase->activeTrans; tt; tt=tt->next) {
udisk_abort(tt);
}
/* this routine aborts the current remote transaction, if any, if the tid is wrong */
-urecovery_CheckTid(atid)
- register struct ubik_tid *atid; {
+int urecovery_CheckTid(register struct ubik_tid *atid)
+{
if (ubik_currentTrans) {
/* there is remote write trans, see if we match, see if this
* is a new transaction */
*/
/* replay logs */
-static ReplayLog(adbase)
- register struct ubik_dbase *adbase; {
+static int ReplayLog(register struct ubik_dbase *adbase)
+{
afs_int32 opcode;
register afs_int32 code, tpos;
int logIsGood;
/* Called at initialization to figure out version of the dbase we really have.
* This routine is called after replaying the log; it reads the restored labels.
*/
-static InitializeDB(adbase)
- register struct ubik_dbase *adbase; {
+static int InitializeDB(register struct ubik_dbase *adbase)
+{
register afs_int32 code;
code = (*adbase->getlabel)(adbase, 0, &adbase->version);
/* initialize the local dbase
* We replay the logs and then read the resulting file to figure out what version we've really got.
*/
-urecovery_Initialize(adbase)
- register struct ubik_dbase *adbase; {
+int urecovery_Initialize(register struct ubik_dbase *adbase)
+{
register afs_int32 code;
code = ReplayLog(adbase);
* requests. However, the recovery module still has one more task:
* propagating the dbase out to everyone who is up in the network.
*/
-urecovery_Interact() {
+int urecovery_Interact(void)
+{
afs_int32 code, tcode;
struct ubik_server *bestServer = NULL;
struct ubik_server *ts;
** send a Probe to all the network address of this server
** Return 0 if success, else return 1
*/
-DoProbe(server)
-struct ubik_server *server;
+int DoProbe(struct ubik_server *server)
{
struct rx_connection *conns[UBIK_MAX_INTERFACE_ADDR];
struct rx_connection *connSuccess = 0;
Note that the host named by myHost should not also be listed in serverList.
*/
-int ubik_ServerInitByInfo(myHost, myPort, info, clones, pathName, dbase)
- struct afsconf_cell *info; /* in */
- char clones[];
- afs_int32 myHost;
- short myPort;
- char *pathName; /* in */
- struct ubik_dbase **dbase; /* out */
+int ubik_ServerInitByInfo(afs_int32 myHost, short myPort, struct afsconf_cell *info,
+ char clones[], char *pathName, struct ubik_dbase **dbase)
{
afs_int32 code;
return code;
}
-int ubik_ServerInit(myHost, myPort, serverList, pathName, dbase)
- afs_int32 serverList[]; /* in */
- afs_int32 myHost;
- short myPort;
- char *pathName; /* in */
- struct ubik_dbase **dbase; /* out */
+int ubik_ServerInit(afs_int32 myHost, short myPort, afs_int32 serverList[], char *pathName,
+ struct ubik_dbase **dbase)
{
afs_int32 code;
return code;
}
-int ubik_ServerInitCommon(myHost, myPort, info, clones, serverList, pathName, dbase)
- afs_int32 myHost;
- short myPort;
- struct afsconf_cell *info; /* in */
- char clones[];
- afs_int32 serverList[]; /* in */
- char *pathName; /* in */
- struct ubik_dbase **dbase; /* out */
+int ubik_ServerInitCommon(afs_int32 myHost, short myPort, struct afsconf_cell *info,
+ char clones[], afs_int32 serverList[], char *pathName, struct ubik_dbase **dbase)
{
register struct ubik_dbase *tdb;
register afs_int32 code;
We can only begin transaction when we have an up-to-date database.
*/
-static int BeginTrans(dbase, transMode, transPtr, readAny)
- register struct ubik_dbase *dbase; /* in */
- int readAny;
- afs_int32 transMode; /* in */
- struct ubik_trans **transPtr; /* out */ {
+static int BeginTrans(register struct ubik_dbase *dbase, afs_int32 transMode,
+ struct ubik_trans **transPtr, int readAny)
+{
struct ubik_trans *jt;
register struct ubik_trans *tt;
register afs_int32 code;
return 0;
}
-int ubik_BeginTrans(dbase, transMode, transPtr)
- register struct ubik_dbase *dbase; /* in */
- afs_int32 transMode; /* in */
- struct ubik_trans **transPtr; /* out */ {
+int ubik_BeginTrans(register struct ubik_dbase *dbase, afs_int32 transMode,
+ struct ubik_trans **transPtr)
+{
return BeginTrans(dbase, transMode, transPtr, 0);
}
-int ubik_BeginTransReadAny(dbase, transMode, transPtr)
- register struct ubik_dbase *dbase; /* in */
- afs_int32 transMode; /* in */
- struct ubik_trans **transPtr; /* out */ {
+int ubik_BeginTransReadAny(register struct ubik_dbase *dbase, afs_int32 transMode,
+ struct ubik_trans **transPtr)
+{
return BeginTrans(dbase, transMode, transPtr, 1);
}
/* this routine ends a read or write transaction by aborting it */
-int ubik_AbortTrans(transPtr)
- register struct ubik_trans *transPtr; /* in */ {
+int ubik_AbortTrans(register struct ubik_trans *transPtr)
+{
register afs_int32 code;
afs_int32 code2;
register struct ubik_dbase *dbase;
}
/* This routine ends a read or write transaction on the open transaction identified by transPtr. It returns an error code. */
-int ubik_EndTrans(transPtr)
- register struct ubik_trans *transPtr; /* in */ {
+int ubik_EndTrans(register struct ubik_trans *transPtr)
+{
register afs_int32 code;
struct timeval tv;
afs_int32 realStart;
/* This routine reads length bytes into buffer from the current position in the database. The file pointer is updated appropriately (by adding the number of bytes actually transferred), and the length actually transferred is stored in the long integer pointed to by length. Note that *length is an INOUT parameter: at the start it represents the size of the buffer, and when done, it contains the number of bytes actually transferred. A short read returns zero for an error code. */
-int ubik_Read(transPtr, buffer, length)
- register struct ubik_trans *transPtr; /* in */
- char *buffer; /* in */
- afs_int32 length; /* in */ {
+int ubik_Read(register struct ubik_trans *transPtr, char *buffer, afs_int32 length)
+{
register afs_int32 code;
/* reads are easy to do: handle locally */
* flushes to the local disk and then uses ContactQuorum to write it to
* the other servers.
*/
-int ubik_Flush(transPtr)
- struct ubik_trans *transPtr;
+int ubik_Flush(struct ubik_trans *transPtr)
{
afs_int32 code, error=0;
return error;
}
-int ubik_Write(transPtr, buffer, length)
- register struct ubik_trans *transPtr; /* in */
- char *buffer; /* in */
- afs_int32 length; /* in */
+int ubik_Write(register struct ubik_trans *transPtr, char *buffer, afs_int32 length)
{
struct ubik_iovec *iovec;
afs_int32 code, error=0;
/* This sets the file pointer associated with the current transaction to the appropriate file and byte position. Unlike Unix files, a transaction is labelled by both a file number (fileid) and a byte position relative to the specified file (position). */
-int ubik_Seek(transPtr, fileid, position)
- register struct ubik_trans *transPtr; /* IN */
- afs_int32 fileid; /* IN */
- afs_int32 position; /* IN */ {
+int ubik_Seek(register struct ubik_trans *transPtr, afs_int32 fileid, afs_int32 position)
+{
register afs_int32 code;
DBHOLD(transPtr->dbase);
/* This call returns the file pointer associated with the specified transaction in fileid and position. */
-int ubik_Tell(transPtr, fileid, position)
- register struct ubik_trans *transPtr; /* IN */
- afs_int32 *fileid; /* OUT */
- afs_int32 *position; /* OUT */ {
+int ubik_Tell(register struct ubik_trans *transPtr, afs_int32 *fileid, afs_int32 *position)
+{
DBHOLD(transPtr->dbase);
*fileid = transPtr->seekFile;
*position = transPtr->seekPos;
/* This sets the file size for the currently-selected file to length bytes, if length is less than the file's current size. */
-int ubik_Truncate(transPtr, length)
- register struct ubik_trans *transPtr; /* in */
- afs_int32 length; /* in */ {
+int ubik_Truncate(register struct ubik_trans *transPtr, afs_int32 length)
+{
afs_int32 code, error=0;
/* Will also catch if not UBIK_WRITETRANS */
}
/* set a lock; all locks are released on transaction end (commit/abort) */
-ubik_SetLock(atrans, apos, alen, atype)
- struct ubik_trans *atrans;
- afs_int32 apos, alen; /* apos and alen are not used */
- int atype; {
+int ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos, afs_int32 alen, int atype)
+{
afs_int32 code=0, error=0;
if (atype == LOCKWRITE) {
}
/* utility to wait for a version # to change */
-int ubik_WaitVersion(adatabase, aversion)
-register struct ubik_version *aversion;
-register struct ubik_dbase *adatabase; {
+int ubik_WaitVersion(register struct ubik_dbase *adatabase, register struct ubik_version *aversion)
+{
while (1) {
/* wait until version # changes, and then return */
if (vcmp(*aversion, adatabase->version) != 0)
}
/* utility to get the version of the dbase a transaction is dealing with */
-int ubik_GetVersion(atrans, avers)
-register struct ubik_trans *atrans;
-register struct ubik_version *avers; {
+int ubik_GetVersion(register struct ubik_trans *atrans, register struct ubik_version *avers)
+{
*avers = atrans->dbase->version;
return 0;
}
caller is a server caching part of the Ubik database, it should invalidate
that cache. A return value of -1 means bad (NULL) argument. */
-int ubik_CacheUpdate (atrans)
- register struct ubik_trans *atrans;
+int ubik_CacheUpdate (register struct ubik_trans *atrans)
{
if (!(atrans && atrans->dbase)) return -1;
return vcmp(atrans->dbase->cachedVersion, atrans->dbase->version) != 0;
}
-int panic(a, b, c, d)
- char *a, *b, *c, *d;
+int panic(char *a, char *b, char *c, char *d)
{
ubik_print("Ubik PANIC: ");
ubik_print(a, b, c, d);
** This functions takes an IP addresses as its parameter. It returns the
** the primary IP address that is on the host passed in.
*/
-afs_uint32
-ubikGetPrimaryInterfaceAddr(addr)
-afs_uint32 addr; /* network byte order */
+afs_uint32 ubikGetPrimaryInterfaceAddr(afs_uint32 addr)
{
struct ubik_server *ts;
int j;
afs_int32 tidCounter; /* last RW or RO trans tid counter */
afs_int32 writeTidCounter; /* last write trans tid counter */
afs_int32 flags; /* flags */
- int (*read)(); /* physio procedures */
- int (*write)();
- int (*truncate)();
- int (*sync)();
- int (*stat)();
- int (*open)();
- int (*setlabel)(); /* set the version label */
- int (*getlabel)(); /* retrieve the version label */
- int (*getnfiles)(); /* find out number of files */
+ /* physio procedures */
+ int (*read)(struct ubik_dbase *adbase, afs_int32 afile, char *abuffer,
+ afs_int32 apos, afs_int32 alength);
+ int (*write)(struct ubik_dbase *adbase, afs_int32 afile, char *abuffer,
+ afs_int32 apos, afs_int32 alength);
+ int (*truncate)(struct ubik_dbase *adbase, afs_int32 afile, afs_int32 asize);
+ int (*sync)(struct ubik_dbase *adbase, afs_int32 afile);
+ int (*stat)(struct ubik_dbase *adbase, afs_int32 afid, struct ubik_stat *astat);
+ int (*open)(struct ubik_dbase *adbase, afs_int32 afid);
+ int (*setlabel)(struct ubik_dbase *adbase, afs_int32 afile, struct ubik_version *aversion); /* set the version label */
+ int (*getlabel)(struct ubik_dbase *adbase, afs_int32 afile, struct ubik_version *aversion); /* retrieve the version label */
+ int (*getnfiles)(struct ubik_dbase *adbase); /* find out number of files */
short readers; /* number of current read transactions */
struct ubik_version cachedVersion; /* version of caller's cached data */
};
/* this extern gives the sync site's db version, with epoch of 0 if none yet */
-extern int uphys_read();
-extern int uphys_write();
-extern int uphys_truncate();
-extern int uphys_sync();
-/*
- * This is static.
-extern int uphys_open();
- */
-extern int uphys_stat();
-extern int uphys_getlabel();
-extern int uphys_setlabel();
-extern int uphys_getnfiles();
+/* phys.c */
+extern int uphys_close (register int afd);
+extern int uphys_stat(struct ubik_dbase *adbase, afs_int32 afid, struct ubik_stat *astat);
+extern int uphys_read(register struct ubik_dbase *adbase, afs_int32 afile, register char *abuffer,
+ afs_int32 apos, afs_int32 alength);
+extern int uphys_write(register struct ubik_dbase *adbase, afs_int32 afile, register char *abuffer,
+ afs_int32 apos, afs_int32 alength);
+extern int uphys_truncate(register struct ubik_dbase *adbase, afs_int32 afile, afs_int32 asize);
+extern int uphys_getnfiles(register struct ubik_dbase *adbase);
+extern int uphys_getlabel(register struct ubik_dbase *adbase, afs_int32 afile, struct ubik_version *aversion);
+extern int uphys_setlabel(register struct ubik_dbase *adbase, afs_int32 afile, struct ubik_version *aversion);
+extern int uphys_sync(register struct ubik_dbase *adbase, afs_int32 afile);
+
+
+/* recovery.c */
+extern int urecovery_ResetState(void);
+extern int urecovery_LostServer(void);
+extern int urecovery_AllBetter(register struct ubik_dbase *adbase, int areadAny);
+extern int urecovery_AbortAll(struct ubik_dbase *adbase);
+extern int urecovery_CheckTid(register struct ubik_tid *atid);
+extern int urecovery_Initialize(register struct ubik_dbase *adbase);
+extern int urecovery_Interact(void);
+extern int DoProbe(struct ubik_server *server);
+
+
extern int ubeacon_Interact();
-extern int urecovery_Interact();
extern int sdisk_Interact();
extern int uvote_Interact();
extern int DISK_Abort();
extern struct hostent *hostutil_GetHostByName();
-static short PortNumber(aport)
-register char *aport; {
+static short PortNumber(register char *aport)
+{
register int tc;
register afs_int32 total;
return(total);
}
-static short PortName(aname)
- char *aname;
+static short PortName(char *aname)
{
struct servent *ts;
int len;
return(-1);
}
-static CommandProc(as, arock)
-char *arock;
-struct cmd_syndesc *as; {
+static int CommandProc(struct cmd_syndesc *as, char *arock)
+{
char *hostName, *portName, *times;
afs_int32 hostAddr;
struct in_addr inhostAddr;
#include "AFS_component_version_number.c"
-int
-main(argc, argv)
- int argc;
- char **argv; {
+int main(int argc, char **argv)
+{
struct cmd_syndesc *ts;
#ifdef AFS_AIX32_ENV
*
* This function returns true if we should run, and false otherwise.
*/
-int uvote_ShouldIRun() {
+int uvote_ShouldIRun(void)
+{
register afs_int32 now;
now = FT_ApproxTime();
* This function returns 0 or currently valid sync site. It can return our own
* address, if we're the sync site.
*/
-afs_int32 uvote_GetSyncSite() {
+afs_int32 uvote_GetSyncSite(void)
+{
register afs_int32 now;
register afs_int32 code;
* not voting for this sync site, or the time we actually voted yes, if
* non-zero.
*/
-afs_int32 SVOTE_Beacon(rxcall, astate, astart, avers, atid)
- register struct rx_call *rxcall;
- afs_int32 astate;
- struct ubik_version *avers;
- struct ubik_tid *atid;
- afs_int32 astart;
+afs_int32 SVOTE_Beacon(register struct rx_call *rxcall, afs_int32 astate,
+ afs_int32 astart, struct ubik_version *avers, struct ubik_tid *atid)
{
register afs_int32 otherHost;
register afs_int32 now;
/* handle per-server debug command, where 0 is the first server. Basic network
debugging hooks. */
-afs_int32 SVOTE_SDebug(rxcall, awhich, aparm)
- struct rx_call *rxcall;
- afs_int32 awhich;
- register struct ubik_sdebug *aparm;
+afs_int32 SVOTE_SDebug(struct rx_call *rxcall, afs_int32 awhich,
+ register struct ubik_sdebug *aparm)
{
afs_int32 code, isClone;
code = SVOTE_XSDebug(rxcall, awhich, aparm, &isClone);
return code;
}
-afs_int32 SVOTE_XSDebug(rxcall, awhich, aparm, isclone)
- afs_int32 *isclone;
- struct rx_call *rxcall;
- afs_int32 awhich;
- register struct ubik_sdebug *aparm;
+afs_int32 SVOTE_XSDebug(struct rx_call *rxcall, afs_int32 awhich,
+ register struct ubik_sdebug *aparm, afs_int32 *isclone)
{
register struct ubik_server *ts;
register int i;
return 2;
}
-afs_int32 SVOTE_XDebug(rxcall, aparm, isclone)
- struct rx_call *rxcall;
- register struct ubik_debug *aparm;
- afs_int32 *isclone;
+afs_int32 SVOTE_XDebug(struct rx_call *rxcall, register struct ubik_debug *aparm,
+ afs_int32 *isclone)
{
afs_int32 code;
}
/* handle basic network debug command. This is the global state dumper */
-afs_int32 SVOTE_Debug(rxcall, aparm)
- struct rx_call *rxcall;
- register struct ubik_debug *aparm; {
+afs_int32 SVOTE_Debug(struct rx_call *rxcall, register struct ubik_debug *aparm)
+{
int i;
/* fill in the basic debug structure. Note the the RPC protocol transfers,
* integers in host order. */
return 0;
}
-afs_int32 SVOTE_SDebugOld(rxcall, awhich, aparm)
- struct rx_call *rxcall;
- afs_int32 awhich;
- register struct ubik_sdebug_old *aparm; {
+afs_int32 SVOTE_SDebugOld(struct rx_call *rxcall, afs_int32 awhich, register struct ubik_sdebug_old *aparm)
+{
register struct ubik_server *ts;
for(ts=ubik_servers; ts; ts=ts->next) {
/* handle basic network debug command. This is the global state dumper */
-afs_int32 SVOTE_DebugOld(rxcall, aparm)
- struct rx_call *rxcall;
- register struct ubik_debug_old *aparm; {
+afs_int32 SVOTE_DebugOld(struct rx_call *rxcall, register struct ubik_debug_old *aparm)
+{
/* fill in the basic debug structure. Note the the RPC protocol transfers,
* integers in host order. */
/* get the sync site; called by remote servers to find where they should go */
-afs_int32 SVOTE_GetSyncSite(rxcall, ahost)
- register struct rx_call *rxcall;
- register afs_int32 *ahost; {
+afs_int32 SVOTE_GetSyncSite(register struct rx_call *rxcall, register afs_int32 *ahost)
+{
register afs_int32 temp;
temp = uvote_GetSyncSite();
return 0;
}
-ubik_dprint(a,b,c,d,e,f,g,h)
- char *a, *b, *c, *d, *e, *f, *g, *h; {
+int ubik_dprint(char *a, char *b, char *c, char *d, char *e, char *f, char *g, char *h)
+{
ViceLog(5, (a,b,c,d,e,f,g,h));
}
-ubik_print(a,b,c,d,e,f,g,h)
- char *a, *b, *c, *d, *e, *f, *g, *h;
+int ubik_print(char *a, char *b, char *c, char *d, char *e, char *f, char *g, char *h)
{
ViceLog(0, (a,b,c,d,e,f,g,h));
}
/* called once/run to init the vote module */
-uvote_Init() {
+int uvote_Init(void)
+{
/* pretend we just voted for someone else, since we just restarted */
ubik_lastYesTime = FT_ApproxTime();
return 0;
}
/* zero out the log */
-icl_ZeroLog(logp)
- register struct afs_icl_log *logp;
+int icl_ZeroLog(register struct afs_icl_log *logp)
{
logp->firstUsed = logp->firstFree = 0;
logp->logElements = 0;
}
/* free a log entry, and drop its reference count */
-icl_LogFree(logp)
- register struct afs_icl_log *logp;
+int icl_LogFree(register struct afs_icl_log *logp)
{
logp->states |= ICL_LOGF_DELETED;
icl_LogRele(logp);
}
-icl_EnumerateLogs(aproc, arock)
- int (*aproc)();
- char *arock;
+int icl_EnumerateLogs(int (*aproc)(char *name,char *arock,struct afs_icl_log *tp), char *arock)
{
register struct afs_icl_log *tp;
register afs_int32 code;