#define PHSIZE 128
static struct buffer {
- struct ubik_dbase *dbase; /* dbase within which the buffer resides */
- afs_int32 file; /* Unique cache key */
- afs_int32 page; /* page number */
+ struct ubik_dbase *dbase; /*!< dbase within which the buffer resides */
+ afs_int32 file; /*!< Unique cache key */
+ afs_int32 page; /*!< page number */
struct buffer *lru_next;
struct buffer *lru_prev;
- struct buffer *hashNext; /* next dude in hash table */
- char *data; /* ptr to the data */
- char lockers; /* usage ref count */
- char dirty; /* is buffer modified */
- char hashIndex; /* back ptr to hash table */
+ struct buffer *hashNext; /*!< next dude in hash table */
+ char *data; /*!< ptr to the data */
+ char lockers; /*!< usage ref count */
+ char dirty; /*!< is buffer modified */
+ char hashIndex; /*!< back ptr to hash table */
} *Buffers;
#define pHash(page) ((page) & (PHSIZE-1))
afs_int32 ubik_nBuffers = NBUFFERS;
-static struct buffer *phTable[PHSIZE]; /* page hash table */
+static struct buffer *phTable[PHSIZE]; /*!< page hash table */
static struct buffer *LruBuffer;
static int nbuffers;
static int calls = 0, ios = 0, lastb = 0;
static struct ubik_trunc *freeTruncList = 0;
-/* remove a transaction from the database's active transaction list. Don't free it */
+/*!
+ * \brief Remove a transaction from the database's active transaction list. Don't free it.
+ */
static int
unthread(struct ubik_trans *atrans)
{
return 2; /* no entry */
}
-/* some debugging assistance */
+/*!
+ * \brief some debugging assistance
+ */
int
udisk_Debug(struct ubik_debug *aparm)
{
return 0;
}
-/* log format is defined here, and implicitly in recovery.c
+/*!
+ * \brief Write an opcode to the log.
+ *
+ * log format is defined here, and implicitly in recovery.c
*
* 4 byte opcode, followed by parameters, each 4 bytes long. All integers
* are in logged in network standard byte order, in case we want to move logs
* from machine-to-machine someday.
*
- * Begin transaction: opcode
- * Commit transaction: opcode, version (8 bytes)
- * Truncate file: opcode, file number, length
- * Abort transaction: opcode
- * Write data: opcode, file, position, length, <length> data bytes
+ * Begin transaction: opcode \n
+ * Commit transaction: opcode, version (8 bytes) \n
+ * Truncate file: opcode, file number, length \n
+ * Abort transaction: opcode \n
+ * Write data: opcode, file, position, length, <length> data bytes \n
*/
-
-/* write an opcode to the log */
int
udisk_LogOpcode(struct ubik_dbase *adbase, afs_int32 aopcode, int async)
{
return code;
}
-/* log a commit, never syncing */
+/*!
+ * \brief Log a commit, never syncing.
+ */
int
udisk_LogEnd(struct ubik_dbase *adbase, struct ubik_version *aversion)
{
return code;
}
-/* log a truncate operation, never syncing */
+/*!
+ * \brief Log a truncate operation, never syncing.
+ */
int
udisk_LogTruncate(struct ubik_dbase *adbase, afs_int32 afile,
afs_int32 alength)
return 0;
}
-/* write some data to the log, never syncing */
+/*!
+ * \brief Write some data to the log, never syncing.
+ */
int
udisk_LogWriteData(struct ubik_dbase *adbase, afs_int32 afile, char *abuffer,
afs_int32 apos, afs_int32 alen)
return 0;
}
-/* Take a buffer and mark it as the least recently used buffer */
+/*!
+ * \brief Take a buffer and mark it as the least recently used buffer.
+ */
static void
Dlru(struct buffer *abuf)
{
LruBuffer = abuf;
}
-/* Take a buffer and mark it as the most recently used buffer */
+/*!
+ * \brief Take a buffer and mark it as the most recently used buffer.
+ */
static void
Dmru(struct buffer *abuf)
{
LruBuffer->lru_prev = abuf;
}
-/* get a pointer to a particular buffer */
+/*!
+ * \brief Get a pointer to a particular buffer.
+ */
static char *
DRead(struct ubik_dbase *dbase, afs_int32 fid, int page)
{
return tb->data;
}
-/* zap truncated pages */
+/*!
+ * \brief Zap truncated pages.
+ */
static int
DTrunc(struct ubik_dbase *dbase, afs_int32 fid, afs_int32 length)
{
return 0;
}
-/* allocate a truncation entry. We allocate special entries representing truncations, rather than
- performing them immediately, so that we can abort a transaction easily by simply purging
- the in-core memory buffers and discarding these truncation entries.
-*/
+/*!
+ * \brief Allocate a truncation entry.
+ *
+ * We allocate special entries representing truncations, rather than
+ * 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(void)
{
return tt;
}
-/* free a truncation entry */
+/*!
+ * \brief Free a truncation entry.
+ */
static int
PutTrunc(struct ubik_trunc *at)
{
return 0;
}
-/* find a truncation entry for a file, if any */
+/*!
+ * \brief Find a truncation entry for a file, if any.
+ */
static struct ubik_trunc *
FindTrunc(struct ubik_trans *atrans, afs_int32 afile)
{
return (struct ubik_trunc *)0;
}
-/* do truncates associated with trans, and free them */
+/*!
+ * \brief Do truncates associated with \p atrans, and free them.
+ */
static int
DoTruncs(struct ubik_trans *atrans)
{
return (rcode);
}
-/* mark a fid as invalid */
+/*!
+ * \brief Mark an \p fid as invalid.
+ */
int
udisk_Invalidate(struct ubik_dbase *adbase, afs_int32 afid)
{
return 0;
}
-/* move this page into the correct hash bucket */
+/*!
+ * \brief Move this page into the correct hash bucket.
+ */
static int
FixupBucket(struct buffer *ap)
{
return 0;
}
-/* create a new slot for a particular dbase page */
+/*!
+ * \brief Create a new slot for a particular dbase page.
+ */
static struct buffer *
newslot(struct ubik_dbase *adbase, afs_int32 afid, afs_int32 apage)
{
return pp;
}
-/* Release a buffer, specifying whether or not the buffer has been modified by the locker. */
+/*!
+ * \brief Release a buffer, specifying whether or not the buffer has been modified by the locker.
+ */
static void
DRelease(char *ap, int flag)
{
return;
}
-/* flush all modified buffers, leaves dirty bits set (they're cleared
- * by DSync). Note interaction with DSync: you call this thing first,
- * writing the buffers to the disk. Then you call DSync to sync all the
+/*!
+ * \brief Flush all modified buffers, leaves dirty bits set (they're cleared
+ * by DSync()).
+ *
+ * \note Note interaction with DSync(): you call this thing first,
+ * writing the buffers to the disk. Then you call DSync() to sync all the
* files that were written, and to clear the dirty bits. You should
* always call DFlush/DSync as a pair.
*/
return 0;
}
-/* flush all modified buffers */
+/*!
+ * \brief Flush all modified buffers.
+ */
static int
DAbort(struct ubik_dbase *adbase)
{
return 0;
}
-/* must only be called after DFlush, due to its interpretation of dirty flag */
+/*!
+ * \attention DSync() must only be called after DFlush(), due to its interpretation of dirty flag.
+ */
static int
DSync(struct ubik_dbase *adbase)
{
return rCode;
}
-/* Same as read, only do not even try to read the page */
+/*!
+ * \brief Same as DRead(), only do not even try to read the page.
+ */
static char *
DNew(struct ubik_dbase *dbase, afs_int32 fid, int page)
{
return tb->data;
}
-/* read data from database */
+/*!
+ * \brief Read data from database.
+ */
int
udisk_read(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
afs_int32 apos, afs_int32 alen)
return 0;
}
-/* truncate file */
+/*!
+ * \brief Truncate file.
+ */
int
udisk_truncate(struct ubik_trans *atrans, afs_int32 afile, afs_int32 alength)
{
return code;
}
-/* write data to database, using logs */
+/*!
+ * \brief Write data to database, using logs.
+ */
int
udisk_write(struct ubik_trans *atrans, afs_int32 afile, char *abuffer,
afs_int32 apos, afs_int32 alen)
return 0;
}
-/* begin a new local transaction */
+/*!
+ * \brief Begin a new local transaction.
+ */
int
udisk_begin(struct ubik_dbase *adbase, int atype, struct ubik_trans **atrans)
{
return 0;
}
-/* commit transaction */
+/*!
+ * \brief Commit transaction.
+ */
int
udisk_commit(struct ubik_trans *atrans)
{
return code;
}
-/* abort transaction */
+/*!
+ * \brief Abort transaction.
+ */
int
udisk_abort(struct ubik_trans *atrans)
{
return 0;
}
-/* destroy a transaction after it has been committed or aborted. if
- * it hasn't committed before you call this routine, we'll abort the
+/*!
+ * \brief Destroy a transaction after it has been committed or aborted.
+ *
+ * If it hasn't committed before you call this routine, we'll abort the
* transaction for you.
*/
int