[dovecot-cvs] dovecot/src/lib-storage/index index-fetch.c,1.49,1.50 index-storage.c,1.35,1.36 index-storage.h,1.43,1.44

cras at procontrol.fi cras at procontrol.fi
Wed Jul 23 06:55:14 EEST 2003


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

Modified Files:
	index-fetch.c index-storage.c index-storage.h 
Log Message:
Explicit lock() method for mailbox.



Index: index-fetch.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-fetch.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- index-fetch.c	23 Jul 2003 01:44:16 -0000	1.49
+++ index-fetch.c	23 Jul 2003 02:55:12 -0000	1.50
@@ -22,7 +22,7 @@
 
 struct mail_fetch_context *
 index_storage_fetch_init(struct mailbox *box,
-			 enum mail_fetch_field wanted_fields, int update_flags,
+			 enum mail_fetch_field wanted_fields,
 			 const char *messageset, int uidset)
 {
 	struct index_mailbox *ibox = (struct index_mailbox *) box;
@@ -31,12 +31,6 @@
 
 	ctx = i_new(struct mail_fetch_context, 1);
 	ctx->old_lock = ibox->index->lock_type;
-
-	/* need exclusive lock to update the \Seen flags */
-	if (update_flags && !box->readonly) {
-		if (!index_storage_lock(ibox, MAIL_LOCK_EXCLUSIVE))
-			return NULL;
-	}
 
 	check_mail = (client_workarounds &
 		      WORKAROUND_OE6_FETCH_NO_NEWMAIL) == 0;

Index: index-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- index-storage.c	15 Jul 2003 18:26:43 -0000	1.35
+++ index-storage.c	23 Jul 2003 02:55:12 -0000	1.36
@@ -284,6 +284,14 @@
 {
 	int ret;
 
+	if (lock_type == MAIL_LOCK_UNLOCK) {
+		if (ibox->lock_type != MAILBOX_LOCK_UNLOCK)
+			return TRUE;
+	} else {
+		if (ibox->index->lock_type == MAIL_LOCK_EXCLUSIVE)
+			return TRUE;
+	}
+
 	/* we have to set/reset this every time, because the same index
 	   may be used by multiple IndexMailboxes. */
         index_storage_init_lock_notify(ibox);

Index: index-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- index-storage.h	23 Jul 2003 01:44:16 -0000	1.43
+++ index-storage.h	23 Jul 2003 02:55:12 -0000	1.44
@@ -21,6 +21,7 @@
 	void (*mail_init)(struct index_mail *mail);
 
 	struct mail_index *index;
+        enum mailbox_lock_type lock_type;
 
 	struct timeout *autosync_to;
         struct index_autosync_file *autosync_files;
@@ -91,7 +92,7 @@
 
 struct mail_fetch_context *
 index_storage_fetch_init(struct mailbox *box,
-			 enum mail_fetch_field wanted_fields, int update_flags,
+			 enum mail_fetch_field wanted_fields,
 			 const char *messageset, int uidset);
 int index_storage_fetch_deinit(struct mail_fetch_context *ctx, int *all_found);
 struct mail *index_storage_fetch_next(struct mail_fetch_context *ctx);



More information about the dovecot-cvs mailing list