git » libjio » commit 31cc895

libjio: Rename internal struct joper to struct operation

author Alberto Bertogli
2009-07-11 03:27:04 UTC
committer Alberto Bertogli
2009-07-11 03:34:13 UTC
parent 0ad0d99fb22829a9b06f47ba8d902bc07cb1cc7d

libjio: Rename internal struct joper to struct operation

The name "joper" can be quite confusing considering how most internal
journal functions are named. This patch renames it to "operation".

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

libjio/check.c +1 -1
libjio/trans.c +7 -7
libjio/trans.h +5 -6

diff --git a/libjio/check.c b/libjio/check.c
index 66c7314..70a9f32 100644
--- a/libjio/check.c
+++ b/libjio/check.c
@@ -88,7 +88,7 @@ enum jfsck_return jfsck(const char *name, const char *jdir,
 	struct stat sinfo;
 	struct jfs fs;
 	struct jtrans *curts;
-	struct joper *tmpop;
+	struct operation *tmpop;
 	DIR *dir;
 	struct dirent *dent;
 	unsigned char *map;
diff --git a/libjio/trans.c b/libjio/trans.c
index 33ac37d..b4ffc42 100644
--- a/libjio/trans.c
+++ b/libjio/trans.c
@@ -54,7 +54,7 @@ struct jtrans *jtrans_new(struct jfs *fs, unsigned int flags)
 /* Free the contents of a transaction structure */
 void jtrans_free(struct jtrans *ts)
 {
-	struct joper *tmpop;
+	struct operation *tmpop;
 
 	ts->fs = NULL;
 
@@ -77,7 +77,7 @@ void jtrans_free(struct jtrans *ts)
 /* Add an operation to a transaction */
 int jtrans_add(struct jtrans *ts, const void *buf, size_t count, off_t offset)
 {
-	struct joper *jop, *tmpop;
+	struct operation *op, *tmpop;
 
 	pthread_mutex_lock(&(ts->lock));
 
@@ -101,7 +101,7 @@ int jtrans_add(struct jtrans *ts, const void *buf, size_t count, off_t offset)
 	/* find the last operation in the transaction and create a new one at
 	 * the end */
 	if (ts->op == NULL) {
-		ts->op = malloc(sizeof(struct joper));
+		ts->op = malloc(sizeof(struct operation));
 		if (ts->op == NULL) {
 			pthread_mutex_unlock(&(ts->lock));
 			return -1;
@@ -111,7 +111,7 @@ int jtrans_add(struct jtrans *ts, const void *buf, size_t count, off_t offset)
 	} else {
 		for (tmpop = ts->op; tmpop->next != NULL; tmpop = tmpop->next)
 			;
-		tmpop->next = malloc(sizeof(struct joper));
+		tmpop->next = malloc(sizeof(struct operation));
 		if (tmpop->next == NULL) {
 			pthread_mutex_unlock(&(ts->lock));
 			return -1;
@@ -159,7 +159,7 @@ int jtrans_add(struct jtrans *ts, const void *buf, size_t count, off_t offset)
 ssize_t jtrans_commit(struct jtrans *ts)
 {
 	ssize_t r, retval = -1;
-	struct joper *op;
+	struct operation *op;
 	struct jlinger *linger;
 	jop_t *jop;
 	size_t written = 0;
@@ -316,7 +316,7 @@ ssize_t jtrans_rollback(struct jtrans *ts)
 {
 	ssize_t rv;
 	struct jtrans *newts;
-	struct joper *op, *curop, *lop;
+	struct operation *op, *curop, *lop;
 
 	newts = jtrans_new(ts->fs, 0);
 	newts->flags = ts->flags;
@@ -347,7 +347,7 @@ ssize_t jtrans_rollback(struct jtrans *ts)
 		}
 
 		/* manually add the operation to the new transaction */
-		curop = malloc(sizeof(struct joper));
+		curop = malloc(sizeof(struct operation));
 		if (curop == NULL) {
 			rv = -1;
 			goto exit;
diff --git a/libjio/trans.h b/libjio/trans.h
index e7fa689..33238bd 100644
--- a/libjio/trans.h
+++ b/libjio/trans.h
@@ -2,8 +2,7 @@
 #ifndef _TRANS_H
 #define _TRANS_H
 
-
-struct joper;
+struct operation;
 
 /** A transaction */
 struct jtrans {
@@ -26,19 +25,19 @@ struct jtrans {
 	pthread_mutex_t lock;
 
 	/** List of operations */
-	struct joper *op;
+	struct operation *op;
 };
 
 /* a single operation */
-struct joper {
+struct operation {
 	int locked;		/* is the region is locked? */
 	off_t offset;		/* operation's offset */
 	size_t len;		/* data length */
 	void *buf;		/* data */
 	size_t plen;		/* previous data length */
 	void *pdata;		/* previous data */
-	struct joper *prev;
-	struct joper *next;
+	struct operation *prev;
+	struct operation *next;
 };
 
 /* lingered transaction */