From: Timo Sirainen Date: Mon, 3 Jul 2023 10:40:36 +0000 (+0300) Subject: dbox: Add reason parameter to dbox_storage_vfuncs.set_file_corrupted() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=29e426a2442c80e02740a24adf64bf684213b157;p=thirdparty%2Fdovecot%2Fcore.git dbox: Add reason parameter to dbox_storage_vfuncs.set_file_corrupted() --- diff --git a/src/lib-storage/index/dbox-common/dbox-file.c b/src/lib-storage/index/dbox-common/dbox-file.c index 16810b0c34..5be9afa1bd 100644 --- a/src/lib-storage/index/dbox-common/dbox-file.c +++ b/src/lib-storage/index/dbox-common/dbox-file.c @@ -53,13 +53,11 @@ void dbox_file_set_corrupted(struct dbox_file *file, const char *reason, ...) va_list args; va_start(args, reason); - mail_storage_set_critical(&file->storage->storage, + file->storage->v.set_file_corrupted(file, t_strdup_printf( "Corrupted dbox file %s (around offset=%"PRIuUOFF_T"): %s", file->cur_path, file->input == NULL ? 0 : file->input->v_offset, - t_strdup_vprintf(reason, args)); + t_strdup_vprintf(reason, args))); va_end(args); - - file->storage->v.set_file_corrupted(file); } void dbox_file_init(struct dbox_file *file) diff --git a/src/lib-storage/index/dbox-common/dbox-storage.h b/src/lib-storage/index/dbox-common/dbox-storage.h index 8e8aaa1899..4da88b566d 100644 --- a/src/lib-storage/index/dbox-common/dbox-storage.h +++ b/src/lib-storage/index/dbox-common/dbox-storage.h @@ -51,7 +51,7 @@ struct dbox_storage_vfuncs { /* mark the mailbox corrupted */ void (*set_mailbox_corrupted)(struct mailbox *box); /* mark the file corrupted */ - void (*set_file_corrupted)(struct dbox_file *file); + void (*set_file_corrupted)(struct dbox_file *file, const char *reason); }; struct dbox_storage { diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage.c b/src/lib-storage/index/dbox-multi/mdbox-storage.c index c2250398eb..283ef7a29a 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c @@ -380,10 +380,11 @@ void mdbox_set_mailbox_corrupted(struct mailbox *box) mdbox_storage_set_corrupted(mstorage); } -void mdbox_set_file_corrupted(struct dbox_file *file) +void mdbox_set_file_corrupted(struct dbox_file *file, const char *reason) { struct mdbox_storage *mstorage = MDBOX_DBOX_STORAGE(file->storage); + mail_storage_set_critical(&mstorage->storage.storage, "%s", reason); mdbox_storage_set_corrupted(mstorage); } diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage.h b/src/lib-storage/index/dbox-multi/mdbox-storage.h index dbb6cfa7b0..86cf407fbd 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage.h +++ b/src/lib-storage/index/dbox-multi/mdbox-storage.h @@ -113,6 +113,6 @@ int mdbox_mailbox_open(struct mailbox *box); void mdbox_storage_set_corrupted(struct mdbox_storage *storage); void mdbox_set_mailbox_corrupted(struct mailbox *box); -void mdbox_set_file_corrupted(struct dbox_file *file); +void mdbox_set_file_corrupted(struct dbox_file *file, const char *reason); #endif diff --git a/src/lib-storage/index/dbox-single/sdbox-storage.c b/src/lib-storage/index/dbox-single/sdbox-storage.c index a25c325306..f1663d7628 100644 --- a/src/lib-storage/index/dbox-single/sdbox-storage.c +++ b/src/lib-storage/index/dbox-single/sdbox-storage.c @@ -305,10 +305,12 @@ void sdbox_set_mailbox_corrupted(struct mailbox *box) mbox->corrupted_rebuild_count = hdr.rebuild_count; } -static void sdbox_set_file_corrupted(struct dbox_file *_file) +static void sdbox_set_file_corrupted(struct dbox_file *_file, + const char *reason) { struct sdbox_file *file = (struct sdbox_file *)_file; + mail_storage_set_critical(&_file->storage->storage, "%s", reason); sdbox_set_mailbox_corrupted(&file->mbox->box); }