]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Rename mail_storage.list_index_corrupted() to list_index_rebuild()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 29 Nov 2017 12:36:25 +0000 (14:36 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 5 Dec 2017 13:45:25 +0000 (15:45 +0200)
Also add a new parameter to it to specify the rebuild reason.

src/lib-storage/list/mailbox-list-index.c
src/lib-storage/mail-storage-private.h

index c41ee288b3fb9e154cbd576a03e768d3a36beaad..3edec116e4788b0280ae4cb68b1f0085e0af4245 100644 (file)
@@ -587,9 +587,12 @@ int mailbox_list_index_handle_corruption(struct mailbox_list *list)
 {
        struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(list);
        struct mail_storage *const *storagep;
+       enum mail_storage_list_index_rebuild_reason reason;
        int ret = 0;
 
-       if (!ilist->call_corruption_callback)
+       if (ilist->call_corruption_callback)
+               reason = MAIL_STORAGE_LIST_INDEX_REBUILD_REASON_CORRUPTED;
+       else
                return 0;
 
        /* make sure we don't recurse */
@@ -598,8 +601,8 @@ int mailbox_list_index_handle_corruption(struct mailbox_list *list)
        ilist->handling_corruption = TRUE;
 
        array_foreach(&list->ns->all_storages, storagep) {
-               if ((*storagep)->v.list_index_corrupted != NULL) {
-                       if ((*storagep)->v.list_index_corrupted(*storagep) < 0)
+               if ((*storagep)->v.list_index_rebuild != NULL) {
+                       if ((*storagep)->v.list_index_rebuild(*storagep, reason) < 0)
                                ret = -1;
                        else {
                                /* FIXME: implement a generic handler that
index b80bbd9f7ab22ac505dff6c6a66194f0286b2aea..e86c283bee026ccd9aed5cd6a1a1ed15ff3770ca 100644 (file)
 
 #define MAIL_SHARED_STORAGE_NAME "shared"
 
+enum mail_storage_list_index_rebuild_reason {
+       /* Mailbox list index was found to be corrupted. */
+       MAIL_STORAGE_LIST_INDEX_REBUILD_REASON_CORRUPTED,
+};
+
 struct mail_storage_module_register {
        unsigned int id;
 };
@@ -48,11 +53,12 @@ struct mail_storage_vfuncs {
                                         const char *vname,
                                         enum mailbox_flags flags);
        int (*purge)(struct mail_storage *storage);
-       /* Called when mailbox list index corruption has been detected.
+       /* Called when mailbox list index rebuild is requested.
           The callback should add any missing mailboxes to the list index.
           Returns 0 on success, -1 on temporary failure that didn't properly
-          fix the index. */
-       int (*list_index_corrupted)(struct mail_storage *storage);
+          rebuild the index. */
+       int (*list_index_rebuild)(struct mail_storage *storage,
+                                 enum mail_storage_list_index_rebuild_reason reason);
 };
 
 union mail_storage_module_context {