Mercurial > dovecot > core-2.2
changeset 20320:71f46b6a90e8
lib-fs: Added fs_switch_ioloop()
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 13 Jun 2016 17:11:28 +0300 |
parents | 9ac230ae61ad |
children | 74e0c3802cc0 |
files | src/lib-fs/fs-api-private.h src/lib-fs/fs-api.c src/lib-fs/fs-api.h src/lib-fs/fs-dict.c src/lib-fs/fs-metawrap.c src/lib-fs/fs-posix.c src/lib-fs/fs-randomfail.c src/lib-fs/fs-sis-queue.c src/lib-fs/fs-sis.c src/lib-fs/fs-test.c src/plugins/fs-compress/fs-compress.c |
diffstat | 11 files changed, 34 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-fs/fs-api-private.h Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-api-private.h Mon Jun 13 17:11:28 2016 +0300 @@ -66,6 +66,8 @@ enum fs_iter_flags flags); const char *(*iter_next)(struct fs_iter *iter); int (*iter_deinit)(struct fs_iter *iter); + + bool (*switch_ioloop)(struct fs *fs); }; struct fs {
--- a/src/lib-fs/fs-api.c Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-api.c Mon Jun 13 17:11:28 2016 +0300 @@ -737,6 +737,20 @@ return ret; } +bool fs_switch_ioloop(struct fs *fs) +{ + bool ret = FALSE; + + if (fs->v.switch_ioloop != NULL) { + T_BEGIN { + ret = fs->v.switch_ioloop(fs); + } T_END; + } else if (fs->parent != NULL) { + ret = fs_switch_ioloop(fs->parent); + } + return ret; +} + int fs_lock(struct fs_file *file, unsigned int secs, struct fs_lock **lock_r) { int ret;
--- a/src/lib-fs/fs-api.h Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-api.h Mon Jun 13 17:11:28 2016 +0300 @@ -288,6 +288,10 @@ It's an error to call this when there are no pending async operations. Returns 0 if ok, -1 if timed out. */ int fs_wait_async(struct fs *fs); +/* Switch the fs to the current ioloop. This can be used to do fs_wait_async() + among other IO work. Returns TRUE if there is actually some work that can + be waited on. */ +bool fs_switch_ioloop(struct fs *fs) ATTR_NOWARN_UNUSED_RESULT; /* Returns 1 if file exists, 0 if not, -1 if error occurred. */ int fs_exists(struct fs_file *file);
--- a/src/lib-fs/fs-dict.c Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-dict.c Mon Jun 13 17:11:28 2016 +0300 @@ -318,6 +318,7 @@ fs_dict_delete, fs_dict_iter_init, fs_dict_iter_next, - fs_dict_iter_deinit + fs_dict_iter_deinit, + NULL } };
--- a/src/lib-fs/fs-metawrap.c Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-metawrap.c Mon Jun 13 17:11:28 2016 +0300 @@ -613,6 +613,7 @@ fs_metawrap_delete, fs_metawrap_iter_init, fs_metawrap_iter_next, - fs_metawrap_iter_deinit + fs_metawrap_iter_deinit, + NULL } };
--- a/src/lib-fs/fs-posix.c Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-posix.c Mon Jun 13 17:11:28 2016 +0300 @@ -873,6 +873,7 @@ fs_posix_delete, fs_posix_iter_init, fs_posix_iter_next, - fs_posix_iter_deinit + fs_posix_iter_deinit, + NULL } };
--- a/src/lib-fs/fs-randomfail.c Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-randomfail.c Mon Jun 13 17:11:28 2016 +0300 @@ -567,6 +567,7 @@ fs_randomfail_delete, fs_randomfail_iter_init, fs_randomfail_iter_next, - fs_randomfail_iter_deinit + fs_randomfail_iter_deinit, + NULL } };
--- a/src/lib-fs/fs-sis-queue.c Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-sis-queue.c Mon Jun 13 17:11:28 2016 +0300 @@ -376,6 +376,7 @@ fs_sis_queue_delete, fs_sis_queue_iter_init, NULL, + NULL, NULL } };
--- a/src/lib-fs/fs-sis.c Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-sis.c Mon Jun 13 17:11:28 2016 +0300 @@ -513,6 +513,7 @@ fs_sis_delete, fs_sis_iter_init, NULL, + NULL, NULL } };
--- a/src/lib-fs/fs-test.c Mon Jun 13 17:31:34 2016 +0300 +++ b/src/lib-fs/fs-test.c Mon Jun 13 17:11:28 2016 +0300 @@ -417,6 +417,7 @@ fs_test_delete, fs_test_iter_init, fs_test_iter_next, - fs_test_iter_deinit + fs_test_iter_deinit, + NULL } };
--- a/src/plugins/fs-compress/fs-compress.c Mon Jun 13 17:31:34 2016 +0300 +++ b/src/plugins/fs-compress/fs-compress.c Mon Jun 13 17:11:28 2016 +0300 @@ -413,6 +413,7 @@ fs_compress_delete, fs_compress_iter_init, fs_compress_iter_next, - fs_compress_iter_deinit + fs_compress_iter_deinit, + NULL } };