[dovecot-cvs] dovecot/src/lib-index mail-index-open.c,1.25,1.26 mail-index-update.c,1.47,1.48 mail-index.c,1.85,1.86 mail-index.h,1.69,1.70

cras at procontrol.fi cras at procontrol.fi
Thu Mar 6 21:23:47 EET 2003


Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv13584

Modified Files:
	mail-index-open.c mail-index-update.c mail-index.c 
	mail-index.h 
Log Message:
UIDs are now saved into mbox file. added a few rewriting optimizations so
that we don't always have to rewrite the whole file when updating messages
at the beginning of file.



Index: mail-index-open.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-open.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- mail-index-open.c	23 Feb 2003 21:06:57 -0000	1.25
+++ mail-index-open.c	6 Mar 2003 19:23:44 -0000	1.26
@@ -126,6 +126,7 @@
 	   may happen because of this. */
 	if (!index->sync_and_lock(index, MAIL_LOCK_SHARED, NULL))
 		return FALSE;
+	index->inconsistent = FALSE;
 
 	/* we never want to keep shared lock if syncing happens to set it.
 	   either exclusive or nothing (NOTE: drop it directly, not through

Index: mail-index-update.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-update.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- mail-index-update.c	27 Jan 2003 01:59:59 -0000	1.47
+++ mail-index-update.c	6 Mar 2003 19:23:44 -0000	1.48
@@ -306,6 +306,11 @@
 	return !failed;
 }
 
+void mail_index_update_abort(struct mail_index_update *update)
+{
+	pool_unref(update->pool);
+}
+
 static void update_field_full(struct mail_index_update *update,
 			      enum mail_data_field field,
 			      const void *value, size_t size,

Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- mail-index.c	5 Mar 2003 01:41:36 -0000	1.85
+++ mail-index.c	6 Mar 2003 19:23:44 -0000	1.86
@@ -330,6 +330,10 @@
 	if (index->inconsistent) {
 		/* index is in inconsistent state and nothing else than
 		   free() is allowed for it. */
+		if (index->error == NULL) {
+			index->error =
+				i_strdup("Index is in inconsistent state");
+		}
 		return FALSE;
 	}
 
@@ -1029,7 +1033,7 @@
 	    index->header->used_file_size - sizeof(*rec)) {
 		/* we can just rollback */
 		index->header->used_file_size -= sizeof(*rec);
-		index->mmap_used_length += sizeof(*rec);
+		index->mmap_used_length -= sizeof(*rec);
 	} else {
 		/* mark it deleted */
 		update_first_hole(index, rec);

Index: mail-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- mail-index.h	5 Mar 2003 01:41:36 -0000	1.69
+++ mail-index.h	6 Mar 2003 19:23:44 -0000	1.70
@@ -343,6 +343,7 @@
 		(*update_begin)(struct mail_index *index,
 				struct mail_index_record *rec);
 	int (*update_end)(struct mail_index_update *update);
+	void (*update_abort)(struct mail_index_update *update);
 
 	void (*update_field)(struct mail_index_update *update,
 			     enum mail_data_field field,
@@ -420,6 +421,7 @@
 	unsigned int nodiskspace:1;
 	unsigned int index_lock_timeout:1;
 	unsigned int allow_new_custom_flags:1;
+	unsigned int mailbox_readonly:1;
 	unsigned int mailbox_lock_timeout:1;
 };
 
@@ -436,7 +438,7 @@
 	0, 0, 0, 0, 0, 0, { 0, 0, 0 }, 0, 0, \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
-	0, 0, 0, 0
+	0, 0, 0, 0, 0
 #endif
 
 /* defaults - same as above but prefixed with mail_index_. */
@@ -481,6 +483,7 @@
 mail_index_update_begin(struct mail_index *index,
 			struct mail_index_record *rec);
 int mail_index_update_end(struct mail_index_update *update);
+void mail_index_update_abort(struct mail_index_update *update);
 void mail_index_update_field(struct mail_index_update *update,
 			     enum mail_data_field field,
 			     const char *value, size_t extra_space);




More information about the dovecot-cvs mailing list