git » libjio » commit f715967

Move private structures from libjio.h into trans.h

author Alberto Bertogli
2009-04-07 02:59:28 UTC
committer Alberto Bertogli
2009-04-12 13:50:48 UTC
parent cd918c1ea0508b7bcc2639a77bf218159b21e158

Move private structures from libjio.h into trans.h

This way we make the header more tidy and readable for the users.

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

libjio/check.c +1 -0
libjio/journal.c +1 -0
libjio/libjio.h +3 -39
libjio/trans.c +1 -0
libjio/trans.h +45 -0

diff --git a/libjio/check.c b/libjio/check.c
index 4b84dd5..35c020f 100644
--- a/libjio/check.c
+++ b/libjio/check.c
@@ -17,6 +17,7 @@
 
 #include "libjio.h"
 #include "common.h"
+#include "trans.h"
 
 
 /* fill a transaction structure from a mmapped transaction file */
diff --git a/libjio/journal.c b/libjio/journal.c
index d9edf65..fc9c243 100644
--- a/libjio/journal.c
+++ b/libjio/journal.c
@@ -20,6 +20,7 @@
 #include "common.h"
 #include "compat.h"
 #include "journal.h"
+#include "trans.h"
 
 
 /*
diff --git a/libjio/libjio.h b/libjio/libjio.h
index 4c916ca..f73faf7 100644
--- a/libjio/libjio.h
+++ b/libjio/libjio.h
@@ -23,8 +23,9 @@
 #error "You must compile your application with Large File Support"
 #endif
 
-
-/* logical structures */
+/* empty declarations, the API does not expose these */
+struct jlinger;
+struct joper;
 
 /* the main file structure */
 struct jfs {
@@ -40,18 +41,6 @@ struct jfs {
 	pthread_mutex_t lock;	/* a soft lock used in some operations */
 };
 
-/* a single operation */
-struct joper {
-	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;
-};
-
 /* a transaction */
 struct jtrans {
 	struct jfs *fs;		/* journal file structure to operate on */
@@ -63,13 +52,6 @@ struct jtrans {
 	struct joper *op;	/* list of operations */
 };
 
-/* lingered transaction */
-struct journal_op;
-struct jlinger {
-	struct journal_op *jop;
-	struct jlinger *next;
-};
-
 struct jfsck_result {
 	int total;		/* total transactions files we looked at */
 	int invalid;		/* invalid files in the journal directory */
@@ -81,24 +63,6 @@ struct jfsck_result {
 };
 
 
-/* on-disk structures */
-
-/* header (fixed length, defined below) */
-struct disk_header {
-	uint32_t id;		/* id */
-	uint32_t flags;		/* flags about this transaction */
-	uint32_t numops;	/* number of operations */
-};
-
-/* operation */
-struct disk_operation {
-	uint32_t len;		/* data length */
-	uint32_t plen;		/* previous data length */
-	uint64_t offset;	/* offset relative to the BOF */
-	char *prevdata;		/* previous data for rollback */
-};
-
-
 /* core functions */
 int jopen(struct jfs *fs, const char *name, int flags, int mode, int jflags);
 void jtrans_init(struct jfs *fs, struct jtrans *ts);
diff --git a/libjio/trans.c b/libjio/trans.c
index 795b5d8..306a6d0 100644
--- a/libjio/trans.c
+++ b/libjio/trans.c
@@ -23,6 +23,7 @@
 #include "common.h"
 #include "compat.h"
 #include "journal.h"
+#include "trans.h"
 
 
 /*
diff --git a/libjio/trans.h b/libjio/trans.h
new file mode 100644
index 0000000..954ec62
--- /dev/null
+++ b/libjio/trans.h
@@ -0,0 +1,45 @@
+
+#ifndef _TRANS_H
+#define _TRANS_H
+
+
+/* a single operation */
+struct joper {
+	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;
+};
+
+/* lingered transaction */
+struct journal_op;
+struct jlinger {
+	struct journal_op *jop;
+	struct jlinger *next;
+};
+
+
+/* on-disk structures */
+
+/* header (fixed length, defined below) */
+struct disk_header {
+	uint32_t id;		/* id */
+	uint32_t flags;		/* flags about this transaction */
+	uint32_t numops;	/* number of operations */
+};
+
+/* operation */
+struct disk_operation {
+	uint32_t len;		/* data length */
+	uint32_t plen;		/* previous data length */
+	uint64_t offset;	/* offset relative to the BOF */
+	char *prevdata;		/* previous data for rollback */
+};
+
+
+#endif
+