libjio.h   libjio.h 
skipping to change at line 61 skipping to change at line 61
/** Number of transactions in progress */ /** Number of transactions in progress */
int in_progress; int in_progress;
/** Number of broken transactions */ /** Number of broken transactions */
int broken; int broken;
/** Number of corrupt transactions */ /** Number of corrupt transactions */
int corrupt; int corrupt;
/** Number of errors applying transactions */
int apply_error;
/** Number of transactions successfully reapplied */ /** Number of transactions successfully reapplied */
int reapplied; int reapplied;
}; };
/** jfsck() return values. /** jfsck() return values.
* *
* @see jfsck() * @see jfsck()
* @ingroup check * @ingroup check
*/ */
enum jfsck_return { enum jfsck_return {
skipping to change at line 88 skipping to change at line 85
J_ENOENT = -1, J_ENOENT = -1,
/** No journal associated with the given file */ /** No journal associated with the given file */
J_ENOJOURNAL = -2, J_ENOJOURNAL = -2,
/** Not enough free memory */ /** Not enough free memory */
J_ENOMEM = -3, J_ENOMEM = -3,
/** Error cleaning the journal directory */ /** Error cleaning the journal directory */
J_ECLEANUP = -4, J_ECLEANUP = -4,
/** I/O error */
J_EIO = -5,
}; };
/* /*
* Core functions * Core functions
*/ */
/** Open a file. /** Open a file.
* *
* Takes the same parameters as the UNIX open(2), with an additional one fo r * Takes the same parameters as the UNIX open(2), with an additional one fo r
* internal flags. * internal flags.
skipping to change at line 111 skipping to change at line 111
* *
* @param name path to the file to open * @param name path to the file to open
* @param flags flags to pass to open(2) * @param flags flags to pass to open(2)
* @param mode mode to pass to open(2) * @param mode mode to pass to open(2)
* @param jflags journal flags * @param jflags journal flags
* @returns a new jfs_t that identifies the open file on success, or NULL o n * @returns a new jfs_t that identifies the open file on success, or NULL o n
* error * error
* @see jclose(), open() * @see jclose(), open()
* @ingroup basic * @ingroup basic
*/ */
jfs_t *jopen(const char *name, int flags, int mode, int jflags); jfs_t *jopen(const char *name, int flags, int mode, unsigned int jflags);
/** Close a file opened with jopen(). /** Close a file opened with jopen().
* *
* After a call to this function, the memory allocated for the open file wi ll * After a call to this function, the memory allocated for the open file wi ll
* be freed. * be freed.
* *
* If there was an autosync thread started for this file, it will be stoppe d. * If there was an autosync thread started for this file, it will be stoppe d.
* *
* @param fs open file * @param fs open file
* @returns 0 on success, -1 on error * @returns 0 on success, -1 on error
skipping to change at line 137 skipping to change at line 137
/** Sync a file. Makes sense only when using lingering transactions. /** Sync a file. Makes sense only when using lingering transactions.
* *
* @param fs open file * @param fs open file
* @returns 0 on success, -1 on error * @returns 0 on success, -1 on error
* @ingroup basic * @ingroup basic
*/ */
int jsync(jfs_t *fs); int jsync(jfs_t *fs);
/** Create a new transaction. /** Create a new transaction.
* *
* Note that the final flags to use in the transaction will be the result o
f
* ORing the flags parameter with fs' flags.
*
* @param fs open file the transaction will apply to * @param fs open file the transaction will apply to
* @param flags transaction flags
* @returns a new transaction (must be freed using jtrans_free()) * @returns a new transaction (must be freed using jtrans_free())
* @see jtrans_free() * @see jtrans_free()
* @ingroup basic * @ingroup basic
*/ */
jtrans_t *jtrans_new(jfs_t *fs); jtrans_t *jtrans_new(jfs_t *fs, unsigned int flags);
/** Add an operation to a transaction. /** Add a write operation to a transaction.
* *
* An operation consists of a buffer, its length, and the offset to write i * A write operation consists of a buffer, its length, and the offset to wr
t ite
* to. * it to.
* *
* The file will not be touched (not even locked) until commit time, where the * The file will not be touched (not even locked) until commit time, where the
* first count bytes of buf will be written at offset. * first count bytes of buf will be written at offset.
* *
* Transactions will be applied in order, and overlapping operations are * Transactions will be applied in order, and overlapping operations are
* permitted, in which case the latest one will prevail. * permitted, in which case the latest one will prevail.
* *
* The buffer will be copied internally and can be free()d right after this
* function returns.
*
* @param ts transaction * @param ts transaction
* @param buf buffer to write * @param buf buffer to write
* @param count how many bytes from the buffer to write * @param count how many bytes from the buffer to write
* @param offset offset to write at * @param offset offset to write at
* @returns 0 on success, -1 on error * @returns 0 on success, -1 on error
* @ingroup basic * @ingroup basic
*/ */
int jtrans_add(jtrans_t *ts, const void *buf, size_t count, off_t offset); int jtrans_add_w(jtrans_t *ts, const void *buf, size_t count, off_t offset)
;
/** Add a read operation to a transaction.
*
* An operation consists of a buffer, its length, and the offset to read it
* from.
*
* The file will not be touched (not even locked) until commit time, where
the
* first count bytes at offset will be read into buf.
*
* Note that if there is not enough data in the file to read the specified
* amount of bytes, the commit will fail, so do not attempt to read beyond
EOF
* (you can use jread() for that purpose).
*
* Transactions will be applied in order, and overlapping operations are
* permitted, in which case the latest one will prevail.
*
* In case of an error in jtrans_commit(), the contents of the buffer are
* undefined.
*
* @param ts transaction
* @param buf buffer to read to
* @param count how many bytes to read
* @param offset offset to read at
* @returns 0 on success, -1 on error
* @ingroup basic
* @see jread()
*/
int jtrans_add_r(jtrans_t *ts, void *buf, size_t count, off_t offset);
/** Commit a transaction. /** Commit a transaction.
* *
* All the operations added to it using jtrans_add() will be written to dis * All the operations added to it using jtrans_add_w()/jtrans_add_r() will
k, be
* in the same order they were added. * written to/read from disk, in the same order they were added.
* *
* After this function returns successfully, all the data can be trusted to be * After this function returns successfully, all the data can be trusted to be
* on the disk. The commit is atomic with regards to other processes using * on the disk. The commit is atomic with regards to other processes using
* libjio, but not accessing directly to the file. * libjio, but not accessing directly to the file.
* *
* @param ts transaction * @param ts transaction
* @returns the amount of bytes written to disk, or -1 if there was an erro * @returns 0 on success, or -1 if there was an error but atomic warranties
r * were preserved, or -2 if there was an error and there is a possible
* but atomic warranties were preserved, or -2 if there was an error an * break of atomic warranties (which is an indication of a severe
d * underlying condition).
* there is a possible break of atomic warranties (which is an indicati
on
* of a severe underlying condition).
* @ingroup basic * @ingroup basic
*/ */
ssize_t jtrans_commit(jtrans_t *ts); ssize_t jtrans_commit(jtrans_t *ts);
/** Rollback a transaction. /** Rollback a transaction.
* *
* This function atomically undoes a previous committed transaction. After its * This function atomically undoes a previous committed transaction. After its
* successful return, the data can be trusted to be on disk. * successful return, the data can be trusted to be on disk. The read
* operations will be ignored.
* *
* Use with care. * Use with care.
* *
* @param ts transaction * @param ts transaction
* @returns the same as jtrans_commit() * @returns the same as jtrans_commit()
* @see jtrans_commit() * @see jtrans_commit()
* @ingroup basic * @ingroup basic
*/ */
ssize_t jtrans_rollback(jtrans_t *ts); ssize_t jtrans_rollback(jtrans_t *ts);
skipping to change at line 257 skipping to change at line 293
/** Check and repair the given path. /** Check and repair the given path.
* *
* The file MUST NOT be in use by any other thread or process. This * The file MUST NOT be in use by any other thread or process. This
* requirement will be lifted in future releases. * requirement will be lifted in future releases.
* *
* @param name path to the file to check * @param name path to the file to check
* @param jdir journal directory of the given file, use NULL for the defaul t * @param jdir journal directory of the given file, use NULL for the defaul t
* @param res structure where to store the result * @param res structure where to store the result
* @param flags flags that change the checking behaviour, currently only * @param flags flags that change the checking behaviour, currently only
* J_NOCLEANUP is supported, which avoids cleaning up the journal * J_CLEANUP is supported, which removes the journal directory after a
* directory after a successful recovery * successful recovery
* @see struct jfsck_result * @see struct jfsck_result
* @returns 0 on success, < 0 on error, with the following possible negativ e * @returns 0 on success, < 0 on error, with the following possible negativ e
* values from enum jfsck_return: J_ENOENT if there was no such file wi th * values from enum jfsck_return: J_ENOENT if there was no such file wi th
* the given name, J_ENOJOURNAL if there was no journal at the given * the given name, J_ENOJOURNAL if there was no journal at the given
* jdir, J_ENOMEM if memory could not be allocated, J_ECLEANUP if there * jdir, J_ENOMEM if memory could not be allocated, J_ECLEANUP if there
* was an error cleaning the journal. * was an error cleaning the journal, J_EIO if there was an I/O error.
* @ingroup check * @ingroup check
*/ */
enum jfsck_return jfsck(const char *name, const char *jdir, enum jfsck_return jfsck(const char *name, const char *jdir,
struct jfsck_result *res, unsigned int flags); struct jfsck_result *res, unsigned int flags);
/* /*
* UNIX API wrappers * UNIX API wrappers
*/ */
/** Read from the file. Works just like UNIX read(2). /** Read from the file. Works just like UNIX read(2).
skipping to change at line 451 skipping to change at line 487
#define J_ROLLBACKED 2048 #define J_ROLLBACKED 2048
/** Marks a transaction as rollbacking. /** Marks a transaction as rollbacking.
* @internal */ * @internal */
#define J_ROLLBACKING 4096 #define J_ROLLBACKING 4096
/* /*
* jfsck() flags * jfsck() flags
*/ */
/** Do not perform a journal cleanup. Used in jfsck(). /** Perform a journal cleanup. Used in jfsck().
* *
* @see jfsck() * @see jfsck()
* @ingroup check */ * @ingroup check */
#define J_NOCLEANUP 1 #define J_CLEANUP 1
#endif #endif
 End of changes. 17 change blocks. 
26 lines changed or deleted 63 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/