[dovecot-cvs] dovecot/src/lib-storage/index/dbox Makefile.am, 1.3, 1.4 dbox-format.h, NONE, 1.1 dbox-list.c, 1.5, 1.6 dbox-storage.c, 1.11, 1.12 dbox-storage.h, 1.9, 1.10

cras at dovecot.org cras at dovecot.org
Wed Apr 12 19:52:05 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv19340

Modified Files:
	Makefile.am dbox-list.c dbox-storage.c dbox-storage.h 
Added Files:
	dbox-format.h 
Log Message:
Moved dbox data structures to dbox-format.h which can be easily included
from elsewhere.



Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Makefile.am	28 Jan 2006 22:05:48 -0000	1.3
+++ Makefile.am	12 Apr 2006 16:52:02 -0000	1.4
@@ -23,6 +23,7 @@
 
 noinst_HEADERS = \
 	dbox-file.h \
+	dbox-format.h \
 	dbox-keywords.h \
 	dbox-storage.h \
 	dbox-sync.h \

--- NEW FILE: dbox-format.h ---
#ifndef __DBOX_FORMAT_H
#define __DBOX_FORMAT_H

#define DBOX_SUBSCRIPTION_FILE_NAME "dovecot.subscriptions"
#define DBOX_INDEX_PREFIX "dovecot.index"
#define DBOX_MAILDIR_NAME "Mails"
#define DBOX_MAIL_FILE_PREFIX "msg."
#define DBOX_MAIL_FILE_FORMAT DBOX_MAIL_FILE_PREFIX"%u"

#define DBOX_KEYWORD_COUNT 64
#define DBOX_KEYWORD_NAMES_RESERVED_SPACE (2048-sizeof(struct dbox_file_header))

/* Default rotation settings */
#define DBOX_DEFAULT_ROTATE_SIZE (2*1024*1024)
#define DBOX_DEFAULT_ROTATE_MIN_SIZE (1024*16)
#define DBOX_DEFAULT_ROTATE_DAYS 0

struct dbox_file_header {
	/* Size of the base header. sizeof(struct dbox_file_header) */
	unsigned char base_header_size_hex[4];
	/* Size of the full header, including keywords list and padding */
	unsigned char header_size_hex[8];
	/* Offset where to store the next mail. note that a mail may already
	   have been fully written here and added to uidlist, but this offset
	   just wasn't updated. In that case the append_offset should be
	   updated instead of overwriting the mail. */
	unsigned char append_offset_hex[16];
	/* Initial file creation time as UNIX timestamp. */
	unsigned char create_time_hex[8];
	/* Size of each message's header. */
	unsigned char mail_header_size_hex[4];
	/* If set, mail headers start always at given alignmentation.
	   Currently not supported. */
	unsigned char mail_header_align_hex[4];
	/* Number of keywords allocated for each mail (not necessarily used) */
	unsigned char keyword_count_hex[4];
	/* Offset for the keyword list inside the file header. */
	unsigned char keyword_list_offset_hex[8];

	/* Non-zero if some mails have been marked as expunged in the file. */
	unsigned char have_expunged_mails;

	/* space reserved for keyword list and possible other future
	   extensions. */
	/* unsigned char [header_size - header_base_size]; */
};

#define DBOX_MAIL_HEADER_MAGIC "\001\003"
struct dbox_mail_header {
	/* This field acts as kind of a verification marker to make sure that
	   seeked offset is valid. So the magic value should be something that
	   normally doesn't occur in mails. */
	unsigned char magic[2];
	unsigned char uid_hex[8];
	unsigned char mail_size_hex[16];
	unsigned char received_time_hex[8];
	unsigned char answered;
	unsigned char flagged;
	unsigned char deleted;
	unsigned char seen;
	unsigned char draft;
	unsigned char expunged;
	/* unsigned char keywords[keywords_count]; */
};

#endif

