author | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-04-23 22:40:03 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-04-23 22:40:03 UTC |
parent | 1d82e761c95f87cccee081211dff8a33953dd0f1 |
UPGRADING | +2 | -1 |
bindings/python/libjio.c | +2 | -2 |
doc/guide.rst | +3 | -3 |
libjio/check.c | +1 | -1 |
libjio/libjio.3 | +4 | -4 |
libjio/libjio.h | +2 | -2 |
libjio/trans.c | +2 | -2 |
libjio/unix.c | +3 | -3 |
samples/full.c | +1 | -1 |
samples/jio3.c | +2 | -2 |
diff --git a/UPGRADING b/UPGRADING index 24c2fae..dc7ded7 100644 --- a/UPGRADING +++ b/UPGRADING @@ -9,8 +9,9 @@ take much effort. When it's mandatory, it will be noted. -> 0.50 (Big API change) - Structures are now opaque types: struct jfs -> jfs_t; jopen() returns a pointer to one, jclose() frees it. - struct jtrans -> jtrans_t; jtrans_init() returns a pointer to one, + struct jtrans -> jtrans_t; jtrans_new() returns a pointer to one, jtrans_free() frees it. + - Renamed jtrans_init() to jtrans_new(). - jtrans_commit() returns -1 on recovered errors, -2 on unrecovered errors (which are an indication of a severe underlying condition). - jtrans_add() returns 0 on success and -1 on errors (it used to return 1 on diff --git a/bindings/python/libjio.c b/bindings/python/libjio.c index 7fb926b..bd44992 100644 --- a/bindings/python/libjio.c +++ b/bindings/python/libjio.c @@ -380,7 +380,7 @@ PyDoc_STRVAR(jf_new_trans__doc, "new_trans()\n\ \n\ Returns an object representing a new empty transaction.\n\ -It's a wrapper to jtrans_init().\n"); +It's a wrapper to jtrans_new().\n"); static PyObject *jf_new_trans(jfile_object *fp, PyObject *args) { @@ -397,7 +397,7 @@ static PyObject *jf_new_trans(jfile_object *fp, PyObject *args) if (tp == NULL) return NULL; - tp->ts = jtrans_init(fp->fs); + tp->ts = jtrans_new(fp->fs); if(tp->ts == NULL) { return PyErr_NoMemory(); } diff --git a/doc/guide.rst b/doc/guide.rst index 84af707..d47b1f6 100644 --- a/doc/guide.rst +++ b/doc/guide.rst @@ -84,7 +84,7 @@ functions), and adds a new parameter *jflags* that can be used to modify some subtle library behaviour we'll see later, and is normally not used. We have a happy file structure open now, and the next thing to do would be to -create a transaction. This is what *jtrans_init()* is for: it takes a file +create a transaction. This is what *jtrans_new()* is for: it takes a file structure and a transaction structure and initializes the latter, leaving it ready to use. @@ -109,7 +109,7 @@ program (return values are ignored for simplicity):: file = jopen("filename", O_RDWR | O_CREAT, 0600, 0); - trans = jtrans_init(file); + trans = jtrans_new(file); jtrans_add(trans, buf, strlen(buf), 0); jtrans_commit(trans); jtrans_free(trans); @@ -118,7 +118,7 @@ program (return values are ignored for simplicity):: As we've seen, we open the file and initialize the structure with *jopen()* (with the parameter *jflags* being the last 0), create a new transaction with -*jtrans_init()*, then add an operation with *jtrans_add()* (the last 0 is the +*jtrans_new()*, then add an operation with *jtrans_add()* (the last 0 is the offset, in this case the beginning of the file), commit the transaction with *jtrans_commit()*, free it with *jtrans_free()*, and finally close the file with *jclose()*. diff --git a/libjio/check.c b/libjio/check.c index 1d93f0d..03458ab 100644 --- a/libjio/check.c +++ b/libjio/check.c @@ -274,7 +274,7 @@ enum jfsck_return jfsck(const char *name, const char *jdir, /* verify (and possibly fix) all the transactions */ for (i = 1; i <= maxtid; i++) { - curts = jtrans_init(&fs); + curts = jtrans_new(&fs); if (curts == NULL) { ret = J_ENOMEM; goto exit; diff --git a/libjio/libjio.3 b/libjio/libjio.3 index 2b8bf53..4de5881 100644 --- a/libjio/libjio.3 +++ b/libjio/libjio.3 @@ -21,7 +21,7 @@ libjio - A library for Journaled I/O .BI "off_t jlseek(jfs_t *" fs ", off_t " offset ", int " whence ");" .BI "int jclose(jfs_t *" fs ");" -.BI "jtrans_t *jtrans_init(jfs_t *" fs ");" +.BI "jtrans_t *jtrans_new(jfs_t *" fs ");" .BI "int jtrans_commit(jtrans_t *" ts ");" .BI "int jtrans_add(jtrans_t *" ts ", const void *" buf "," .BI " size_t " count ", off_t " offset ");" @@ -79,7 +79,7 @@ interfaces to and friends. The basic functions consist of -.BR jtrans_init() ", " jtrans_add() ", " jtrans_commit() " and " +.BR jtrans_new() ", " jtrans_add() ", " jtrans_commit() " and " .BR jtrans_rollback() . They provide a lower-level method for manipulating transactions. @@ -172,13 +172,13 @@ semantics and behave the same way. .SS BASIC FUNCTIONS The basic functions are the ones which manipulate transactions directly: -.BR jtrans_init() ", " jtrans_add() ", " jtrans_commit() ", " jtrans_rollback() +.BR jtrans_new() ", " jtrans_add() ", " jtrans_commit() ", " jtrans_rollback() and .BR jtrans_free() . These are intended to be use when your application requires direct control over the transactions. -.BR jtrans_init() " and " jtrans_free() +.BR jtrans_new() " and " jtrans_free() just return a new .I jtrans_t and free a given one; the former should be called prior any use, and the diff --git a/libjio/libjio.h b/libjio/libjio.h index 143a305..166fb3b 100644 --- a/libjio/libjio.h +++ b/libjio/libjio.h @@ -142,7 +142,7 @@ int jsync(jfs_t *fs); * @see jtrans_free() * @ingroup basic */ -jtrans_t *jtrans_init(jfs_t *fs); +jtrans_t *jtrans_new(jfs_t *fs); /** Add an operation to a transaction. * @@ -199,7 +199,7 @@ ssize_t jtrans_rollback(jtrans_t *ts); /** Free a transaction structure. * * @param ts transaction to free - * @see jtrans_init() + * @see jtrans_new() * @ingroup basic */ void jtrans_free(jtrans_t *ts); diff --git a/libjio/trans.c b/libjio/trans.c index 24fa823..07d7bfe 100644 --- a/libjio/trans.c +++ b/libjio/trans.c @@ -28,7 +28,7 @@ */ /* Initialize a transaction structure */ -struct jtrans *jtrans_init(struct jfs *fs) +struct jtrans *jtrans_new(struct jfs *fs) { pthread_mutexattr_t attr; struct jtrans *ts; @@ -311,7 +311,7 @@ ssize_t jtrans_rollback(struct jtrans *ts) struct jtrans *newts; struct joper *op, *curop, *lop; - newts = jtrans_init(ts->fs); + newts = jtrans_new(ts->fs); newts->flags = ts->flags; newts->numops = ts->numops; diff --git a/libjio/unix.c b/libjio/unix.c index a702a5b..bd202ae 100644 --- a/libjio/unix.c +++ b/libjio/unix.c @@ -87,7 +87,7 @@ ssize_t jwrite(struct jfs *fs, const void *buf, size_t count) off_t pos; struct jtrans *ts; - ts = jtrans_init(fs); + ts = jtrans_new(fs); if (ts == NULL) return -1; @@ -120,7 +120,7 @@ ssize_t jpwrite(struct jfs *fs, const void *buf, size_t count, off_t offset) int rv; struct jtrans *ts; - ts = jtrans_init(fs); + ts = jtrans_new(fs); if (ts == NULL) return -1; @@ -141,7 +141,7 @@ ssize_t jwritev(struct jfs *fs, const struct iovec *vector, int count) off_t ipos, t; struct jtrans *ts; - ts = jtrans_init(fs); + ts = jtrans_new(fs); if (ts == NULL) return -1; diff --git a/samples/full.c b/samples/full.c index 116e23f..dd621b3 100644 --- a/samples/full.c +++ b/samples/full.c @@ -27,7 +27,7 @@ int main(void) } /* write two "Hello world"s next to each other */ - trans = jtrans_init(file); + trans = jtrans_new(file); jtrans_add(trans, TEXT, strlen(TEXT), 0); jtrans_add(trans, TEXT, strlen(TEXT), strlen(TEXT)); r = jtrans_commit(trans); diff --git a/samples/jio3.c b/samples/jio3.c index 88a68d4..c71c727 100644 --- a/samples/jio3.c +++ b/samples/jio3.c @@ -19,9 +19,9 @@ int main(int argc, char **argv) if (fs == NULL) perror("jopen()"); - ts = jtrans_init(fs); + ts = jtrans_new(fs); if (ts == NULL) - perror("jtrans_init()"); + perror("jtrans_new()"); #define str1 "1ROLLBACKTEST1!\n" jtrans_add(ts, str1, strlen(str1), 0);