changeset 21532:0754351f9f75

LAYOUT=index: Rename mailbox_list_index_node.corrupted_parent to corrupted_ext The code will be useful for other purposes also besides updating corrupted parents.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 13 Feb 2017 20:01:13 +0200
parents a326cf8a579a
children eb9ee9ea67eb
files src/lib-storage/list/mailbox-list-index-sync.c src/lib-storage/list/mailbox-list-index.c src/lib-storage/list/mailbox-list-index.h
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/list/mailbox-list-index-sync.c	Tue Jan 31 19:43:30 2017 +0200
+++ b/src/lib-storage/list/mailbox-list-index-sync.c	Mon Feb 13 20:01:13 2017 +0200
@@ -375,17 +375,18 @@
 	if (!mail_index_lookup_seq(sync_ctx->view, node->uid, &seq))
 		return;
 
-	if (node->corrupted_parent) {
+	if (node->corrupted_ext) {
 		mail_index_lookup_ext(sync_ctx->view, seq,
 				      sync_ctx->ilist->ext_id,
 				      &data, &expunged);
 		i_assert(data != NULL);
 
 		memcpy(&irec, data, sizeof(irec));
+		irec.name_id = node->name_id;
 		irec.parent_uid = node->parent == NULL ? 0 : node->parent->uid;
 		mail_index_update_ext(sync_ctx->trans, seq,
 				      sync_ctx->ilist->ext_id, &irec, NULL);
-		node->corrupted_parent = FALSE;
+		node->corrupted_ext = FALSE;
 	}
 	if ((node->flags & MAILBOX_LIST_INDEX_FLAG_CORRUPTED_NAME) != 0) {
 		/* rely on lib-index to drop unnecessary updates */
--- a/src/lib-storage/list/mailbox-list-index.c	Tue Jan 31 19:43:30 2017 +0200
+++ b/src/lib-storage/list/mailbox-list-index.c	Mon Feb 13 20:01:13 2017 +0200
@@ -355,7 +355,7 @@
 				if (ilist->has_backing_store)
 					break;
 				/* just place it under the root */
-				node->corrupted_parent = TRUE;
+				node->corrupted_ext = TRUE;
 			} else if (node_has_parent(parent, node)) {
 				*error_r = t_strdup_printf(
 					"parent_uid=%u loops to node itself (%s)",
@@ -363,7 +363,7 @@
 				if (ilist->has_backing_store)
 					break;
 				/* just place it under the root */
-				node->corrupted_parent = TRUE;
+				node->corrupted_ext = TRUE;
 			} else {
 				node->parent = parent;
 				node->next = parent->children;
--- a/src/lib-storage/list/mailbox-list-index.h	Tue Jan 31 19:43:30 2017 +0200
+++ b/src/lib-storage/list/mailbox-list-index.h	Mon Feb 13 20:01:13 2017 +0200
@@ -80,8 +80,8 @@
 
 	uint32_t name_id, uid;
 	enum mailbox_list_index_flags flags;
-	/* parent_uid is corrupted on disk - need to update it */
-	bool corrupted_parent;
+	/* extension data is corrupted on disk - need to update it */
+	bool corrupted_ext;
 	const char *name;
 };