libjio.h | libjio.h | |||
---|---|---|---|---|
skipping to change at line 15 | skipping to change at line 15 | |||
*/ | */ | |||
#ifndef _LIBJIO_H | #ifndef _LIBJIO_H | |||
#define _LIBJIO_H | #define _LIBJIO_H | |||
#include <stdint.h> | #include <stdint.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/uio.h> | #include <sys/uio.h> | |||
#include <pthread.h> | #include <pthread.h> | |||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/* logical structures */ | /* logical structures */ | |||
struct jfs { | struct jfs { | |||
int fd; /* main file descriptor */ | int fd; /* main file descriptor */ | |||
char *name; /* and its name */ | char *name; /* and its name */ | |||
int jfd; /* journal's lock file descriptor */ | int jfd; /* journal's lock file descriptor */ | |||
int flags; /* journal mode options used in jopen() */ | int flags; /* journal mode options used in jopen() */ | |||
pthread_mutex_t lock; /* a soft lock used in some operations */ | pthread_mutex_t lock; /* a soft lock used in some operations */ | |||
}; | }; | |||
struct jtrans { | struct jtrans { | |||
skipping to change at line 46 | skipping to change at line 50 | |||
}; | }; | |||
struct jfsck_result { | struct jfsck_result { | |||
int total; /* total transactions files we looked at */ | int total; /* total transactions files we looked at */ | |||
int invalid; /* invalid files in the journal directory */ | int invalid; /* invalid files in the journal directory */ | |||
int in_progress; /* transactions in progress */ | int in_progress; /* transactions in progress */ | |||
int broken_head; /* transactions broken (header missing) */ | int broken_head; /* transactions broken (header missing) */ | |||
int broken_body; /* transactions broken (body missing) */ | int broken_body; /* transactions broken (body missing) */ | |||
int load_error; /* errors loading the transaction */ | int load_error; /* errors loading the transaction */ | |||
int apply_error; /* errors applying the transaction */ | int apply_error; /* errors applying the transaction */ | |||
int reapplied; /* transactions that were re-applied */ | int rollbacked; /* transactions that were rollbacked */ | |||
}; | }; | |||
/* on-disk structure */ | /* on-disk structure */ | |||
struct disk_trans { | struct disk_trans { | |||
/* header (fixed lenght, defined below) */ | /* header (fixed lenght, defined below) */ | |||
uint32_t id; /* id */ | uint32_t id; /* id */ | |||
uint32_t flags; /* flags about this transaction */ | uint32_t flags; /* flags about this transaction */ | |||
uint32_t len; /* data lenght */ | uint32_t len; /* data lenght */ | |||
uint32_t plen; /* previous data lenght */ | ||||
uint32_t ulen; /* user-supplied information lenght */ | uint32_t ulen; /* user-supplied information lenght */ | |||
uint64_t offset; /* offset relative to the BOF */ | uint64_t offset; /* offset relative to the BOF */ | |||
/* payload (variable lenght) */ | /* payload (variable lenght) */ | |||
char *udata; /* user-supplied data */ | char *udata; /* user-supplied data */ | |||
char *prevdata; /* previous data, optional, for rollback */ | char *prevdata; /* previous data for rollback */ | |||
char *data; /* data */ | ||||
}; | }; | |||
/* basic operations */ | /* basic operations */ | |||
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 ); | |||
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, struct iovec *vector, int count); | ssize_t jreadv(struct jfs *fs, struct iovec *vector, int count); | |||
ssize_t jwrite(struct jfs *fs, void *buf, size_t count); | ssize_t jwrite(struct jfs *fs, void *buf, size_t count); | |||
ssize_t jpwrite(struct jfs *fs, void *buf, size_t count, off_t offset); | ssize_t jpwrite(struct jfs *fs, void *buf, size_t count, off_t offset); | |||
ssize_t jwritev(struct jfs *fs, struct iovec *vector, int count); | ssize_t jwritev(struct jfs *fs, struct iovec *vector, int count); | |||
skipping to change at line 93 | skipping to change at line 97 | |||
int jfsck(char *name, struct jfsck_result *res); | int jfsck(char *name, struct jfsck_result *res); | |||
/* jfs constants */ | /* jfs 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 */ | |||
/* jtrans constants */ | /* jtrans constants */ | |||
#define J_COMMITED 1 /* mark a transaction as commited */ | #define J_COMMITED 1 /* mark a transaction as commited */ | |||
#define J_ROLLBACKED 2 /* mark a transaction as rollbacked */ | #define J_ROLLBACKED 2 /* mark a transaction as rollbacked */ | |||
/* disk_trans constants */ | /* disk_trans constants */ | |||
#define J_DISKTFIXSIZE 24 /* lenght of disk_trans' header */ | #define J_DISKTFIXSIZE 28 /* lenght of disk_trans' header */ | |||
/* jfsck constants (return values) */ | /* jfsck constants (return values) */ | |||
#define J_ESUCCESS 0 /* success - shouldn't be used */ | #define J_ESUCCESS 0 /* success - shouldn't be used */ | |||
#define J_ENOENT 1 /* no such file */ | #define J_ENOENT 1 /* no such file */ | |||
#define J_ENOJOURNAL 2 /* no journal associated */ | #define J_ENOJOURNAL 2 /* no journal associated */ | |||
#define J_ENOMEM 3 /* no enough free memory */ | #define J_ENOMEM 3 /* no enough free memory */ | |||
#ifdef __cplusplus | ||||
} /* from extern "C" avobe */ | ||||
#endif | ||||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
4 lines changed or deleted | 12 lines changed or added | |||