libjio.h | libjio.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* logical structures */ | /* logical structures */ | |||
/* the main file structure */ | /* the main file structure */ | |||
struct jfs { | struct jfs { | |||
int fd; /* main file descriptor */ | int fd; /* main file descriptor */ | |||
char *name; /* and its name */ | char *name; /* and its name */ | |||
char *jdir; /* journal directory */ | ||||
int jdirfd; /* journal directory file descriptor */ | int jdirfd; /* journal directory file descriptor */ | |||
int jfd; /* journal's lock file descriptor */ | int jfd; /* journal's lock file descriptor */ | |||
unsigned int *jmap; /* journal's lock file mmap area */ | unsigned int *jmap; /* journal's lock file mmap area */ | |||
uint32_t flags; /* journal flags */ | uint32_t flags; /* journal flags */ | |||
struct jlinger *ltrans; /* lingered transactions */ | struct jlinger *ltrans; /* lingered transactions */ | |||
pthread_mutex_t ltlock; /* lingered transactions' lock */ | pthread_mutex_t ltlock; /* lingered transactions' lock */ | |||
pthread_mutex_t lock; /* a soft lock used in some operations */ | pthread_mutex_t lock; /* a soft lock used in some operations */ | |||
}; | }; | |||
/* a single operation */ | /* a single operation */ | |||
skipping to change at line 64 | skipping to change at line 65 | |||
struct joper *next; | struct joper *next; | |||
}; | }; | |||
/* a transaction */ | /* a transaction */ | |||
struct jtrans { | struct jtrans { | |||
struct jfs *fs; /* journal file structure to operate on */ | struct jfs *fs; /* journal file structure to operate on */ | |||
char *name; /* name of the transaction file */ | char *name; /* name of the transaction file */ | |||
int id; /* transaction id */ | int id; /* transaction id */ | |||
uint32_t flags; /* transaction flags */ | uint32_t flags; /* transaction flags */ | |||
unsigned int numops; /* quantity of operations in the list */ | unsigned int numops; /* quantity of operations in the list */ | |||
ssize_t len; /* transaction's length */ | ||||
pthread_mutex_t lock; /* used to modify the operation list */ | pthread_mutex_t lock; /* used to modify the operation list */ | |||
struct joper *op; /* list of operations */ | struct joper *op; /* list of operations */ | |||
}; | }; | |||
/* lingered transaction */ | /* lingered transaction */ | |||
struct jlinger { | struct jlinger { | |||
int id; /* transaction id */ | int id; /* transaction id */ | |||
char *name; /* name of the transaction file */ | char *name; /* name of the transaction file */ | |||
struct jlinger *next; | struct jlinger *next; | |||
}; | }; | |||
skipping to change at line 110 | skipping to change at line 112 | |||
}; | }; | |||
/* core functions */ | /* core functions */ | |||
int jopen(struct jfs *fs, const char *name, int flags, int mode, int jflags ); | int jopen(struct jfs *fs, const char *name, int flags, int mode, int jflags ); | |||
void jtrans_init(struct jfs *fs, struct jtrans *ts); | void jtrans_init(struct jfs *fs, struct jtrans *ts); | |||
int jtrans_add(struct jtrans *ts, const void *buf, size_t count, off_t offs et); | int jtrans_add(struct jtrans *ts, const void *buf, size_t count, off_t offs et); | |||
ssize_t jtrans_commit(struct jtrans *ts); | ssize_t jtrans_commit(struct jtrans *ts); | |||
ssize_t jtrans_rollback(struct jtrans *ts); | ssize_t jtrans_rollback(struct jtrans *ts); | |||
void jtrans_free(struct jtrans *ts); | void jtrans_free(struct jtrans *ts); | |||
int jsync(struct jfs *fs); | int jsync(struct jfs *fs); | |||
int jmove_journal(struct jfs *fs, const char *newpath); | ||||
int jclose(struct jfs *fs); | int jclose(struct jfs *fs); | |||
/* journal checker */ | /* journal checker */ | |||
int jfsck(const char *name, struct jfsck_result *res); | int jfsck(const char *name, const char *jdir, struct jfsck_result *res); | |||
int jfsck_cleanup(const char *name); | int jfsck_cleanup(const char *name, const char *jdir); | |||
/* UNIX API wrappers */ | /* UNIX API wrappers */ | |||
ssize_t jread(struct jfs *fs, void *buf, size_t count); | ssize_t jread(struct jfs *fs, void *buf, size_t count); | |||
ssize_t jpread(struct jfs *fs, void *buf, size_t count, off_t offset); | ssize_t jpread(struct jfs *fs, void *buf, size_t count, off_t offset); | |||
ssize_t jreadv(struct jfs *fs, const struct iovec *vector, int count); | ssize_t jreadv(struct jfs *fs, const struct iovec *vector, int count); | |||
ssize_t jwrite(struct jfs *fs, const void *buf, size_t count); | ssize_t jwrite(struct jfs *fs, const void *buf, size_t count); | |||
ssize_t jpwrite(struct jfs *fs, const void *buf, size_t count, off_t offset ); | ssize_t jpwrite(struct jfs *fs, const void *buf, size_t count, off_t offset ); | |||
ssize_t jwritev(struct jfs *fs, const struct iovec *vector, int count); | ssize_t jwritev(struct jfs *fs, const struct iovec *vector, int count); | |||
int jtruncate(struct jfs *fs, off_t length); | int jtruncate(struct jfs *fs, off_t length); | |||
off_t jlseek(struct jfs *fs, off_t offset, int whence); | off_t jlseek(struct jfs *fs, off_t offset, int whence); | |||
skipping to change at line 137 | skipping to change at line 140 | |||
struct jfs *jfopen(const char *path, const char *mode); | struct jfs *jfopen(const char *path, const char *mode); | |||
int jfclose(struct jfs *stream); | int jfclose(struct jfs *stream); | |||
struct jfs *jfreopen(const char *path, const char *mode, struct jfs *stream ); | struct jfs *jfreopen(const char *path, const char *mode, struct jfs *stream ); | |||
size_t jfread(void *ptr, size_t size, size_t nmemb, struct jfs *stream); | size_t jfread(void *ptr, size_t size, size_t nmemb, struct jfs *stream); | |||
size_t jfwrite(const void *ptr, size_t size, size_t nmemb, struct jfs *stre am); | size_t jfwrite(const void *ptr, size_t size, size_t nmemb, struct jfs *stre am); | |||
int jfileno(struct jfs *stream); | int jfileno(struct jfs *stream); | |||
int jfeof(struct jfs *stream); | int jfeof(struct jfs *stream); | |||
void jclearerr(struct jfs *stream); | void jclearerr(struct jfs *stream); | |||
int jferror(struct jfs *stream); | int jferror(struct jfs *stream); | |||
int jfseek(struct jfs *stream, long offset, int whence); | int jfseek(struct jfs *stream, long offset, int whence); | |||
int jftell(struct jfs *stream); | long jftell(struct jfs *stream); | |||
void frewind(struct jfs *stream); | void jrewind(struct jfs *stream); | |||
FILE *jfsopen(struct jfs *stream, const char *mode); | FILE *jfsopen(struct jfs *stream, const char *mode); | |||
/* jfs and jtrans constants */ | /* jfs and jtrans constants */ | |||
#define J_NOLOCK 1 /* don't lock the file before operating on i t */ | #define J_NOLOCK 1 /* don't lock the file before operating on i t */ | |||
#define J_NOROLLBACK 2 /* no need to read rollback information */ | #define J_NOROLLBACK 2 /* no need to read rollback information */ | |||
#define J_LINGER 4 /* use lingering transactions */ | #define J_LINGER 4 /* use lingering transactions */ | |||
#define J_COMMITTED 8 /* mark a transaction as committed */ | #define J_COMMITTED 8 /* mark a transaction as committed */ | |||
#define J_ROLLBACKED 16 /* mark a transaction as rollbacked */ | #define J_ROLLBACKED 16 /* mark a transaction as rollbacked */ | |||
#define J_ROLLBACKING 32 /* mark a transaction as rollbacking */ | #define J_ROLLBACKING 32 /* mark a transaction as rollbacking */ | |||
#define J_RDONLY 64 /* mark a file as read-only */ | #define J_RDONLY 64 /* mark a file as read-only */ | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 7 lines changed or added | |||