trans.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <libgen.h>
#include <stdio.h>
#include <dirent.h>
#include <errno.h>
#include <sys/mman.h>
#include "libjio.h"
#include "common.h"
#include "compat.h"
#include "journal.h"
#include "trans.h"

Include dependency graph for trans.c:

Go to the source code of this file.

Functions

struct jtransjtrans_new (struct jfs *fs, unsigned int flags)
 Create a new transaction.
void jtrans_free (struct jtrans *ts)
 Free a transaction structure.
static int lock_file_ranges (struct jtrans *ts, int mode)
 Lock/unlock the ranges of the file covered by the transaction.
static int operation_read_prev (struct jtrans *ts, struct operation *op)
 Read the previous information from the disk into the given operation structure.
static int jtrans_add_common (struct jtrans *ts, const void *buf, size_t count, off_t offset, enum op_direction direction)
 Common function to add an operation to a transaction.
int jtrans_add_r (struct jtrans *ts, void *buf, size_t count, off_t offset)
 Add a read operation to a transaction.
int jtrans_add_w (struct jtrans *ts, const void *buf, size_t count, off_t offset)
 Add a write operation to a transaction.
ssize_t jtrans_commit (struct jtrans *ts)
 Commit a transaction.
ssize_t jtrans_rollback (struct jtrans *ts)
 Rollback a transaction.
struct jfsjopen (const char *name, int flags, int mode, unsigned int jflags)
 Open a file.
int jsync (struct jfs *fs)
 Sync a file.
int jmove_journal (struct jfs *fs, const char *newpath)
 Change the location of the journal directory.
int jclose (struct jfs *fs)
 Close a file opened with jopen().


Function Documentation

static int lock_file_ranges ( struct jtrans ts,
int  mode 
) [static]

Lock/unlock the ranges of the file covered by the transaction.

mode must be either F_LOCKW or F_UNLOCK. Returns 0 on success, -1 on error.

Definition at line 81 of file trans.c.

Referenced by jtrans_commit().

Here is the call graph for this function:

Here is the caller graph for this function:

static int operation_read_prev ( struct jtrans ts,
struct operation op 
) [static]

Read the previous information from the disk into the given operation structure.

Returns 0 on success, -1 on error.

Definition at line 112 of file trans.c.

Referenced by jtrans_commit().

Here is the call graph for this function:

Here is the caller graph for this function:

static int jtrans_add_common ( struct jtrans ts,
const void *  buf,
size_t  count,
off_t  offset,
enum op_direction  direction 
) [static]

Common function to add an operation to a transaction.

Definition at line 139 of file trans.c.

Referenced by jtrans_add_r(), and jtrans_add_w().

Here is the caller graph for this function:


Generated on Sat Sep 12 13:33:33 2009 for libjio (internal) by  doxygen 1.5.8