dovecot-2.2: lib-fs: Added support for module_contexts in fs.

dovecot at dovecot.org dovecot at dovecot.org
Sun Mar 22 18:55:45 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/66689aaa85de
changeset: 18383:66689aaa85de
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Mar 22 20:52:56 2015 +0200
description:
lib-fs: Added support for module_contexts in fs.
They could also be added to fs_file if needed, but for now I didn't bother
adding it.

diffstat:

 src/lib-fs/fs-api-private.h |  13 +++++++++++++
 src/lib-fs/fs-api.c         |   5 +++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diffs (66 lines):

diff -r 35a4828d11f7 -r 66689aaa85de src/lib-fs/fs-api-private.h
--- a/src/lib-fs/fs-api-private.h	Sun Mar 22 20:52:16 2015 +0200
+++ b/src/lib-fs/fs-api-private.h	Sun Mar 22 20:52:56 2015 +0200
@@ -2,6 +2,17 @@
 #define FS_API_PRIVATE_H
 
 #include "fs-api.h"
+#include "module-context.h"
+
+struct fs_api_module_register {
+	unsigned int id;
+};
+
+union fs_api_module_context {
+	struct fs_api_module_register *reg;
+};
+
+extern struct fs_api_module_register fs_api_module_register;
 
 struct fs_vfuncs {
 	struct fs *(*alloc)(void);
@@ -72,6 +83,8 @@
 	struct fs_iter *iters;
 
 	struct fs_stats stats;
+
+	ARRAY(union fs_api_module_context *) module_contexts;
 };
 
 struct fs_file {
diff -r 35a4828d11f7 -r 66689aaa85de src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c	Sun Mar 22 20:52:16 2015 +0200
+++ b/src/lib-fs/fs-api.c	Sun Mar 22 20:52:56 2015 +0200
@@ -11,6 +11,8 @@
 #include "ostream.h"
 #include "fs-api-private.h"
 
+struct fs_api_module_register fs_api_module_register = { 0 };
+
 static struct module *fs_modules = NULL;
 static ARRAY(const struct fs *) fs_classes;
 
@@ -23,6 +25,7 @@
 
 	fs = fs_class->v.alloc();
 	fs->last_error = str_new(default_pool, 64);
+	i_array_init(&fs->module_contexts, 5);
 
 	T_BEGIN {
 		ret = fs_class->v.init(fs, args, set);
@@ -157,6 +160,7 @@
 {
 	struct fs *fs = *_fs;
 	string_t *last_error = fs->last_error;
+	struct array module_contexts_arr = fs->module_contexts.arr;
 
 	*_fs = NULL;
 
@@ -172,6 +176,7 @@
 	T_BEGIN {
 		fs->v.deinit(fs);
 	} T_END;
+	array_free_i(&module_contexts_arr);
 	str_free(&last_error);
 }
 


More information about the dovecot-cvs mailing list