]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: Added support for module_contexts in fs.
authorTimo Sirainen <tss@iki.fi>
Sun, 22 Mar 2015 18:52:56 +0000 (20:52 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 22 Mar 2015 18:52:56 +0000 (20:52 +0200)
They could also be added to fs_file if needed, but for now I didn't bother
adding it.

src/lib-fs/fs-api-private.h
src/lib-fs/fs-api.c

index 3d7a0aeebd7a43542f7fd4ae09a6bd23b939e9ca..5e5bc2893d436553db3693ecb02ef8c569cbf60c 100644 (file)
@@ -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 {
        struct fs_iter *iters;
 
        struct fs_stats stats;
+
+       ARRAY(union fs_api_module_context *) module_contexts;
 };
 
 struct fs_file {
index 63b70904d5e7f567376245882703ec7ec6e3beff..b6469b1b2e785213e0ac31523c8bb20839d09942 100644 (file)
@@ -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_alloc(const struct fs *fs_class, const char *args,
 
        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 @@ void fs_deinit(struct fs **_fs)
 {
        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 @@ void fs_deinit(struct fs **_fs)
        T_BEGIN {
                fs->v.deinit(fs);
        } T_END;
+       array_free_i(&module_contexts_arr);
        str_free(&last_error);
 }