Index: dbox-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-list.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dbox-list.c	27 Feb 2006 16:21:58 -0000	1.5
+++ dbox-list.c	12 Apr 2006 16:52:02 -0000	1.6
@@ -129,7 +129,7 @@
 		ctx->next = dbox_list_subs;
 
 		path = t_strconcat(istorage->dir,
-				   "/" SUBSCRIPTION_FILE_NAME, NULL);
+				   "/"DBOX_SUBSCRIPTION_FILE_NAME, NULL);
 		ctx->subsfile_ctx =
 			subsfile_list_init(storage, path);
 		if (ctx->subsfile_ctx == NULL) {

Index: dbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dbox-storage.c	12 Apr 2006 16:08:13 -0000	1.11
+++ dbox-storage.c	12 Apr 2006 16:52:02 -0000	1.12
@@ -568,7 +568,7 @@
 	const char *path;
 
 	path = t_strconcat(INDEX_STORAGE(storage)->dir,
-			   "/" SUBSCRIPTION_FILE_NAME, NULL);
+			   "/"DBOX_SUBSCRIPTION_FILE_NAME, NULL);
 
 	return subsfile_set_subscribed(_storage, path,
 				       INDEX_STORAGE(storage)->temp_prefix,

Index: dbox-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dbox-storage.h	31 Mar 2006 21:21:20 -0000	1.9
+++ dbox-storage.h	12 Apr 2006 16:52:03 -0000	1.10
@@ -1,77 +1,16 @@
 #ifndef __DBOX_STORAGE_H
 #define __DBOX_STORAGE_H
 
-#define SUBSCRIPTION_FILE_NAME "dovecot.subscriptions"
-#define DBOX_INDEX_PREFIX "dovecot.index"
-#define DBOX_MAILDIR_NAME "Mails"
-#define DBOX_MAIL_FILE_PREFIX "msg."
-#define DBOX_MAIL_FILE_FORMAT DBOX_MAIL_FILE_PREFIX"%u"
-
-#define DBOX_KEYWORD_COUNT 64
-#define DBOX_KEYWORD_NAMES_RESERVED_SPACE (2048-sizeof(struct dbox_file_header))
-
 #include "index-storage.h"
+#include "dbox-format.h"
 
 #define STORAGE(mbox_storage) \
 	(&(mbox_storage)->storage.storage)
 #define INDEX_STORAGE(mbox_storage) \
 	(&(mbox_storage)->storage)
 
-/* Default rotation settings */
-#define DBOX_DEFAULT_ROTATE_SIZE (2*1024*1024)
-#define DBOX_DEFAULT_ROTATE_MIN_SIZE (1024*16)
-#define DBOX_DEFAULT_ROTATE_DAYS 0
-
 struct dbox_uidlist;
 
-struct dbox_file_header {
-	/* Size of the base header. sizeof(struct dbox_file_header) */
-	unsigned char base_header_size_hex[4];
-	/* Size of the full header, including keywords list and padding */
-	unsigned char header_size_hex[8];
-	/* Offset where to store the next mail. note that a mail may already
-	   have been fully written here and added to uidlist, but this offset
-	   just wasn't updated. In that case the append_offset should be
-	   updated instead of overwriting the mail. */
-	unsigned char append_offset_hex[16];
-	/* Initial file creation time as UNIX timestamp. */
-	unsigned char create_time_hex[8];
-	/* Size of each message's header. */
-	unsigned char mail_header_size_hex[4];
-	/* If set, mail headers start always at given alignmentation.
-	   Currently not supported. */
-	unsigned char mail_header_align_hex[4];
-	/* Number of keywords allocated for each mail (not necessarily used) */
-	unsigned char keyword_count_hex[4];
-	/* Offset for the keyword list inside the file header. */
-	unsigned char keyword_list_offset_hex[8];
-
-	/* Non-zero if some mails have been marked as expunged in the file. */
-	unsigned char have_expunged_mails;
-
-	/* space reserved for keyword list and possible other future
-	   extensions. */
-	/* unsigned char [header_size - header_base_size]; */
-};
-
-#define DBOX_MAIL_HEADER_MAGIC "\001\003"
-struct dbox_mail_header {
-	/* This field acts as kind of a verification marker to make sure that
-	   seeked offset is valid. So the magic value should be something that
-	   normally doesn't occur in mails. */
-	unsigned char magic[2];
-	unsigned char uid_hex[8];
-	unsigned char mail_size_hex[16];
-	unsigned char received_time_hex[8];
-	unsigned char answered;
-	unsigned char flagged;
-	unsigned char deleted;
-	unsigned char seen;
-	unsigned char draft;
-	unsigned char expunged;
-	/* unsigned char keywords[keywords_count]; */
-};
-
 struct dbox_storage {
 	struct index_storage storage;
 };



More information about the dovecot-cvs mailing list