mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
ubik-prototypes-20090315
LICENSE IPL10 FIXES 124245 prototype the ubik directory
This commit is contained in:
parent
b18ec965dd
commit
d5158b2ccb
@ -30,6 +30,7 @@ RCSID
|
||||
#include <stdio.h>
|
||||
#include <rx/rx.h>
|
||||
#include <lock.h>
|
||||
#define UBIK_LEGACY_CALLITER 1
|
||||
#include <ubik.h>
|
||||
#ifndef AFS_NT40_ENV
|
||||
#include <pwd.h>
|
||||
|
@ -19,6 +19,8 @@
|
||||
RCSID
|
||||
("$Header$");
|
||||
|
||||
#define UBIK_LEGACY_CALLITER 1
|
||||
|
||||
#if defined(UKERNEL)
|
||||
#include "afs/sysincludes.h"
|
||||
#include "afsincludes.h"
|
||||
|
@ -79,7 +79,7 @@ utst_int.cs.o: utst_int.cs.c utst_int.xdr.c
|
||||
utst_int.xdr.o: utst_int.xdr.c utst_int.h
|
||||
|
||||
utst_int.cs.c: utst_int.xg
|
||||
${RXGEN} -A -C -o $@ ${srcdir}/utst_int.xg
|
||||
${RXGEN} -A -C -u -o $@ ${srcdir}/utst_int.xg
|
||||
|
||||
utst_int.ss.c: utst_int.xg
|
||||
${RXGEN} -A -S -o $@ ${srcdir}/utst_int.xg
|
||||
@ -88,7 +88,7 @@ utst_int.xdr.c: utst_int.xg
|
||||
${RXGEN} -A -c -o $@ ${srcdir}/utst_int.xg
|
||||
|
||||
utst_int.h: utst_int.xg
|
||||
${RXGEN} -A -h -o $@ ${srcdir}/utst_int.xg
|
||||
${RXGEN} -A -h -u -o $@ ${srcdir}/utst_int.xg
|
||||
|
||||
utst_int.cs.c: utst_int.h
|
||||
utst_int.ss.c: utst_int.h
|
||||
|
@ -14,6 +14,10 @@ RCSID
|
||||
("$Header$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <winsock2.h>
|
||||
#include <time.h>
|
||||
@ -24,9 +28,8 @@ RCSID
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include <lock.h>
|
||||
#include <string.h>
|
||||
#include <rx/xdr.h>
|
||||
#include <rx/rx.h>
|
||||
#include <rx/rx_multi.h>
|
||||
@ -43,16 +46,23 @@ RCSID
|
||||
/*! \name statics used to determine if we're the sync site */
|
||||
static afs_int32 syncSiteUntil = 0; /*!< valid only if amSyncSite */
|
||||
int ubik_amSyncSite = 0; /*!< flag telling if I'm sync site */
|
||||
static nServers; /*!< total number of servers */
|
||||
static int nServers; /*!< total number of servers */
|
||||
static char amIMagic = 0; /*!< is this host the magic host */
|
||||
char amIClone = 0; /*!< is this a clone which doesn't vote */
|
||||
static char ubik_singleServer = 0;
|
||||
/*\}*/
|
||||
int (*ubik_CRXSecurityProc) ();
|
||||
char *ubik_CRXSecurityRock;
|
||||
int (*ubik_CRXSecurityProc) (void *rock, struct rx_securityClass **,
|
||||
afs_int32 *);
|
||||
void *ubik_CRXSecurityRock;
|
||||
afs_int32 ubikSecIndex;
|
||||
struct rx_securityClass *ubikSecClass;
|
||||
static verifyInterfaceAddress();
|
||||
static int ubeacon_InitServerListCommon(afs_int32 ame,
|
||||
struct afsconf_cell *info,
|
||||
char clones[],
|
||||
afs_int32 aservers[]);
|
||||
static int verifyInterfaceAddress(afs_uint32 *ame, struct afsconf_cell *info,
|
||||
afs_uint32 aservers[]);
|
||||
static int updateUbikNetworkAddress(afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR]);
|
||||
|
||||
|
||||
/*! \file
|
||||
@ -80,8 +90,7 @@ static verifyInterfaceAddress();
|
||||
|
||||
/*! \brief procedure called from debug rpc call to get this module's state for debugging */
|
||||
void
|
||||
ubeacon_Debug(aparm)
|
||||
register struct ubik_debug *aparm;
|
||||
ubeacon_Debug(register struct ubik_debug *aparm)
|
||||
{
|
||||
/* fill in beacon's state fields in the ubik_debug structure */
|
||||
aparm->syncSiteUntil = syncSiteUntil;
|
||||
@ -104,7 +113,8 @@ ubeacon_Debug(aparm)
|
||||
* \return 1 if local site is the sync site
|
||||
* \return 0 if sync site is elsewhere
|
||||
*/
|
||||
ubeacon_AmSyncSite()
|
||||
int
|
||||
ubeacon_AmSyncSite(void)
|
||||
{
|
||||
register afs_int32 now;
|
||||
register afs_int32 rcode;
|
||||
@ -136,10 +146,9 @@ ubeacon_AmSyncSite()
|
||||
/*!
|
||||
* \see ubeacon_InitServerListCommon()
|
||||
*/
|
||||
ubeacon_InitServerListByInfo(ame, info, clones)
|
||||
afs_int32 ame;
|
||||
struct afsconf_cell *info;
|
||||
char clones[];
|
||||
int
|
||||
ubeacon_InitServerListByInfo(afs_int32 ame, struct afsconf_cell *info,
|
||||
char clones[])
|
||||
{
|
||||
afs_int32 code;
|
||||
|
||||
@ -153,9 +162,7 @@ ubeacon_InitServerListByInfo(ame, info, clones)
|
||||
*
|
||||
* \see ubeacon_InitServerListCommon()
|
||||
*/
|
||||
ubeacon_InitServerList(ame, aservers)
|
||||
afs_int32 ame;
|
||||
register afs_int32 aservers[];
|
||||
ubeacon_InitServerList(afs_int32 ame, register afs_int32 aservers[])
|
||||
{
|
||||
afs_int32 code;
|
||||
|
||||
@ -171,8 +178,8 @@ ubeacon_InitServerList(ame, aservers)
|
||||
* \param ame "address of me"
|
||||
* \param aservers list of other servers
|
||||
*
|
||||
* called only at initialization to set up the list of servers to contact for votes. Just creates
|
||||
* the server structure.
|
||||
* called only at initialization to set up the list of servers to
|
||||
* contact for votes. Just creates the server structure.
|
||||
*
|
||||
* The "magic" host is the one with the lowest internet address. It is
|
||||
* magic because its vote counts epsilon more than the others. This acts
|
||||
@ -182,18 +189,16 @@ ubeacon_InitServerList(ame, aservers)
|
||||
* site system, we'd be out of business.
|
||||
*
|
||||
* \note There are two connections in every server structure, one for
|
||||
* vote calls (which must always go through quickly) and one for database operations, which
|
||||
* are subject to waiting for locks. If we used only one, the votes would sometimes get
|
||||
* held up behind database operations, and the sync site guarantees would timeout
|
||||
* even though the host would be up for communication.
|
||||
* vote calls (which must always go through quickly) and one for database
|
||||
* operations, which are subject to waiting for locks. If we used only
|
||||
* one, the votes would sometimes get held up behind database operations,
|
||||
* and the sync site guarantees would timeout even though the host would be
|
||||
* up for communication.
|
||||
*
|
||||
* \see ubeacon_InitServerList(), ubeacon_InitServerListByInfo()
|
||||
*/
|
||||
ubeacon_InitServerListCommon(ame, info, clones, aservers)
|
||||
afs_int32 ame;
|
||||
struct afsconf_cell *info;
|
||||
char clones[];
|
||||
register afs_int32 aservers[];
|
||||
ubeacon_InitServerListCommon(afs_int32 ame, struct afsconf_cell *info,
|
||||
char clones[], register afs_int32 aservers[])
|
||||
{
|
||||
register struct ubik_server *ts;
|
||||
afs_int32 me = -1;
|
||||
@ -511,11 +516,8 @@ ubeacon_Interact(void *dummy)
|
||||
* \return 0 on success, non-zero on failure
|
||||
*/
|
||||
static
|
||||
verifyInterfaceAddress(ame, info, aservers)
|
||||
afs_uint32 *ame; /* one of my interface addr in net byte order */
|
||||
struct afsconf_cell *info;
|
||||
afs_uint32 aservers[]; /* list of all possible server addresses */
|
||||
{
|
||||
verifyInterfaceAddress(afs_uint32 *ame, struct afsconf_cell *info,
|
||||
afs_uint32 aservers[]) {
|
||||
afs_uint32 myAddr[UBIK_MAX_INTERFACE_ADDR], *servList, tmpAddr;
|
||||
afs_uint32 myAddr2[UBIK_MAX_INTERFACE_ADDR];
|
||||
int tcount, count, found, i, j, totalServers, start, end, usednetfiles =
|
||||
@ -658,8 +660,7 @@ verifyInterfaceAddress(ame, info, aservers)
|
||||
* \return 0 on success, non-zero on failure
|
||||
*/
|
||||
int
|
||||
updateUbikNetworkAddress(ubik_host)
|
||||
afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR];
|
||||
updateUbikNetworkAddress(afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR])
|
||||
{
|
||||
int j, count, code = 0;
|
||||
UbikInterfaceAddr inAddr, outAddr;
|
||||
|
@ -14,14 +14,17 @@ RCSID
|
||||
("$Header$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/file.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <lock.h>
|
||||
#include <rx/xdr.h>
|
||||
|
||||
@ -55,10 +58,10 @@ static int calls = 0, ios = 0, lastb = 0;
|
||||
static char *BufferData;
|
||||
static struct buffer *newslot(struct ubik_dbase *adbase, afs_int32 afid,
|
||||
afs_int32 apage);
|
||||
static initd = 0;
|
||||
static int initd = 0;
|
||||
#define BADFID 0xffffffff
|
||||
|
||||
static DTrunc(struct ubik_dbase *dbase, afs_int32 fid, afs_int32 length);
|
||||
static int DTrunc(struct ubik_dbase *dbase, afs_int32 fid, afs_int32 length);
|
||||
|
||||
static struct ubik_trunc *freeTruncList = 0;
|
||||
|
||||
@ -83,7 +86,7 @@ unthread(struct ubik_trans *atrans)
|
||||
/*!
|
||||
* \brief some debugging assistance
|
||||
*/
|
||||
int
|
||||
void
|
||||
udisk_Debug(struct ubik_debug *aparm)
|
||||
{
|
||||
struct buffer *tb;
|
||||
@ -101,7 +104,6 @@ udisk_Debug(struct ubik_debug *aparm)
|
||||
aparm->writeLockedPages++;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -212,7 +214,7 @@ udisk_LogTruncate(struct ubik_dbase *adbase, afs_int32 afile,
|
||||
* \brief Write some data to the log, never syncing.
|
||||
*/
|
||||
int
|
||||
udisk_LogWriteData(struct ubik_dbase *adbase, afs_int32 afile, char *abuffer,
|
||||
udisk_LogWriteData(struct ubik_dbase *adbase, afs_int32 afile, void *abuffer,
|
||||
afs_int32 apos, afs_int32 alen)
|
||||
{
|
||||
struct ubik_stat ustat;
|
||||
@ -441,7 +443,7 @@ static int
|
||||
DoTruncs(struct ubik_trans *atrans)
|
||||
{
|
||||
struct ubik_trunc *tt, *nt;
|
||||
int (*tproc) ();
|
||||
int (*tproc) (struct ubik_dbase *, afs_int32, afs_int32);
|
||||
afs_int32 rcode = 0, code;
|
||||
|
||||
tproc = atrans->dbase->truncate;
|
||||
@ -658,7 +660,7 @@ DNew(struct ubik_dbase *dbase, afs_int32 fid, int page)
|
||||
* \brief Read data from database.
|
||||
*/
|
||||
int
|
||||
udisk_read(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
|
||||
udisk_read(struct ubik_trans *atrans, afs_int32 afile, void *abuffer,
|
||||
afs_int32 apos, afs_int32 alen)
|
||||
{
|
||||
char *bp;
|
||||
@ -679,7 +681,7 @@ udisk_read(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
|
||||
if (len > alen)
|
||||
len = alen;
|
||||
memcpy(abuffer, bp + offset, len);
|
||||
abuffer += len;
|
||||
abuffer = (char *)abuffer + len;
|
||||
apos += len;
|
||||
alen -= len;
|
||||
totalLen += len;
|
||||
@ -726,7 +728,7 @@ udisk_truncate(struct ubik_trans *atrans, afs_int32 afile, afs_int32 alength)
|
||||
* \brief Write data to database, using logs.
|
||||
*/
|
||||
int
|
||||
udisk_write(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
|
||||
udisk_write(struct ubik_trans *atrans, afs_int32 afile, void *abuffer,
|
||||
afs_int32 apos, afs_int32 alen)
|
||||
{
|
||||
char *bp;
|
||||
@ -770,7 +772,7 @@ udisk_write(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
|
||||
if (len > alen)
|
||||
len = alen;
|
||||
memcpy(bp + offset, abuffer, len);
|
||||
abuffer += len;
|
||||
abuffer = (char *)abuffer + len;
|
||||
apos += len;
|
||||
alen -= len;
|
||||
totalLen += len;
|
||||
@ -847,8 +849,8 @@ udisk_commit(struct ubik_trans *atrans)
|
||||
* marked down and when we detect it is up again, we will
|
||||
* send the entire database to it.
|
||||
*/
|
||||
ContactQuorum(DISK_SetVersion, atrans, 1 /*CStampVersion */ ,
|
||||
&oldversion, &newversion);
|
||||
ContactQuorum_DISK_SetVersion( atrans, 1 /*CStampVersion */ ,
|
||||
&oldversion, &newversion);
|
||||
urecovery_state |= UBIK_RECLABELDB;
|
||||
}
|
||||
|
||||
@ -952,7 +954,7 @@ udisk_end(struct ubik_trans *atrans)
|
||||
if (atrans->flags & TRSETLOCK) {
|
||||
atrans->flags |= TRSTALE;
|
||||
ulock_relLock(atrans);
|
||||
return;
|
||||
return UINTERNAL;
|
||||
}
|
||||
#endif /* UBIK_PAUSE */
|
||||
if (!(atrans->flags & TRDONE))
|
||||
|
@ -14,10 +14,13 @@ RCSID
|
||||
("$Header$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef AFS_NT40_ENV
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include <lock.h>
|
||||
#include <rx/xdr.h>
|
||||
|
||||
@ -62,9 +65,8 @@ int rwlockinit = 1;
|
||||
*
|
||||
* \note The #DBHOLD lock must be held.
|
||||
*/
|
||||
ulock_getLock(atrans, atype, await)
|
||||
struct ubik_trans *atrans;
|
||||
int atype, await;
|
||||
extern int
|
||||
ulock_getLock(struct ubik_trans *atrans, int atype, int await)
|
||||
{
|
||||
struct ubik_dbase *dbase = atrans->dbase;
|
||||
|
||||
@ -151,8 +153,7 @@ ulock_getLock(atrans, atype, await)
|
||||
* \brief Release the transaction lock.
|
||||
*/
|
||||
void
|
||||
ulock_relLock(atrans)
|
||||
struct ubik_trans *atrans;
|
||||
ulock_relLock(struct ubik_trans *atrans)
|
||||
{
|
||||
if (rwlockinit)
|
||||
return;
|
||||
@ -175,8 +176,8 @@ ulock_relLock(atrans)
|
||||
/*!
|
||||
* \brief debugging hooks
|
||||
*/
|
||||
ulock_Debug(aparm)
|
||||
struct ubik_debug *aparm;
|
||||
void
|
||||
ulock_Debug(struct ubik_debug *aparm)
|
||||
{
|
||||
if (rwlockinit) {
|
||||
aparm->anyReadLocks = 0;
|
||||
@ -185,5 +186,4 @@ ulock_Debug(aparm)
|
||||
aparm->anyReadLocks = rwlock.readers_reading;
|
||||
aparm->anyWriteLocks = ((rwlock.excl_locked == WRITE_LOCK) ? 1 : 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -14,6 +14,10 @@ RCSID
|
||||
("$Header$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <winsock2.h>
|
||||
#include <io.h>
|
||||
@ -32,8 +36,7 @@ RCSID
|
||||
#endif
|
||||
|
||||
#include <lock.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <afs/afsutil.h>
|
||||
|
||||
#define UBIK_INTERNALS 1
|
||||
#include "ubik.h"
|
||||
@ -60,7 +63,6 @@ static char pbuffer[1024];
|
||||
static int
|
||||
uphys_open(register struct ubik_dbase *adbase, afs_int32 afid)
|
||||
{
|
||||
char temp[20];
|
||||
register int fd;
|
||||
static int initd;
|
||||
register int i;
|
||||
@ -188,7 +190,7 @@ uphys_stat(struct ubik_dbase *adbase, afs_int32 afid, struct ubik_stat *astat)
|
||||
|
||||
int
|
||||
uphys_read(register struct ubik_dbase *adbase, afs_int32 afile,
|
||||
register char *abuffer, afs_int32 apos, afs_int32 alength)
|
||||
register void *abuffer, afs_int32 apos, afs_int32 alength)
|
||||
{
|
||||
register int fd;
|
||||
register afs_int32 code;
|
||||
@ -208,7 +210,7 @@ uphys_read(register struct ubik_dbase *adbase, afs_int32 afile,
|
||||
|
||||
int
|
||||
uphys_write(register struct ubik_dbase *adbase, afs_int32 afile,
|
||||
register char *abuffer, afs_int32 apos, afs_int32 alength)
|
||||
register void *abuffer, afs_int32 apos, afs_int32 alength)
|
||||
{
|
||||
register int fd;
|
||||
register afs_int32 code;
|
||||
|
@ -14,6 +14,11 @@ RCSID
|
||||
("$Header$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <winsock2.h>
|
||||
#include <time.h>
|
||||
@ -23,12 +28,10 @@ RCSID
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <lock.h>
|
||||
#include <string.h>
|
||||
#include <rx/xdr.h>
|
||||
#include <rx/rx.h>
|
||||
#include <errno.h>
|
||||
#include <afs/afsutil.h>
|
||||
|
||||
#define UBIK_INTERNALS
|
||||
@ -458,7 +461,7 @@ urecovery_Interact(void *dummy)
|
||||
#ifndef OLD_URECOVERY
|
||||
char pbuffer[1028];
|
||||
int flen, fd = -1;
|
||||
afs_int32 epoch, pass;
|
||||
afs_int32 pass;
|
||||
#endif
|
||||
|
||||
/* otherwise, begin interaction */
|
||||
|
@ -14,6 +14,9 @@ RCSID
|
||||
("$Header$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <winsock2.h>
|
||||
#include <fcntl.h>
|
||||
@ -21,7 +24,7 @@ RCSID
|
||||
#include <sys/file.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#include <lock.h>
|
||||
#include <rx/xdr.h>
|
||||
#include <rx/rx.h>
|
||||
@ -31,9 +34,11 @@ RCSID
|
||||
#define UBIK_INTERNALS
|
||||
#include "ubik.h"
|
||||
#include "ubik_int.h"
|
||||
int (*ubik_CheckRXSecurityProc) ();
|
||||
char *ubik_CheckRXSecurityRock;
|
||||
void printServerInfo();
|
||||
|
||||
int (*ubik_CheckRXSecurityProc) (void *, struct rx_call *);
|
||||
void *ubik_CheckRXSecurityRock;
|
||||
|
||||
static void printServerInfo(void);
|
||||
|
||||
/*! \file
|
||||
* routines for handling requests remotely-submitted by the sync site. These are
|
||||
@ -43,9 +48,8 @@ void printServerInfo();
|
||||
|
||||
struct ubik_trans *ubik_currentTrans = 0;
|
||||
|
||||
|
||||
ubik_CheckAuth(acall)
|
||||
register struct rx_call *acall;
|
||||
int
|
||||
ubik_CheckAuth(register struct rx_call *acall)
|
||||
{
|
||||
register afs_int32 code;
|
||||
if (ubik_CheckRXSecurityProc) {
|
||||
@ -60,9 +64,7 @@ ubik_CheckAuth(acall)
|
||||
* sync site is executing a write transaction.
|
||||
*/
|
||||
afs_int32
|
||||
SDISK_Begin(rxcall, atid)
|
||||
register struct rx_call *rxcall;
|
||||
struct ubik_tid *atid;
|
||||
SDISK_Begin(register struct rx_call *rxcall, struct ubik_tid *atid)
|
||||
{
|
||||
register afs_int32 code;
|
||||
|
||||
@ -94,9 +96,7 @@ SDISK_Begin(rxcall, atid)
|
||||
|
||||
|
||||
afs_int32
|
||||
SDISK_Commit(rxcall, atid)
|
||||
register struct rx_call *rxcall;
|
||||
struct ubik_tid *atid;
|
||||
SDISK_Commit(register struct rx_call *rxcall, struct ubik_tid *atid)
|
||||
{
|
||||
register afs_int32 code;
|
||||
register struct ubik_dbase *dbase;
|
||||
@ -133,9 +133,7 @@ SDISK_Commit(rxcall, atid)
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SDISK_ReleaseLocks(rxcall, atid)
|
||||
register struct rx_call *rxcall;
|
||||
struct ubik_tid *atid;
|
||||
SDISK_ReleaseLocks(register struct rx_call *rxcall, struct ubik_tid *atid)
|
||||
{
|
||||
register struct ubik_dbase *dbase;
|
||||
register afs_int32 code;
|
||||
@ -174,9 +172,7 @@ SDISK_ReleaseLocks(rxcall, atid)
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SDISK_Abort(rxcall, atid)
|
||||
register struct rx_call *rxcall;
|
||||
struct ubik_tid *atid;
|
||||
SDISK_Abort(register struct rx_call *rxcall, struct ubik_tid *atid)
|
||||
{
|
||||
register afs_int32 code;
|
||||
register struct ubik_dbase *dbase;
|
||||
@ -215,12 +211,11 @@ SDISK_Abort(rxcall, atid)
|
||||
return code;
|
||||
}
|
||||
|
||||
/* apos and alen are not used */
|
||||
afs_int32
|
||||
SDISK_Lock(rxcall, atid, afile, apos, alen, atype)
|
||||
register struct rx_call *rxcall;
|
||||
struct ubik_tid *atid;
|
||||
afs_int32 afile, apos, alen, atype; /* apos and alen are not used */
|
||||
{
|
||||
SDISK_Lock(register struct rx_call *rxcall, struct ubik_tid *atid,
|
||||
afs_int32 afile, afs_int32 apos, afs_int32 alen, afs_int32 atype)
|
||||
{
|
||||
register afs_int32 code;
|
||||
register struct ubik_dbase *dbase;
|
||||
struct ubik_trans *ubik_thisTrans;
|
||||
@ -266,11 +261,8 @@ SDISK_Lock(rxcall, atid, afile, apos, alen, atype)
|
||||
* \brief Write a vector of data
|
||||
*/
|
||||
afs_int32
|
||||
SDISK_WriteV(rxcall, atid, io_vector, io_buffer)
|
||||
register struct rx_call *rxcall;
|
||||
struct ubik_tid *atid;
|
||||
iovec_wrt *io_vector;
|
||||
iovec_buf *io_buffer;
|
||||
SDISK_WriteV(register struct rx_call *rxcall, struct ubik_tid *atid,
|
||||
iovec_wrt *io_vector, iovec_buf *io_buffer)
|
||||
{
|
||||
afs_int32 code, i, offset;
|
||||
struct ubik_dbase *dbase;
|
||||
@ -318,11 +310,8 @@ SDISK_WriteV(rxcall, atid, io_vector, io_buffer)
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SDISK_Write(rxcall, atid, afile, apos, adata)
|
||||
register struct rx_call *rxcall;
|
||||
struct ubik_tid *atid;
|
||||
afs_int32 afile, apos;
|
||||
register bulkdata *adata;
|
||||
SDISK_Write(register struct rx_call *rxcall, struct ubik_tid *atid,
|
||||
afs_int32 afile, afs_int32 apos, register bulkdata *adata)
|
||||
{
|
||||
register afs_int32 code;
|
||||
register struct ubik_dbase *dbase;
|
||||
@ -353,11 +342,8 @@ SDISK_Write(rxcall, atid, afile, apos, adata)
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SDISK_Truncate(rxcall, atid, afile, alen)
|
||||
register struct rx_call *rxcall;
|
||||
struct ubik_tid *atid;
|
||||
afs_int32 afile;
|
||||
afs_int32 alen;
|
||||
SDISK_Truncate(register struct rx_call *rxcall, struct ubik_tid *atid,
|
||||
afs_int32 afile, afs_int32 alen)
|
||||
{
|
||||
register afs_int32 code;
|
||||
register struct ubik_dbase *dbase;
|
||||
@ -386,9 +372,8 @@ SDISK_Truncate(rxcall, atid, afile, alen)
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SDISK_GetVersion(rxcall, aversion)
|
||||
register struct rx_call *rxcall;
|
||||
register struct ubik_version *aversion;
|
||||
SDISK_GetVersion(register struct rx_call *rxcall,
|
||||
register struct ubik_version *aversion)
|
||||
{
|
||||
register afs_int32 code;
|
||||
|
||||
@ -424,10 +409,8 @@ SDISK_GetVersion(rxcall, aversion)
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SDISK_GetFile(rxcall, file, version)
|
||||
register struct rx_call *rxcall;
|
||||
register afs_int32 file;
|
||||
struct ubik_version *version;
|
||||
SDISK_GetFile(register struct rx_call *rxcall, register afs_int32 file,
|
||||
struct ubik_version *version)
|
||||
{
|
||||
register afs_int32 code;
|
||||
register struct ubik_dbase *dbase;
|
||||
@ -485,11 +468,8 @@ SDISK_GetFile(rxcall, file, version)
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SDISK_SendFile(rxcall, file, length, avers)
|
||||
register struct rx_call *rxcall;
|
||||
afs_int32 file;
|
||||
afs_int32 length;
|
||||
struct ubik_version *avers;
|
||||
SDISK_SendFile(register struct rx_call *rxcall, afs_int32 file,
|
||||
afs_int32 length, struct ubik_version *avers)
|
||||
{
|
||||
register afs_int32 code;
|
||||
struct ubik_dbase *dbase = NULL;
|
||||
@ -658,8 +638,7 @@ SDISK_SendFile(rxcall, file, length, avers)
|
||||
|
||||
|
||||
afs_int32
|
||||
SDISK_Probe(rxcall)
|
||||
register struct rx_call *rxcall;
|
||||
SDISK_Probe(register struct rx_call *rxcall)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -671,9 +650,9 @@ SDISK_Probe(rxcall)
|
||||
* \return zero on success, else 1.
|
||||
*/
|
||||
afs_int32
|
||||
SDISK_UpdateInterfaceAddr(rxcall, inAddr, outAddr)
|
||||
register struct rx_call *rxcall;
|
||||
UbikInterfaceAddr *inAddr, *outAddr;
|
||||
SDISK_UpdateInterfaceAddr(register struct rx_call *rxcall,
|
||||
UbikInterfaceAddr *inAddr,
|
||||
UbikInterfaceAddr *outAddr)
|
||||
{
|
||||
struct ubik_server *ts, *tmp;
|
||||
afs_uint32 remoteAddr; /* in net byte order */
|
||||
@ -735,8 +714,8 @@ SDISK_UpdateInterfaceAddr(rxcall, inAddr, outAddr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
printServerInfo()
|
||||
static void
|
||||
printServerInfo(void)
|
||||
{
|
||||
struct ubik_server *ts;
|
||||
int i, j = 1;
|
||||
@ -751,11 +730,9 @@ printServerInfo()
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SDISK_SetVersion(rxcall, atid, oldversionp, newversionp)
|
||||
struct rx_call *rxcall;
|
||||
struct ubik_tid *atid;
|
||||
struct ubik_version *oldversionp;
|
||||
struct ubik_version *newversionp;
|
||||
SDISK_SetVersion(struct rx_call *rxcall, struct ubik_tid *atid,
|
||||
struct ubik_version *oldversionp,
|
||||
struct ubik_version *newversionp)
|
||||
{
|
||||
afs_int32 code = 0;
|
||||
struct ubik_dbase *dbase;
|
||||
|
293
src/ubik/ubik.c
293
src/ubik/ubik.c
@ -14,6 +14,10 @@ RCSID
|
||||
("$Header$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
@ -21,9 +25,8 @@ RCSID
|
||||
#include <netinet/in.h>
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
#include <lock.h>
|
||||
#include <string.h>
|
||||
#include <rx/xdr.h>
|
||||
#include <rx/rx.h>
|
||||
#include <afs/cellconfig.h>
|
||||
@ -80,12 +83,13 @@ struct ubik_stats ubik_stats;
|
||||
afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR];
|
||||
afs_int32 ubik_epochTime = 0;
|
||||
afs_int32 urecovery_state = 0;
|
||||
int (*ubik_SRXSecurityProc) ();
|
||||
char *ubik_SRXSecurityRock;
|
||||
int (*ubik_SRXSecurityProc) (void *, struct rx_securityClass **, afs_int32 *);
|
||||
void *ubik_SRXSecurityRock;
|
||||
struct ubik_server *ubik_servers;
|
||||
short ubik_callPortal;
|
||||
|
||||
static int BeginTrans();
|
||||
static int BeginTrans(register struct ubik_dbase *dbase, afs_int32 transMode,
|
||||
struct ubik_trans **transPtr, int readAny);
|
||||
|
||||
struct rx_securityClass *ubik_sc[3];
|
||||
|
||||
@ -97,20 +101,17 @@ struct rx_securityClass *ubik_sc[3];
|
||||
* \return otherwise mark failing server as down and return #UERROR
|
||||
*
|
||||
* \note If any server misses an update, we must wait #BIGTIME seconds before
|
||||
* allowing the transaction to commit, to ensure that the missing and possibly still
|
||||
* functioning server times out and stops handing out old data. This is done in the commit
|
||||
* code, where we wait for a server marked down to have stayed down for #BIGTIME seconds
|
||||
* before we allow a transaction to commit. A server that fails but comes back up won't give
|
||||
* out old data because it is sent the sync count along with the beacon message that
|
||||
* allowing the transaction to commit, to ensure that the missing and
|
||||
* possibly still functioning server times out and stops handing out old
|
||||
* data. This is done in the commit code, where we wait for a server marked
|
||||
* down to have stayed down for #BIGTIME seconds before we allow a transaction
|
||||
* to commit. A server that fails but comes back up won't give out old data
|
||||
* because it is sent the sync count along with the beacon message that
|
||||
* marks it as \b really up (\p beaconSinceDown).
|
||||
*/
|
||||
afs_int32
|
||||
ContactQuorum(aproc, atrans, aflags, aparm0, aparm1, aparm2, aparm3, aparm4,
|
||||
aparm5)
|
||||
int (*aproc) ();
|
||||
int aflags;
|
||||
register struct ubik_trans *atrans;
|
||||
long aparm0, aparm1, aparm2, aparm3, aparm4, aparm5;
|
||||
ContactQuorum_NoArguments(afs_int32 (*proc)(struct rx_connection *, ubik_tid *),
|
||||
register struct ubik_trans *atrans, int aflags)
|
||||
{
|
||||
register struct ubik_server *ts;
|
||||
register afs_int32 code;
|
||||
@ -124,25 +125,176 @@ ContactQuorum(aproc, atrans, aflags, aparm0, aparm1, aparm2, aparm3, aparm4,
|
||||
ts->currentDB = 0; /* db is no longer current; we just missed an update */
|
||||
continue; /* not up-to-date, don't bother */
|
||||
}
|
||||
code =
|
||||
(*aproc) (ts->disk_rxcid, &atrans->tid, aparm0, aparm1, aparm2,
|
||||
aparm3, aparm4, aparm5);
|
||||
if ((aproc == DISK_WriteV) && (code <= -450) && (code > -500)) {
|
||||
code = (*proc)(ts->disk_rxcid, &atrans->tid);
|
||||
if (code) { /* failure */
|
||||
rcode = code;
|
||||
ts->up = 0; /* mark as down now; beacons will no longer be sent */
|
||||
ts->currentDB = 0;
|
||||
ts->beaconSinceDown = 0;
|
||||
urecovery_LostServer(); /* tell recovery to try to resend dbase later */
|
||||
} else { /* success */
|
||||
if (!ts->isClone)
|
||||
okcalls++; /* count up how many worked */
|
||||
if (aflags & CStampVersion) {
|
||||
ts->version = atrans->dbase->version;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* return 0 if we successfully contacted a quorum, otherwise return error code. We don't have to contact ourselves (that was done locally) */
|
||||
if (okcalls + 1 >= ubik_quorum)
|
||||
return 0;
|
||||
else
|
||||
return rcode;
|
||||
}
|
||||
|
||||
afs_int32
|
||||
ContactQuorum_DISK_Lock(register struct ubik_trans *atrans, int aflags,afs_int32 file,
|
||||
afs_int32 position, afs_int32 length, afs_int32 type)
|
||||
{
|
||||
register struct ubik_server *ts;
|
||||
register afs_int32 code;
|
||||
afs_int32 rcode, okcalls;
|
||||
|
||||
rcode = 0;
|
||||
okcalls = 0;
|
||||
for (ts = ubik_servers; ts; ts = ts->next) {
|
||||
/* for each server */
|
||||
if (!ts->up || !ts->currentDB) {
|
||||
ts->currentDB = 0; /* db is no longer current; we just missed an update */
|
||||
continue; /* not up-to-date, don't bother */
|
||||
}
|
||||
code = DISK_Lock(ts->disk_rxcid, &atrans->tid, file, position, length,
|
||||
type);
|
||||
if (code) { /* failure */
|
||||
rcode = code;
|
||||
ts->up = 0; /* mark as down now; beacons will no longer be sent */
|
||||
ts->currentDB = 0;
|
||||
ts->beaconSinceDown = 0;
|
||||
urecovery_LostServer(); /* tell recovery to try to resend dbase later */
|
||||
} else { /* success */
|
||||
if (!ts->isClone)
|
||||
okcalls++; /* count up how many worked */
|
||||
if (aflags & CStampVersion) {
|
||||
ts->version = atrans->dbase->version;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* return 0 if we successfully contacted a quorum, otherwise return error code. We don't have to contact ourselves (that was done locally) */
|
||||
if (okcalls + 1 >= ubik_quorum)
|
||||
return 0;
|
||||
else
|
||||
return rcode;
|
||||
}
|
||||
|
||||
afs_int32
|
||||
ContactQuorum_DISK_Write(register struct ubik_trans *atrans, int aflags,
|
||||
afs_int32 file, afs_int32 position, bulkdata *data)
|
||||
{
|
||||
register struct ubik_server *ts;
|
||||
register afs_int32 code;
|
||||
afs_int32 rcode, okcalls;
|
||||
|
||||
rcode = 0;
|
||||
okcalls = 0;
|
||||
for (ts = ubik_servers; ts; ts = ts->next) {
|
||||
/* for each server */
|
||||
if (!ts->up || !ts->currentDB) {
|
||||
ts->currentDB = 0; /* db is no longer current; we just missed an update */
|
||||
continue; /* not up-to-date, don't bother */
|
||||
}
|
||||
code = DISK_Write(ts->disk_rxcid, &atrans->tid, file, position, data);
|
||||
if (code) { /* failure */
|
||||
rcode = code;
|
||||
ts->up = 0; /* mark as down now; beacons will no longer be sent */
|
||||
ts->currentDB = 0;
|
||||
ts->beaconSinceDown = 0;
|
||||
urecovery_LostServer(); /* tell recovery to try to resend dbase later */
|
||||
} else { /* success */
|
||||
if (!ts->isClone)
|
||||
okcalls++; /* count up how many worked */
|
||||
if (aflags & CStampVersion) {
|
||||
ts->version = atrans->dbase->version;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* return 0 if we successfully contacted a quorum, otherwise return error code. We don't have to contact ourselves (that was done locally) */
|
||||
if (okcalls + 1 >= ubik_quorum)
|
||||
return 0;
|
||||
else
|
||||
return rcode;
|
||||
}
|
||||
|
||||
afs_int32
|
||||
ContactQuorum_DISK_Truncate(register struct ubik_trans *atrans, int aflags,
|
||||
afs_int32 file, afs_int32 length)
|
||||
{
|
||||
register struct ubik_server *ts;
|
||||
register afs_int32 code;
|
||||
afs_int32 rcode, okcalls;
|
||||
|
||||
rcode = 0;
|
||||
okcalls = 0;
|
||||
for (ts = ubik_servers; ts; ts = ts->next) {
|
||||
/* for each server */
|
||||
if (!ts->up || !ts->currentDB) {
|
||||
ts->currentDB = 0; /* db is no longer current; we just missed an update */
|
||||
continue; /* not up-to-date, don't bother */
|
||||
}
|
||||
code = DISK_Truncate(ts->disk_rxcid, &atrans->tid, file, length);
|
||||
if (code) { /* failure */
|
||||
rcode = code;
|
||||
ts->up = 0; /* mark as down now; beacons will no longer be sent */
|
||||
ts->currentDB = 0;
|
||||
ts->beaconSinceDown = 0;
|
||||
urecovery_LostServer(); /* tell recovery to try to resend dbase later */
|
||||
} else { /* success */
|
||||
if (!ts->isClone)
|
||||
okcalls++; /* count up how many worked */
|
||||
if (aflags & CStampVersion) {
|
||||
ts->version = atrans->dbase->version;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* return 0 if we successfully contacted a quorum, otherwise return error code. We don't have to contact ourselves (that was done locally) */
|
||||
if (okcalls + 1 >= ubik_quorum)
|
||||
return 0;
|
||||
else
|
||||
return rcode;
|
||||
}
|
||||
|
||||
afs_int32
|
||||
ContactQuorum_DISK_WriteV(register struct ubik_trans *atrans, int aflags,
|
||||
iovec_wrt * io_vector, iovec_buf *io_buffer)
|
||||
{
|
||||
register struct ubik_server *ts;
|
||||
register afs_int32 code;
|
||||
afs_int32 rcode, okcalls;
|
||||
|
||||
rcode = 0;
|
||||
okcalls = 0;
|
||||
for (ts = ubik_servers; ts; ts = ts->next) {
|
||||
/* for each server */
|
||||
if (!ts->up || !ts->currentDB) {
|
||||
ts->currentDB = 0; /* db is no longer current; we just missed an update */
|
||||
continue; /* not up-to-date, don't bother */
|
||||
}
|
||||
|
||||
code = DISK_WriteV(ts->disk_rxcid, &atrans->tid, io_vector, io_buffer);
|
||||
|
||||
if ((code <= -450) && (code > -500)) {
|
||||
/* An RPC interface mismatch (as defined in comerr/error_msg.c).
|
||||
* Un-bulk the entries and do individual DISK_Write calls
|
||||
* instead of DISK_WriteV.
|
||||
*/
|
||||
iovec_wrt *iovec_infoP = (iovec_wrt *) aparm0;
|
||||
iovec_buf *iovec_dataP = (iovec_buf *) aparm1;
|
||||
struct ubik_iovec *iovec =
|
||||
(struct ubik_iovec *)iovec_infoP->iovec_wrt_val;
|
||||
char *iobuf = (char *)iovec_dataP->iovec_buf_val;
|
||||
(struct ubik_iovec *)io_vector->iovec_wrt_val;
|
||||
char *iobuf = (char *)io_buffer->iovec_buf_val;
|
||||
bulkdata tcbs;
|
||||
afs_int32 i, offset;
|
||||
|
||||
for (i = 0, offset = 0; i < iovec_infoP->iovec_wrt_len; i++) {
|
||||
for (i = 0, offset = 0; i < io_vector->iovec_wrt_len; i++) {
|
||||
/* Sanity check for going off end of buffer */
|
||||
if ((offset + iovec[i].length) > iovec_dataP->iovec_buf_len) {
|
||||
if ((offset + iovec[i].length) > io_buffer->iovec_buf_len) {
|
||||
code = UINTERNAL;
|
||||
break;
|
||||
}
|
||||
@ -157,6 +309,47 @@ ContactQuorum(aproc, atrans, aflags, aparm0, aparm1, aparm2, aparm3, aparm4,
|
||||
offset += iovec[i].length;
|
||||
}
|
||||
}
|
||||
|
||||
if (code) { /* failure */
|
||||
rcode = code;
|
||||
ts->up = 0; /* mark as down now; beacons will no longer be sent */
|
||||
ts->currentDB = 0;
|
||||
ts->beaconSinceDown = 0;
|
||||
urecovery_LostServer(); /* tell recovery to try to resend dbase later */
|
||||
} else { /* success */
|
||||
if (!ts->isClone)
|
||||
okcalls++; /* count up how many worked */
|
||||
if (aflags & CStampVersion) {
|
||||
ts->version = atrans->dbase->version;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* return 0 if we successfully contacted a quorum, otherwise return error code. We don't have to contact ourselves (that was done locally) */
|
||||
if (okcalls + 1 >= ubik_quorum)
|
||||
return 0;
|
||||
else
|
||||
return rcode;
|
||||
}
|
||||
|
||||
afs_int32
|
||||
ContactQuorum_DISK_SetVersion(register struct ubik_trans *atrans, int aflags,
|
||||
ubik_version *OldVersion,
|
||||
ubik_version *NewVersion)
|
||||
{
|
||||
register struct ubik_server *ts;
|
||||
register afs_int32 code;
|
||||
afs_int32 rcode, okcalls;
|
||||
|
||||
rcode = 0;
|
||||
okcalls = 0;
|
||||
for (ts = ubik_servers; ts; ts = ts->next) {
|
||||
/* for each server */
|
||||
if (!ts->up || !ts->currentDB) {
|
||||
ts->currentDB = 0; /* db is no longer current; we just missed an update */
|
||||
continue; /* not up-to-date, don't bother */
|
||||
}
|
||||
code = DISK_SetVersion(ts->disk_rxcid, &atrans->tid, OldVersion,
|
||||
NewVersion);
|
||||
if (code) { /* failure */
|
||||
rcode = code;
|
||||
ts->up = 0; /* mark as down now; beacons will no longer be sent */
|
||||
@ -214,7 +407,6 @@ ubik_ServerInitCommon(afs_int32 myHost, short myPort,
|
||||
struct rx_securityClass *secClass;
|
||||
|
||||
struct rx_service *tservice;
|
||||
extern int VOTE_ExecuteRequest(), DISK_ExecuteRequest();
|
||||
extern int rx_stackSize;
|
||||
|
||||
initialize_U_error_table();
|
||||
@ -504,11 +696,11 @@ BeginTrans(register struct ubik_dbase *dbase, afs_int32 transMode,
|
||||
#endif /* UBIK_PAUSE */
|
||||
|
||||
/* next try to start transaction on appropriate number of machines */
|
||||
code = ContactQuorum(DISK_Begin, tt, 0);
|
||||
code = ContactQuorum_NoArguments(DISK_Begin, tt, 0);
|
||||
if (code) {
|
||||
/* we must abort the operation */
|
||||
udisk_abort(tt);
|
||||
ContactQuorum(DISK_Abort, tt, 0); /* force aborts to the others */
|
||||
ContactQuorum_NoArguments(DISK_Abort, tt, 0); /* force aborts to the others */
|
||||
udisk_end(tt);
|
||||
DBRELE(dbase);
|
||||
return code;
|
||||
@ -577,7 +769,7 @@ ubik_AbortTrans(register struct ubik_trans *transPtr)
|
||||
}
|
||||
|
||||
/* now it is safe to try remote abort */
|
||||
code = ContactQuorum(DISK_Abort, transPtr, 0);
|
||||
code = ContactQuorum_NoArguments(DISK_Abort, transPtr, 0);
|
||||
code2 = udisk_abort(transPtr);
|
||||
udisk_end(transPtr);
|
||||
DBRELE(dbase);
|
||||
@ -637,7 +829,7 @@ ubik_EndTrans(register struct ubik_trans *transPtr)
|
||||
/* now it is safe to do commit */
|
||||
code = udisk_commit(transPtr);
|
||||
if (code == 0)
|
||||
code = ContactQuorum(DISK_Commit, transPtr, CStampVersion);
|
||||
code = ContactQuorum_NoArguments(DISK_Commit, transPtr, CStampVersion);
|
||||
if (code) {
|
||||
/* failed to commit, so must return failure. Try to clear locks first, just for fun
|
||||
* Note that we don't know if this transaction will eventually commit at this point.
|
||||
@ -645,7 +837,7 @@ ubik_EndTrans(register struct ubik_trans *transPtr)
|
||||
* we lose. If we contact a majority of sites, then we won't be here: contacting
|
||||
* a majority guarantees commit, since it guarantees that one dude will be a
|
||||
* member of the next quorum. */
|
||||
ContactQuorum(DISK_ReleaseLocks, transPtr, 0);
|
||||
ContactQuorum_NoArguments(DISK_ReleaseLocks, transPtr, 0);
|
||||
udisk_end(transPtr);
|
||||
DBRELE(dbase);
|
||||
return code;
|
||||
@ -689,7 +881,7 @@ ubik_EndTrans(register struct ubik_trans *transPtr)
|
||||
* The transaction is committed anyway, since we succeeded in contacting a quorum
|
||||
* at the start (when invoking the DiskCommit function).
|
||||
*/
|
||||
ContactQuorum(DISK_ReleaseLocks, transPtr, 0);
|
||||
ContactQuorum_NoArguments(DISK_ReleaseLocks, transPtr, 0);
|
||||
|
||||
success:
|
||||
udisk_end(transPtr);
|
||||
@ -709,7 +901,7 @@ ubik_EndTrans(register struct ubik_trans *transPtr)
|
||||
* \note *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.
|
||||
*/
|
||||
int
|
||||
ubik_Read(register struct ubik_trans *transPtr, char *buffer,
|
||||
ubik_Read(register struct ubik_trans *transPtr, void *buffer,
|
||||
afs_int32 length)
|
||||
{
|
||||
register afs_int32 code;
|
||||
@ -756,11 +948,11 @@ ubik_Flush(struct ubik_trans *transPtr)
|
||||
|
||||
/* Update the rest of the servers in the quorum */
|
||||
code =
|
||||
ContactQuorum(DISK_WriteV, transPtr, 0, &transPtr->iovec_info,
|
||||
&transPtr->iovec_data);
|
||||
ContactQuorum_DISK_WriteV(transPtr, 0, &transPtr->iovec_info,
|
||||
&transPtr->iovec_data);
|
||||
if (code) {
|
||||
udisk_abort(transPtr);
|
||||
ContactQuorum(DISK_Abort, transPtr, 0); /* force aborts to the others */
|
||||
ContactQuorum_NoArguments(DISK_Abort, transPtr, 0); /* force aborts to the others */
|
||||
transPtr->iovec_info.iovec_wrt_len = 0;
|
||||
transPtr->iovec_data.iovec_buf_len = 0;
|
||||
ERROR_EXIT(code);
|
||||
@ -776,7 +968,7 @@ ubik_Flush(struct ubik_trans *transPtr)
|
||||
}
|
||||
|
||||
int
|
||||
ubik_Write(register struct ubik_trans *transPtr, char *buffer,
|
||||
ubik_Write(register struct ubik_trans *transPtr, void *buffer,
|
||||
afs_int32 length)
|
||||
{
|
||||
struct ubik_iovec *iovec;
|
||||
@ -791,7 +983,7 @@ ubik_Write(register struct ubik_trans *transPtr, char *buffer,
|
||||
if (length > IOVEC_MAXBUF) {
|
||||
for (pos = 0, len = length; len > 0; len -= size, pos += size) {
|
||||
size = ((len < IOVEC_MAXBUF) ? len : IOVEC_MAXBUF);
|
||||
code = ubik_Write(transPtr, &buffer[pos], size);
|
||||
code = ubik_Write(transPtr, buffer+pos, size);
|
||||
if (code)
|
||||
return (code);
|
||||
}
|
||||
@ -926,13 +1118,13 @@ ubik_Truncate(register struct ubik_trans *transPtr, afs_int32 length)
|
||||
code = udisk_truncate(transPtr, transPtr->seekFile, length);
|
||||
if (!code) {
|
||||
code =
|
||||
ContactQuorum(DISK_Truncate, transPtr, 0, transPtr->seekFile,
|
||||
length);
|
||||
ContactQuorum_DISK_Truncate(transPtr, 0, transPtr->seekFile,
|
||||
length);
|
||||
}
|
||||
if (code) {
|
||||
/* we must abort the operation */
|
||||
udisk_abort(transPtr);
|
||||
ContactQuorum(DISK_Abort, transPtr, 0); /* force aborts to the others */
|
||||
ContactQuorum_NoArguments(DISK_Abort, transPtr, 0); /* force aborts to the others */
|
||||
ERROR_EXIT(code);
|
||||
}
|
||||
|
||||
@ -973,13 +1165,13 @@ ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos, afs_int32 alen,
|
||||
/* now do the operation locally, and propagate it out */
|
||||
code = ulock_getLock(atrans, atype, 1);
|
||||
if (code == 0) {
|
||||
code = ContactQuorum(DISK_Lock, atrans, 0, 0, 1 /*unused */ ,
|
||||
1 /*unused */ , LOCKWRITE);
|
||||
code = ContactQuorum_DISK_Lock(atrans, 0, 0, 1 /*unused */ ,
|
||||
1 /*unused */ , LOCKWRITE);
|
||||
}
|
||||
if (code) {
|
||||
/* we must abort the operation */
|
||||
udisk_abort(atrans);
|
||||
ContactQuorum(DISK_Abort, atrans, 0); /* force aborts to the others */
|
||||
ContactQuorum_NoArguments(DISK_Abort, atrans, 0); /* force aborts to the others */
|
||||
ERROR_EXIT(code);
|
||||
}
|
||||
}
|
||||
@ -1045,11 +1237,16 @@ ubik_CacheUpdate(register struct ubik_trans *atrans)
|
||||
*
|
||||
* \returns There is no return from panic.
|
||||
*/
|
||||
int
|
||||
panic(char *a, char *b, char *c, char *d)
|
||||
void
|
||||
panic(char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
ubik_print("Ubik PANIC: ");
|
||||
ubik_print(a, b, c, d);
|
||||
ubik_vprint(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
abort();
|
||||
ubik_print("BACK FROM ABORT\n"); /* shouldn't come back */
|
||||
exit(1); /* never know, though */
|
||||
|
@ -174,9 +174,9 @@ struct ubik_dbase {
|
||||
afs_int32 writeTidCounter; /*!< last write trans tid counter */
|
||||
afs_int32 flags; /*!< flags */
|
||||
/* physio procedures */
|
||||
int (*read) (struct ubik_dbase * adbase, afs_int32 afile, char *abuffer,
|
||||
int (*read) (struct ubik_dbase * adbase, afs_int32 afile, void *abuffer,
|
||||
afs_int32 apos, afs_int32 alength);
|
||||
int (*write) (struct ubik_dbase * adbase, afs_int32 afile, char *abuffer,
|
||||
int (*write) (struct ubik_dbase * adbase, afs_int32 afile, void *abuffer,
|
||||
afs_int32 apos, afs_int32 alength);
|
||||
int (*truncate) (struct ubik_dbase * adbase, afs_int32 afile,
|
||||
afs_int32 asize);
|
||||
@ -198,12 +198,14 @@ struct ubik_dbase {
|
||||
};
|
||||
|
||||
/*! \name procedures for automatically authenticating ubik connections */
|
||||
extern int (*ubik_CRXSecurityProc) ();
|
||||
extern char *ubik_CRXSecurityRock;
|
||||
extern int (*ubik_SRXSecurityProc) ();
|
||||
extern char *ubik_SRXSecurityRock;
|
||||
extern int (*ubik_CheckRXSecurityProc) ();
|
||||
extern char *ubik_CheckRXSecurityRock;
|
||||
extern int (*ubik_CRXSecurityProc) (void *, struct rx_securityClass **,
|
||||
afs_int32 *);
|
||||
extern void *ubik_CRXSecurityRock;
|
||||
extern int (*ubik_SRXSecurityProc) (void *, struct rx_securityClass **,
|
||||
afs_int32 *);
|
||||
extern void *ubik_SRXSecurityRock;
|
||||
extern int (*ubik_CheckRXSecurityProc) (void *, struct rx_call *);
|
||||
extern void *ubik_CheckRXSecurityRock;
|
||||
/*\}*/
|
||||
|
||||
/****************INTERNALS BELOW ****************/
|
||||
@ -331,10 +333,10 @@ 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,
|
||||
register void *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,
|
||||
register void *abuffer, afs_int32 apos,
|
||||
afs_int32 alength);
|
||||
extern int uphys_truncate(register struct ubik_dbase *adbase, afs_int32 afile,
|
||||
afs_int32 asize);
|
||||
@ -359,25 +361,87 @@ extern void *urecovery_Interact(void *);
|
||||
extern int DoProbe(struct ubik_server *server);
|
||||
/*\}*/
|
||||
|
||||
/*! \name ubik.c */
|
||||
extern afs_int32 ContactQuorum_NoArguments(afs_int32 (*proc)
|
||||
(struct rx_connection *,
|
||||
ubik_tid *),
|
||||
struct ubik_trans *atrans,
|
||||
int aflags);
|
||||
|
||||
extern afs_int32 ContactQuorum_DISK_Lock(struct ubik_trans *atrans,
|
||||
int aflags,
|
||||
afs_int32 file, afs_int32 position,
|
||||
afs_int32 length, afs_int32 type);
|
||||
|
||||
extern afs_int32 ContactQuorum_DISK_Write(struct ubik_trans *atrans,
|
||||
int aflags,
|
||||
afs_int32 file, afs_int32 position,
|
||||
bulkdata *data);
|
||||
|
||||
extern afs_int32 ContactQuorum_DISK_Truncate(struct ubik_trans *atrans,
|
||||
int aflags,
|
||||
afs_int32 file, afs_int32 length);
|
||||
|
||||
extern afs_int32 ContactQuorum_DISK_WriteV(struct ubik_trans *atrans,
|
||||
int aflags,
|
||||
iovec_wrt * io_vector,
|
||||
iovec_buf *io_buffer);
|
||||
|
||||
extern afs_int32 ContactQuorum_DISK_SetVersion(struct ubik_trans *atrans,
|
||||
int aflags,
|
||||
ubik_version *OldVersion,
|
||||
ubik_version *NewVersion);
|
||||
|
||||
extern void panic(char *format, ...);
|
||||
|
||||
extern afs_uint32 ubikGetPrimaryInterfaceAddr(afs_uint32 addr);
|
||||
/*\}*/
|
||||
|
||||
/*! \name beacon.c */
|
||||
struct afsconf_cell;
|
||||
extern void ubeacon_Debug(struct ubik_debug *aparm);
|
||||
extern int ubeacon_AmSyncSite(void);
|
||||
extern int ubeacon_InitServerListByInfo(afs_int32 ame,
|
||||
struct afsconf_cell *info,
|
||||
char clones[]);
|
||||
extern int ubeacon_InitServerList(afs_int32 ame, afs_int32 aservers[]);
|
||||
extern void *ubeacon_Interact(void *);
|
||||
extern int sdisk_Interact();
|
||||
extern int uvote_Interact();
|
||||
extern int DISK_Abort();
|
||||
extern int DISK_Begin();
|
||||
extern int DISK_ReleaseLocks();
|
||||
extern int DISK_Commit();
|
||||
extern int DISK_Lock();
|
||||
extern int DISK_Write();
|
||||
extern int DISK_WriteV();
|
||||
extern int DISK_Truncate();
|
||||
extern int DISK_SetVersion();
|
||||
/*\}*/
|
||||
|
||||
/*! \name disk.c */
|
||||
extern void udisk_Debug(struct ubik_debug *aparm);
|
||||
extern int udisk_Invalidate(struct ubik_dbase *adbase, afs_int32 afid);
|
||||
extern int udisk_read(struct ubik_trans *atrans, afs_int32 afile,
|
||||
void *abuffer, afs_int32 apos, afs_int32 alen);
|
||||
extern int udisk_truncate(struct ubik_trans *atrans, afs_int32 afile,
|
||||
afs_int32 alength);
|
||||
extern int udisk_write(struct ubik_trans *atrans, afs_int32 afile,
|
||||
void *abuffer, afs_int32 apos, afs_int32 alen);
|
||||
extern int udisk_begin(struct ubik_dbase *adbase, int atype,
|
||||
struct ubik_trans **atrans);
|
||||
extern int udisk_commit(struct ubik_trans *atrans);
|
||||
extern int udisk_abort(struct ubik_trans *atrans);
|
||||
extern int udisk_end(struct ubik_trans *atrans);
|
||||
/*\}*/
|
||||
|
||||
/*! \name lock.c */
|
||||
extern int ulock_getLock(struct ubik_trans *atrans, int atype, int await);
|
||||
extern void ulock_relLock(struct ubik_trans *atrans);
|
||||
extern void ulock_Debug(struct ubik_debug *aparm);
|
||||
/*\}*/
|
||||
|
||||
/*! \name vote.c */
|
||||
extern int uvote_ShouldIRun(void);
|
||||
extern afs_int32 uvote_GetSyncSite(void);
|
||||
extern int uvote_Init(void);
|
||||
extern void ubik_vprint(const char *format, va_list ap);
|
||||
extern void ubik_print(const char *format, ...);
|
||||
extern void ubik_dprint(const char *format, ...);
|
||||
/*\}*/
|
||||
|
||||
/*! \name ubik_int.xg - rxgen really should prototype these for us ... */
|
||||
extern int VOTE_ExecuteRequest(register struct rx_call *);
|
||||
extern int DISK_ExecuteRequest(register struct rx_call *);
|
||||
/*\}*/
|
||||
|
||||
#endif /* UBIK_INTERNALS */
|
||||
@ -388,36 +452,74 @@ extern afs_int32 ubik_nBuffers;
|
||||
* \name Public function prototypes
|
||||
*/
|
||||
|
||||
/*! \name ubik.c */
|
||||
struct afsconf_cell;
|
||||
extern int ubik_ServerInitByInfo(afs_int32 myHost, short myPort,
|
||||
struct afsconf_cell *info, char clones[],
|
||||
char *pathName, struct ubik_dbase **dbase);
|
||||
extern int ubik_ServerInit(afs_int32 myHost, short myPort,
|
||||
afs_int32 serverList[],
|
||||
char *pathName, struct ubik_dbase **dbase);
|
||||
extern int ubik_BeginTrans(register struct ubik_dbase *dbase,
|
||||
afs_int32 transMode, struct ubik_trans **transPtr);
|
||||
extern int ubik_BeginTransReadAny(register struct ubik_dbase *dbase,
|
||||
afs_int32 transMode,
|
||||
struct ubik_trans **transPtr);
|
||||
extern int ubik_AbortTrans(register struct ubik_trans *transPtr);
|
||||
|
||||
extern int ubik_EndTrans(register struct ubik_trans *transPtr);
|
||||
extern int ubik_Read(register struct ubik_trans *transPtr, void *buffer,
|
||||
afs_int32 length);
|
||||
extern int ubik_Flush(struct ubik_trans *transPtr);
|
||||
extern int ubik_Write(register struct ubik_trans *transPtr, void *buffer,
|
||||
afs_int32 length);
|
||||
extern int ubik_Seek(register struct ubik_trans *transPtr, afs_int32 fileid,
|
||||
afs_int32 position);
|
||||
extern int ubik_Tell(register struct ubik_trans *transPtr, afs_int32 * fileid,
|
||||
afs_int32 * position);
|
||||
extern int ubik_Truncate(register struct ubik_trans *transPtr,
|
||||
afs_int32 length);
|
||||
extern int ubik_SetLock(struct ubik_trans *atrans, afs_int32 apos,
|
||||
afs_int32 alen, int atype);
|
||||
extern int ubik_WaitVersion(register struct ubik_dbase *adatabase,
|
||||
register struct ubik_version *aversion);
|
||||
extern int ubik_GetVersion(register struct ubik_trans *atrans,
|
||||
register struct ubik_version *avers);
|
||||
extern int ubik_CacheUpdate(register struct ubik_trans *atrans);
|
||||
/*\}*/
|
||||
|
||||
/*! \name ubikclient.c */
|
||||
|
||||
extern int ubik_ParseClientList(int argc, char **argv, afs_int32 * aothers);
|
||||
|
||||
extern unsigned int afs_random(void
|
||||
);
|
||||
|
||||
extern unsigned int afs_random(void);
|
||||
extern int ubik_ClientInit(register struct rx_connection **serverconns,
|
||||
struct ubik_client **aclient);
|
||||
|
||||
extern afs_int32 ubik_ClientDestroy(struct ubik_client *aclient);
|
||||
|
||||
extern struct rx_connection *ubik_RefreshConn(struct rx_connection *tc);
|
||||
#ifdef UBIK_LEGACY_CALLITER
|
||||
extern afs_int32 ubik_CallIter(int (*aproc) (), struct ubik_client *aclient,
|
||||
afs_int32 aflags, int *apos, long p1, long p2,
|
||||
long p3, long p4, long p5, long p6, long p7,
|
||||
long p8, long p9, long p10, long p11, long p12,
|
||||
long p13, long p14, long p15, long p16);
|
||||
#endif
|
||||
|
||||
extern struct rx_connection *ubik_RefreshConn(struct rx_connection *tc);
|
||||
/*\}*/
|
||||
|
||||
/* ubik.c */
|
||||
extern int ubik_BeginTrans(register struct ubik_dbase *dbase,
|
||||
afs_int32 transMode, struct ubik_trans **transPtr);
|
||||
extern int ubik_EndTrans(register struct ubik_trans *transPtr);
|
||||
/* \name ubikcmd.c */
|
||||
extern int ubik_ParseServerList(int argc, char **argv, afs_int32 *ahost,
|
||||
afs_int32 *aothers);
|
||||
/*\}*/
|
||||
|
||||
/* uinit.c */
|
||||
/* \name uinit.c */
|
||||
|
||||
struct rx_securityClass;
|
||||
extern afs_int32 ugen_ClientInit(int noAuthFlag, char *confDir, char *cellName,
|
||||
afs_int32 sauth,
|
||||
struct ubik_client **uclientp,
|
||||
int (*secproc) (), char *funcName,
|
||||
int (*secproc) (struct rx_securityClass *sc,
|
||||
afs_int32 scIndex),
|
||||
char *funcName,
|
||||
afs_int32 gen_rxkad_level,
|
||||
afs_int32 maxservers, char *serviceid,
|
||||
afs_int32 deadtime, afs_uint32 server,
|
||||
|
@ -25,6 +25,7 @@ RCSID
|
||||
#include "rx/rx.h"
|
||||
#include "afs/lock.h"
|
||||
#include "afs/rxgen_consts.h"
|
||||
#define UBIK_LEGACY_CALLITER 1
|
||||
#include "ubik.h"
|
||||
#include "afs/pthread_glock.h"
|
||||
#else /* defined(UKERNEL) */
|
||||
@ -32,6 +33,7 @@ RCSID
|
||||
#include <afs/pthread_glock.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <rx/xdr.h>
|
||||
#include <rx/rx.h>
|
||||
#include <lock.h>
|
||||
@ -342,7 +344,7 @@ pthread_mutex_t ubik_client_mutex;
|
||||
#define UNLOCK_UCLNT_CACHE assert(pthread_mutex_unlock(&ubik_client_mutex)==0)
|
||||
|
||||
void
|
||||
ubik_client_init_mutex()
|
||||
ubik_client_init_mutex(void)
|
||||
{
|
||||
assert(pthread_mutex_init(&ubik_client_mutex, NULL) == 0);
|
||||
}
|
||||
@ -364,27 +366,10 @@ static int synccount = 0;
|
||||
* \todo In the future, we should also put in a protocol to find the sync site.
|
||||
*/
|
||||
afs_int32
|
||||
ubik_Call(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
|
||||
p11, p12, p13, p14, p15, p16)
|
||||
int (*aproc) ();
|
||||
register struct ubik_client *aclient;
|
||||
afs_int32 aflags;
|
||||
long p1;
|
||||
long p2;
|
||||
long p3;
|
||||
long p4;
|
||||
long p5;
|
||||
long p6;
|
||||
long p7;
|
||||
long p8;
|
||||
long p9;
|
||||
long p10;
|
||||
long p11;
|
||||
long p12;
|
||||
long p13;
|
||||
long p14;
|
||||
long p15;
|
||||
long p16;
|
||||
ubik_Call(int (*aproc) (), register struct ubik_client *aclient,
|
||||
afs_int32 aflags, long p1, long p2, long p3, long p4,
|
||||
long p5, long p6, long p7, long p8, long p9, long p10,
|
||||
long p11, long p12, long p13, long p14, long p15, long p16)
|
||||
{
|
||||
afs_int32 rcode, code, newHost, thisHost, i, count;
|
||||
int chaseCount, pass, needsync, inlist, j;
|
||||
@ -582,29 +567,10 @@ try_GetSyncSite(register struct ubik_client *aclient, afs_int32 apos)
|
||||
* been locked.
|
||||
*/
|
||||
static afs_int32
|
||||
CallIter(aproc, aclient, aflags, apos, p1, p2, p3, p4, p5, p6, p7, p8, p9,
|
||||
p10, p11, p12, p13, p14, p15, p16, needlock)
|
||||
int (*aproc) ();
|
||||
register struct ubik_client *aclient;
|
||||
afs_int32 aflags;
|
||||
int *apos;
|
||||
long p1;
|
||||
long p2;
|
||||
long p3;
|
||||
long p4;
|
||||
long p5;
|
||||
long p6;
|
||||
long p7;
|
||||
long p8;
|
||||
long p9;
|
||||
long p10;
|
||||
long p11;
|
||||
long p12;
|
||||
long p13;
|
||||
long p14;
|
||||
long p15;
|
||||
long p16;
|
||||
int needlock;
|
||||
CallIter(int (*aproc) (), register struct ubik_client *aclient,
|
||||
afs_int32 aflags, int *apos, long p1, long p2, long p3, long p4,
|
||||
long p5, long p6, long p7, long p8, long p9, long p10, long p11,
|
||||
long p12, long p13, long p14, long p15, long p16, int needlock)
|
||||
{
|
||||
register afs_int32 code;
|
||||
struct rx_connection *tc;
|
||||
@ -676,27 +642,10 @@ CallIter(aproc, aclient, aflags, apos, p1, p2, p3, p4, p5, p6, p7, p8, p9,
|
||||
* \todo In the future, we should also put in a protocol to find the sync site.
|
||||
*/
|
||||
afs_int32
|
||||
ubik_Call_New(aproc, aclient, aflags, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10,
|
||||
p11, p12, p13, p14, p15, p16)
|
||||
int (*aproc) ();
|
||||
register struct ubik_client *aclient;
|
||||
afs_int32 aflags;
|
||||
long p1;
|
||||
long p2;
|
||||
long p3;
|
||||
long p4;
|
||||
long p5;
|
||||
long p6;
|
||||
long p7;
|
||||
long p8;
|
||||
long p9;
|
||||
long p10;
|
||||
long p11;
|
||||
long p12;
|
||||
long p13;
|
||||
long p14;
|
||||
long p15;
|
||||
long p16;
|
||||
ubik_Call_New(int (*aproc) (), register struct ubik_client *aclient,
|
||||
afs_int32 aflags, long p1, long p2, long p3, long p4, long p5,
|
||||
long p6, long p7, long p8, long p9, long p10, long p11,
|
||||
long p12, long p13, long p14, long p15, long p16)
|
||||
{
|
||||
afs_int32 code, rcode;
|
||||
afs_int32 count;
|
||||
|
@ -14,6 +14,10 @@ RCSID
|
||||
("$Header$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
@ -22,9 +26,7 @@ RCSID
|
||||
#include <sys/param.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
#include <lock.h>
|
||||
#include <string.h>
|
||||
#include <rx/xdr.h>
|
||||
#include <rx/rx.h>
|
||||
|
||||
@ -35,11 +37,9 @@ RCSID
|
||||
* This file contain useful subroutines for parsing command line args for ubik
|
||||
* applications.
|
||||
*/
|
||||
ubik_ParseServerList(argc, argv, ahost, aothers)
|
||||
int argc;
|
||||
char **argv;
|
||||
afs_int32 *ahost;
|
||||
afs_int32 *aothers;
|
||||
int
|
||||
ubik_ParseServerList(int argc, char **argv, afs_int32 *ahost,
|
||||
afs_int32 *aothers)
|
||||
{
|
||||
register afs_int32 i;
|
||||
register char *tp;
|
||||
|
@ -15,7 +15,11 @@ RCSID
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef AFS_NT40_ENV
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
@ -24,25 +28,21 @@ RCSID
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <afs/afsutil.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <lock.h>
|
||||
#include <rx/xdr.h>
|
||||
#include <rx/rx.h>
|
||||
#include <afs/cmd.h>
|
||||
#include <afs/afsutil.h>
|
||||
|
||||
#define UBIK_INTERNALS
|
||||
#include "ubik.h"
|
||||
#include "ubik_int.h"
|
||||
|
||||
/*! needed by Irix. Include a header to get it, or leave it alone. */
|
||||
extern struct hostent *hostutil_GetHostByName();
|
||||
|
||||
static short
|
||||
PortNumber(register char *aport)
|
||||
{
|
||||
|
@ -48,7 +48,8 @@ RCSID
|
||||
*/
|
||||
afs_int32
|
||||
ugen_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth,
|
||||
struct ubik_client **uclientp, int (*secproc) (),
|
||||
struct ubik_client **uclientp,
|
||||
int (*secproc) (struct rx_securityClass *, afs_int32),
|
||||
char *funcName, afs_int32 gen_rxkad_level,
|
||||
afs_int32 maxservers, char *serviceid, afs_int32 deadtime,
|
||||
afs_uint32 server, afs_uint32 port, afs_int32 usrvid)
|
||||
|
@ -31,16 +31,12 @@ RCSID
|
||||
#include "ubik.h"
|
||||
#include "utst_int.h"
|
||||
|
||||
extern int SAMPLE_Inc(), SAMPLE_Test(), SAMPLE_Get(), SAMPLE_Trun(),
|
||||
SAMPLE_QGet();
|
||||
|
||||
/* main program */
|
||||
|
||||
#include "AFS_component_version_number.c"
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
register afs_int32 code;
|
||||
struct ubik_client *cstruct = 0;
|
||||
@ -87,7 +83,7 @@ main(argc, argv)
|
||||
/* check code from init */
|
||||
if (code) {
|
||||
printf("ubik client init failed with code %d\n", code);
|
||||
return;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* parse command line for our own operations */
|
||||
@ -95,19 +91,19 @@ main(argc, argv)
|
||||
if (!strcmp(argv[i], "-inc")) {
|
||||
/* use ubik_Call to do the work, finding an up server and handling
|
||||
* the job of finding a sync site, if need be */
|
||||
code = ubik_Call(SAMPLE_Inc, cstruct, 0);
|
||||
code = ubik_SAMPLE_Inc(cstruct, 0);
|
||||
printf("return code is %d\n", code);
|
||||
} else if (!strcmp(argv[i], "-try")) {
|
||||
code = ubik_Call(SAMPLE_Test, cstruct, 0);
|
||||
code = ubik_SAMPLE_Test(cstruct, 0);
|
||||
printf("return code is %d\n", code);
|
||||
} else if (!strcmp(argv[i], "-qget")) {
|
||||
code = ubik_Call(SAMPLE_QGet, cstruct, 0, &temp);
|
||||
code = ubik_SAMPLE_QGet(cstruct, 0, &temp);
|
||||
printf("got quick value %d (code %d)\n", temp, code);
|
||||
} else if (!strcmp(argv[i], "-get")) {
|
||||
code = ubik_Call(SAMPLE_Get, cstruct, 0, &temp);
|
||||
code = ubik_SAMPLE_Get(cstruct, 0, &temp);
|
||||
printf("got value %d (code %d)\n", temp, code);
|
||||
} else if (!strcmp(argv[i], "-trunc")) {
|
||||
code = ubik_Call(SAMPLE_Trun, cstruct, 0);
|
||||
code = ubik_SAMPLE_Trun(cstruct, 0);
|
||||
printf("return code is %d\n", code);
|
||||
} else if (!strcmp(argv[i], "-minc")) {
|
||||
afs_int32 temp;
|
||||
@ -118,22 +114,22 @@ main(argc, argv)
|
||||
|
||||
while (1) {
|
||||
temp = 0;
|
||||
code = ubik_Call(SAMPLE_Get, cstruct, 0, &temp);
|
||||
code = ubik_SAMPLE_Get(cstruct, 0, &temp);
|
||||
if (code != 0) {
|
||||
printf("SAMPLE_Inc #1 failed with code %ld\n", code);
|
||||
printf("SAMPLE_Get #1 failed with code %ld\n", code);
|
||||
} else {
|
||||
printf("SAMPLE_Get #1 succeeded, got value %d\n", temp);
|
||||
}
|
||||
|
||||
temp = 0;
|
||||
code = ubik_Call(SAMPLE_Inc, cstruct, 0);
|
||||
code = ubik_SAMPLE_Inc(cstruct, 0);
|
||||
if (code != 0) {
|
||||
printf("SAMPLE_Inc #1 failed with code %ld\n", code);
|
||||
} else {
|
||||
printf("SAMPLE_Inc #1 succeeded, incremented integer\n");
|
||||
}
|
||||
temp = 0;
|
||||
code = ubik_Call(SAMPLE_Get, cstruct, 0, &temp);
|
||||
code = ubik_SAMPLE_Get(cstruct, 0, &temp);
|
||||
if (code != 0) {
|
||||
printf("SAMPLE_Get #2 failed with code %ld\n", code);
|
||||
} else {
|
||||
@ -141,7 +137,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
temp = 0;
|
||||
code = ubik_Call(SAMPLE_Inc, cstruct, 0);
|
||||
code = ubik_SAMPLE_Inc(cstruct, 0);
|
||||
if (code != 0)
|
||||
printf("SAMPLE_Inc #2 failed with code %ld\n", code);
|
||||
else
|
||||
@ -162,16 +158,16 @@ main(argc, argv)
|
||||
tv.tv_sec = 1;
|
||||
tv.tv_usec = 0;
|
||||
while (1) {
|
||||
code = ubik_Call(SAMPLE_Get, cstruct, 0, &temp);
|
||||
code = ubik_SAMPLE_Get(cstruct, 0, &temp);
|
||||
printf("got value %d (code %d)\n", temp, code);
|
||||
|
||||
code = ubik_Call(SAMPLE_Inc, cstruct, 0);
|
||||
code = ubik_SAMPLE_Inc(cstruct, 0);
|
||||
printf("update return code is %d\n", code);
|
||||
|
||||
code = ubik_Call(SAMPLE_Get, cstruct, 0, &temp);
|
||||
code = ubik_SAMPLE_Get(cstruct, 0, &temp);
|
||||
printf("got value %d (code %d)\n", temp, code);
|
||||
|
||||
code = ubik_Call(SAMPLE_Get, cstruct, 0, &temp);
|
||||
code = ubik_SAMPLE_Get(cstruct, 0, &temp);
|
||||
printf("got value %d (code %d)\n", temp, code);
|
||||
|
||||
tv.tv_sec = 1;
|
||||
@ -184,4 +180,5 @@ main(argc, argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ RCSID
|
||||
#include <rx/xdr.h>
|
||||
#include <rx/rx.h>
|
||||
#include <lock.h>
|
||||
#include <afs/afsutil.h>
|
||||
#include "ubik.h"
|
||||
#include "utst_int.h"
|
||||
|
||||
@ -38,8 +39,8 @@ struct ubik_dbase *dbase;
|
||||
afs_int32 sleepTime;
|
||||
/*\}*/
|
||||
|
||||
SAMPLE_Inc(rxconn)
|
||||
struct rx_connection *rxconn;
|
||||
int
|
||||
SAMPLE_Inc(struct rx_connection *rxconn)
|
||||
{
|
||||
afs_int32 code, temp;
|
||||
struct ubik_trans *tt;
|
||||
@ -97,10 +98,8 @@ SAMPLE_Inc(rxconn)
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
SAMPLE_Get(rxconn, gnumber)
|
||||
struct rx_connection *rxconn;
|
||||
afs_int32 *gnumber;
|
||||
int
|
||||
SAMPLE_Get(struct rx_connection *rxconn, afs_int32 *gnumber)
|
||||
{
|
||||
afs_int32 code, temp;
|
||||
struct ubik_trans *tt;
|
||||
@ -144,10 +143,8 @@ SAMPLE_Get(rxconn, gnumber)
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
SAMPLE_QGet(rxconn, gnumber)
|
||||
struct rx_connection *rxconn;
|
||||
afs_int32 *gnumber;
|
||||
int
|
||||
SAMPLE_QGet(struct rx_connection *rxconn, afs_int32 *gnumber)
|
||||
{
|
||||
afs_int32 code, temp;
|
||||
struct ubik_trans *tt;
|
||||
@ -191,9 +188,8 @@ SAMPLE_QGet(rxconn, gnumber)
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
SAMPLE_Trun(rxconn)
|
||||
struct rx_connection *rxconn;
|
||||
int
|
||||
SAMPLE_Trun(struct rx_connection *rxconn)
|
||||
{
|
||||
afs_int32 code;
|
||||
struct ubik_trans *tt;
|
||||
@ -231,9 +227,8 @@ SAMPLE_Trun(rxconn)
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
SAMPLE_Test(rxconn)
|
||||
struct rx_connection *rxconn;
|
||||
int
|
||||
SAMPLE_Test(struct rx_connection *rxconn)
|
||||
{
|
||||
afs_int32 code, temp;
|
||||
struct ubik_trans *tt;
|
||||
@ -281,16 +276,16 @@ SAMPLE_Test(rxconn)
|
||||
|
||||
#include "AFS_component_version_number.c"
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
extern int SAMPLE_ExecuteRequest(struct rx_call *);
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
register afs_int32 code, i;
|
||||
afs_int32 serverList[MAXSERVERS];
|
||||
afs_int32 myHost;
|
||||
struct rx_service *tservice;
|
||||
struct rx_securityClass *sc[2];
|
||||
extern int SAMPLE_ExecuteRequest();
|
||||
char dbfileName[128];
|
||||
|
||||
if (argc == 1) {
|
||||
@ -333,7 +328,7 @@ main(argc, argv)
|
||||
|
||||
if (code) {
|
||||
printf("ubik init failed with code %d\n", code);
|
||||
return;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sc[0] = rxnull_NewServerSecurityObject();
|
||||
@ -350,4 +345,6 @@ main(argc, argv)
|
||||
rx_SetMaxProcs(tservice, 3);
|
||||
|
||||
rx_StartServer(1); /* Why waste this idle process?? */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -557,20 +557,30 @@ SVOTE_GetSyncSite(register struct rx_call * rxcall,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ubik_dprint(char *a, char *b, char *c, char *d, char *e, char *f, char *g,
|
||||
char *h)
|
||||
void
|
||||
ubik_dprint(const char *format, ...)
|
||||
{
|
||||
ViceLog(5, (a, b, c, d, e, f, g, h));
|
||||
return 0;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
vViceLog(5, (format, ap));
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
int
|
||||
ubik_print(char *a, char *b, char *c, char *d, char *e, char *f, char *g,
|
||||
char *h)
|
||||
void
|
||||
ubik_vprint(const char *format, va_list ap)
|
||||
{
|
||||
ViceLog(0, (a, b, c, d, e, f, g, h));
|
||||
return 0;
|
||||
vViceLog(0, (format, ap));
|
||||
}
|
||||
|
||||
void
|
||||
ubik_print(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
ubik_vprint(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
Reference in New Issue
Block a user