OpenAFS
OpenAFS distributed network file system
|
This system is organized in a hierarchical set of related modules. More...
#include <afsconfig.h>
#include <afs/param.h>
#include <roken.h>
#include <afs/opr.h>
#include <lock.h>
#include <rx/rx.h>
#include <afs/cellconfig.h>
#include "ubik.h"
#include "ubik_int.h"
#include <lwp.h>
Defines | |
#define | UBIK_INTERNALS |
#define | ERROR_EXIT(code) |
#define | CStampVersion 1 |
Functions | |
static_inline struct rx_connection * | Quorum_StartIO (struct ubik_trans *atrans, struct ubik_server *as) |
static_inline void | Quorum_EndIO (struct ubik_trans *atrans, struct rx_connection *aconn) |
afs_int32 | ContactQuorum_NoArguments (afs_int32(*proc)(struct rx_connection *, ubik_tid *), struct ubik_trans *atrans, int aflags) |
Perform an operation at a quorum, handling error conditions. | |
afs_int32 | ContactQuorum_DISK_Lock (struct ubik_trans *atrans, int aflags, afs_int32 file, afs_int32 position, afs_int32 length, afs_int32 type) |
afs_int32 | ContactQuorum_DISK_Write (struct ubik_trans *atrans, int aflags, afs_int32 file, afs_int32 position, bulkdata *data) |
afs_int32 | ContactQuorum_DISK_Truncate (struct ubik_trans *atrans, int aflags, afs_int32 file, afs_int32 length) |
afs_int32 | ContactQuorum_DISK_WriteV (struct ubik_trans *atrans, int aflags, iovec_wrt *io_vector, iovec_buf *io_buffer) |
afs_int32 | ContactQuorum_DISK_SetVersion (struct ubik_trans *atrans, int aflags, ubik_version *OldVersion, ubik_version *NewVersion) |
int | ubik_ServerInitByInfo (afs_uint32 myHost, short myPort, struct afsconf_cell *info, char clones[], const char *pathName, struct ubik_dbase **dbase) |
int | ubik_ServerInit (afs_uint32 myHost, short myPort, afs_uint32 serverList[], const char *pathName, struct ubik_dbase **dbase) |
int | ubik_BeginTrans (struct ubik_dbase *dbase, afs_int32 transMode, struct ubik_trans **transPtr) |
int | ubik_BeginTransReadAny (struct ubik_dbase *dbase, afs_int32 transMode, struct ubik_trans **transPtr) |
int | ubik_BeginTransReadAnyWrite (struct ubik_dbase *dbase, afs_int32 transMode, struct ubik_trans **transPtr) |
int | ubik_AbortTrans (struct ubik_trans *transPtr) |
This routine ends a read or write transaction by aborting it. | |
int | ubik_EndTrans (struct ubik_trans *transPtr) |
This routine ends a read or write transaction on the open transaction identified by transPtr. | |
int | ubik_Read (struct ubik_trans *transPtr, void *buffer, afs_int32 length) |
This routine reads length bytes into buffer from the current position in the database. | |
int | ubik_Flush (struct ubik_trans *transPtr) |
This routine will flush the io data in the iovec structures. | |
int | ubik_Write (struct ubik_trans *transPtr, void *vbuffer, afs_int32 length) |
int | ubik_Seek (struct ubik_trans *transPtr, afs_int32 fileid, afs_int32 position) |
This sets the file pointer associated with the current transaction to the appropriate file and byte position. | |
int | ubik_Tell (struct ubik_trans *transPtr, afs_int32 *fileid, afs_int32 *position) |
This call returns the file pointer associated with the specified transaction in fileid and position . | |
int | ubik_Truncate (struct ubik_trans *transPtr, afs_int32 length) |
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_SetLock (struct ubik_trans *atrans, afs_int32 apos, afs_int32 alen, int atype) |
set a lock; all locks are released on transaction end (commit/abort) | |
int | ubik_WaitVersion (struct ubik_dbase *adatabase, struct ubik_version *aversion) |
utility to wait for a version # to change | |
int | ubik_GetVersion (struct ubik_trans *atrans, struct ubik_version *avers) |
utility to get the version of the dbase a transaction is dealing with | |
int | ubik_CheckCache (struct ubik_trans *atrans, ubik_updatecache_func cbf, void *rock) |
void | panic (char *format,...) |
"Who said anything about panicking?" snapped Arthur. | |
afs_uint32 | ubikGetPrimaryInterfaceAddr (afs_uint32 addr) |
This function takes an IP addresses as its parameter. | |
int | ubik_CheckAuth (struct rx_call *acall) |
void | ubik_SetServerSecurityProcs (void(*buildproc)(void *, struct rx_securityClass ***, afs_int32 *), int(*checkproc)(void *, struct rx_call *), void *rock) |
Variables | |
afs_int32 | ubik_quorum = 0 |
struct ubik_dbase * | ubik_dbase = 0 |
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_SyncWriterCacheProc )(void) |
struct ubik_server * | ubik_servers |
short | ubik_callPortal |
int(* | ubik_SRXSecurityProc )(void *, struct rx_securityClass **, afs_int32 *) |
void * | ubik_SRXSecurityRock |
int(* | ubik_CheckRXSecurityProc )(void *, struct rx_call *) |
void * | ubik_CheckRXSecurityRock |
struct version_data | version_globals |
This system is organized in a hierarchical set of related modules.
Modules at one level can only call modules at the same level or below.
At the bottom level (0) we have R, RFTP, LWP and IOMGR, i.e. the basic operating system primitives.
At the next level (1) we have
At the next level (2) we have
At the next level (3) we have
At the next level (4) we have
#define ERROR_EXIT | ( | code | ) |
do { \ error = (code); \ goto error_exit; \ } while (0)
afs_int32 ContactQuorum_NoArguments | ( | afs_int32(*)(struct rx_connection *, ubik_tid *) | proc, |
struct ubik_trans * | atrans, | ||
int | aflags | ||
) |
Perform an operation at a quorum, handling error conditions.
beaconSinceDown
). void panic | ( | char * | format, |
... | |||
) |
"Who said anything about panicking?" snapped Arthur.
"This is still just the culture shock. You wait till I've settled down into the situation and found my bearings. \em Then I'll start panicking!" --Authur Dent
int ubik_BeginTrans | ( | struct ubik_dbase * | dbase, |
afs_int32 | transMode, | ||
struct ubik_trans ** | transPtr | ||
) |
int ubik_BeginTransReadAny | ( | struct ubik_dbase * | dbase, |
afs_int32 | transMode, | ||
struct ubik_trans ** | transPtr | ||
) |
int ubik_BeginTransReadAnyWrite | ( | struct ubik_dbase * | dbase, |
afs_int32 | transMode, | ||
struct ubik_trans ** | transPtr | ||
) |
int ubik_CheckCache | ( | struct ubik_trans * | atrans, |
ubik_updatecache_func | cbf, | ||
void * | rock | ||
) |
check and possibly update cache of ubik db.
If the version of the cached db data is out of date, this calls (*check) to update the cache. If (*check) returns success, we update the version of the cached db data.
Checking the version of the cached db data is done under a read lock; updating the cache (and thus calling (*check)) is done under a write lock so is guaranteed not to interfere with another thread's (*check). On successful return, a read lock on the cached db data is obtained, which will be released by ubik_EndTrans or ubik_AbortTrans.
[in] | atrans | ubik transaction |
[in] | check | function to call to check/update cache |
[in] | rock | rock to pass to *check |
0 | success |
nonzero | error; cachedVersion not updated |
int ubik_EndTrans | ( | struct ubik_trans * | transPtr | ) |
This routine ends a read or write transaction on the open transaction identified by transPtr.
int ubik_Flush | ( | struct ubik_trans * | transPtr | ) |
This routine will flush the io data in the iovec structures.
It first flushes to the local disk and then uses ContactQuorum to write it to the other servers.
int ubik_Read | ( | struct ubik_trans * | transPtr, |
void * | buffer, | ||
afs_int32 | length | ||
) |
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. A short read returns zero for an error code.
int ubik_Seek | ( | struct ubik_trans * | transPtr, |
afs_int32 | fileid, | ||
afs_int32 | position | ||
) |
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_ServerInit | ( | afs_uint32 | myHost, |
short | myPort, | ||
afs_uint32 | serverList[], | ||
const char * | pathName, | ||
struct ubik_dbase ** | dbase | ||
) |
int ubik_ServerInitByInfo | ( | afs_uint32 | myHost, |
short | myPort, | ||
struct afsconf_cell * | info, | ||
char | clones[], | ||
const char * | pathName, | ||
struct ubik_dbase ** | dbase | ||
) |
afs_uint32 ubikGetPrimaryInterfaceAddr | ( | afs_uint32 | addr | ) |
This function takes an IP addresses as its parameter.
It returns the the primary IP address that is on the host passed in, or 0 if not found.