From: Timo Sirainen Date: Sun, 22 Mar 2015 18:52:56 +0000 (+0200) Subject: lib-fs: Added support for module_contexts in fs. X-Git-Tag: 2.2.17.rc1~238 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea19bfdfc2205af178a70915054c809ed2b8709e;p=thirdparty%2Fdovecot%2Fcore.git 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. --- diff --git a/src/lib-fs/fs-api-private.h b/src/lib-fs/fs-api-private.h index 3d7a0aeebd..5e5bc2893d 100644 --- a/src/lib-fs/fs-api-private.h +++ b/src/lib-fs/fs-api-private.h @@ -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 { diff --git a/src/lib-fs/fs-api.c b/src/lib-fs/fs-api.c index 63b70904d5..b6469b1b2e 100644 --- a/src/lib-fs/fs-api.c +++ b/src/lib-fs/fs-api.c @@ -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); }