[dovecot-cvs] dovecot/src/lib-storage Makefile.am, 1.13,
1.14 mail-storage-private.h, 1.30, 1.31 mail-storage.c, 1.55, 1.56
tss-movial at dovecot.org
tss-movial at dovecot.org
Wed Jun 28 19:31:08 EEST 2006
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-index-dummy-view.c, 1.2,
1.3 mail-index-private.h, 1.71,
1.72 mail-index-transaction-private.h, 1.30,
1.31 mail-index-transaction-view.c, 1.18,
1.19 mail-index-transaction.c, 1.77,
1.78 mail-index-view-private.h, 1.24, 1.25 mail-index-view.c,
1.46, 1.47 mail-index.c, 1.236, 1.237 mail-index.h, 1.159, 1.160
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index index-storage.c, 1.86,
1.87 index-storage.h, 1.103, 1.104 index-transaction.c, 1.14, 1.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv1042/lib-storage
Modified Files:
Makefile.am mail-storage-private.h mail-storage.c
Log Message:
Beginnings of joining mail-storage API more closely to mail-index, so that
mail-index could be directly used if needed. Currently only transactions
are joined.
Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/Makefile.am,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Makefile.am 15 Mar 2005 19:01:51 -0000 1.13
+++ Makefile.am 28 Jun 2006 16:31:06 -0000 1.14
@@ -5,7 +5,8 @@
AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib-mail \
- -I$(top_srcdir)/src/lib-imap
+ -I$(top_srcdir)/src/lib-imap \
+ -I$(top_srcdir)/src/lib-index
libstorage_a_SOURCES = \
mail.c \
Index: mail-storage-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage-private.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- mail-storage-private.h 28 Jun 2006 13:10:48 -0000 1.30
+++ mail-storage-private.h 28 Jun 2006 16:31:06 -0000 1.31
@@ -8,11 +8,10 @@
#define MAIL_STORAGE_ERR_MAILBOX_NOT_FOUND "Mailbox doesn't exist: %s"
#define MAIL_STORAGE_ERR_NO_PERMISSION "Permission denied"
-/* Modules should use do "my_id = mail_storage_module_id++" and
- use objects' module_contexts[id] for their own purposes. */
-extern unsigned int mail_storage_module_id;
-
struct mail_storage_vfuncs {
+ void (*class_init)(void);
+ void (*class_deinit)(void);
+
struct mail_storage *
(*create)(const char *data, const char *user,
enum mail_storage_flags flags,
@@ -241,6 +240,28 @@
struct mailbox *box;
};
+/* Modules should use do "my_id = mail_storage_module_id++" and
+ use objects' module_contexts[id] for their own purposes. */
+extern unsigned int mail_storage_module_id;
+
+/* Storage's module_id for mail_index. */
+extern unsigned int mail_storage_mail_index_module_id;
+
+#define MAIL_STORAGE_INDEX(index) \
+ *((void **)array_idx_modifiable( \
+ &(index)->mail_index_module_contexts, \
+ mail_storage_mail_index_module_id))
+
+#define MAIL_STORAGE_VIEW(view) \
+ *((void **)array_idx_modifiable( \
+ &(view)->mail_index_view_module_contexts, \
+ mail_storage_mail_index_module_id))
+
+#define MAIL_STORAGE_TRANSACTION(trans) \
+ *((void **)array_idx_modifiable( \
+ &(trans)->mail_index_transaction_module_contexts, \
+ mail_storage_mail_index_module_id))
+
/* Set error message in storage. Critical errors are logged with i_error(),
but user sees only "internal error" message. */
void mail_storage_clear_error(struct mail_storage *storage);
Index: mail-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- mail-storage.c 28 Jun 2006 13:10:48 -0000 1.55
+++ mail-storage.c 28 Jun 2006 16:31:06 -0000 1.56
@@ -1,9 +1,10 @@
-/* Copyright (C) 2002-2003 Timo Sirainen */
+/* Copyright (C) 2002-2006 Timo Sirainen */
#include "lib.h"
#include "ioloop.h"
#include "array.h"
#include "var-expand.h"
+#include "mail-index-private.h"
#include "mail-storage-private.h"
#include <stdlib.h>
@@ -24,12 +25,15 @@
#define MAILBOX_MAX_HIERARCHY_NAME_LENGTH 200
unsigned int mail_storage_module_id = 0;
+unsigned int mail_storage_mail_index_module_id = 0;
static ARRAY_DEFINE(storages, struct mail_storage *);
void mail_storage_init(void)
{
ARRAY_CREATE(&storages, default_pool, struct mail_storage *, 8);
+
+ mail_storage_mail_index_module_id = mail_index_module_id++;
}
void mail_storage_deinit(void)
@@ -40,6 +44,9 @@
void mail_storage_class_register(struct mail_storage *storage_class)
{
+ if (storage_class->v.class_init != NULL)
+ storage_class->v.class_init();
+
/* append it after the list, so the autodetection order is correct */
array_append(&storages, &storage_class, 1);
}
@@ -56,6 +63,8 @@
break;
}
}
+
+ storage_class->v.class_deinit();
}
void mail_storage_parse_env(enum mail_storage_flags *flags_r,
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-index-dummy-view.c, 1.2,
1.3 mail-index-private.h, 1.71,
1.72 mail-index-transaction-private.h, 1.30,
1.31 mail-index-transaction-view.c, 1.18,
1.19 mail-index-transaction.c, 1.77,
1.78 mail-index-view-private.h, 1.24, 1.25 mail-index-view.c,
1.46, 1.47 mail-index.c, 1.236, 1.237 mail-index.h, 1.159, 1.160
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index index-storage.c, 1.86,
1.87 index-storage.h, 1.103, 1.104 index-transaction.c, 1.14, 1.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list