From: Marco Bettini Date: Thu, 28 Jul 2022 15:38:53 +0000 (+0000) Subject: plugins: fts - Add event to struct fts_expunge_log X-Git-Tag: 2.4.0~3700 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0588f98a337c17de67dabea52fde20e1a0640fc3;p=thirdparty%2Fdovecot%2Fcore.git plugins: fts - Add event to struct fts_expunge_log --- diff --git a/src/plugins/fts/fts-expunge-log.c b/src/plugins/fts/fts-expunge-log.c index 90e99d331b..96ea0ea2cc 100644 --- a/src/plugins/fts/fts-expunge-log.c +++ b/src/plugins/fts/fts-expunge-log.c @@ -9,6 +9,7 @@ #include "seq-range-array.h" #include "mail-storage.h" #include "fts-expunge-log.h" +#include "fts-api-private.h" #include #include @@ -34,6 +35,7 @@ struct fts_expunge_log { int fd; struct stat st; + struct event *event; }; struct fts_expunge_log_mailbox { @@ -64,11 +66,14 @@ struct fts_expunge_log_read_ctx { bool unlink; }; -struct fts_expunge_log *fts_expunge_log_init(const char *path) +struct fts_expunge_log * +fts_expunge_log_init(const char *path, struct event *event) { struct fts_expunge_log *log; log = i_new(struct fts_expunge_log, 1); + log->event = event_create(event); + event_add_category(log->event, &event_category_fts); log->path = i_strdup(path); log->fd = -1; return log; @@ -81,6 +86,7 @@ void fts_expunge_log_deinit(struct fts_expunge_log **_log) *_log = NULL; i_close_fd(&log->fd); i_free(log->path); + event_unref(&log->event); i_free(log); } @@ -525,7 +531,7 @@ int fts_expunge_log_read_end(struct fts_expunge_log_read_ctx **_ctx) return ret; } -int fts_expunge_log_flatten(const char *path, +int fts_expunge_log_flatten(const char *path, struct event *event, struct fts_expunge_log_append_ctx **flattened_r) { struct fts_expunge_log *read; @@ -535,7 +541,7 @@ int fts_expunge_log_flatten(const char *path, int ret; i_assert(path != NULL && flattened_r != NULL); - read = fts_expunge_log_init(path); + read = fts_expunge_log_init(path, event); read_ctx = fts_expunge_log_read_begin(read); read_ctx->unlink = FALSE; @@ -598,7 +604,7 @@ int fts_expunge_log_flat_write(const struct fts_expunge_log_append_ctx *read_log const char *path) { int ret; - struct fts_expunge_log *nlog = fts_expunge_log_init(path); + struct fts_expunge_log *nlog = fts_expunge_log_init(path, read_log->log->event); struct fts_expunge_log_append_ctx *nappend = fts_expunge_log_append_begin(nlog); struct hash_iterate_context *iter; diff --git a/src/plugins/fts/fts-expunge-log.h b/src/plugins/fts/fts-expunge-log.h index cc15f29a1a..a51fcee183 100644 --- a/src/plugins/fts/fts-expunge-log.h +++ b/src/plugins/fts/fts-expunge-log.h @@ -9,7 +9,8 @@ struct fts_expunge_log_read_record { ARRAY_TYPE(seq_range) uids; }; -struct fts_expunge_log *fts_expunge_log_init(const char *path); +struct fts_expunge_log *fts_expunge_log_init(const char *path, + struct event *event); void fts_expunge_log_deinit(struct fts_expunge_log **log); struct fts_expunge_log_append_ctx * @@ -44,7 +45,7 @@ int fts_expunge_log_read_end(struct fts_expunge_log_read_ctx **ctx); /* Read an entire log file, and flatten it into one hash of arrays. The struct it returns cannot be written, as it has no backing store */ -int fts_expunge_log_flatten(const char *path, +int fts_expunge_log_flatten(const char *path, struct event *event, struct fts_expunge_log_append_ctx **flattened_r); bool fts_expunge_log_contains(const struct fts_expunge_log_append_ctx *ctx, const guid_128_t mailbox_guid, uint32_t uid);