[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-file.c, 1.12,
1.13 dbox-file.h, 1.2, 1.3 dbox-mail.c, 1.11, 1.12 dbox-save.c,
1.13, 1.14 dbox-storage.h, 1.11, 1.12 dbox-sync-expunge.c,
1.15, 1.16 dbox-sync-full.c, 1.6, 1.7 dbox-sync.c, 1.17, 1.18
cras at dovecot.org
cras at dovecot.org
Mon Jun 12 11:24:47 EEST 2006
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-file.c, 1.12,
1.12.2.1 dbox-file.h, 1.2, 1.2.2.1 dbox-mail.c, 1.9.2.1,
1.9.2.2 dbox-save.c, 1.10.2.2, 1.10.2.3 dbox-storage.h, 1.10,
1.10.2.1 dbox-sync-expunge.c, 1.15, 1.15.2.1 dbox-sync-full.c,
1.5.2.1, 1.5.2.2 dbox-sync.c, 1.16.2.1, 1.16.2.2
- Next message: [dovecot-cvs] dovecot/src/lib strfuncs.c, 1.55, 1.56 strfuncs.h,
1.28, 1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv14000
Modified Files:
dbox-file.c dbox-file.h dbox-mail.c dbox-save.c dbox-storage.h
dbox-sync-expunge.c dbox-sync-full.c dbox-sync.c
Log Message:
Allow reading saved mails which haven't been committed yet (ie. make quota
plugin work).
Index: dbox-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-file.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- dbox-file.c 12 Apr 2006 19:24:57 -0000 1.12
+++ dbox-file.c 12 Jun 2006 08:24:44 -0000 1.13
@@ -101,7 +101,8 @@
return 1;
}
-int dbox_file_seek(struct dbox_mailbox *mbox, uint32_t file_seq, uoff_t offset)
+int dbox_file_seek(struct dbox_mailbox *mbox, uint32_t file_seq, uoff_t offset,
+ bool ignore_zero_uid)
{
int ret;
@@ -148,7 +149,8 @@
if ((ret = dbox_file_read_mail_header(mbox, mbox->file, offset)) <= 0)
return ret;
- if (mbox->file->seeked_mail_size == 0 || mbox->file->seeked_uid == 0) {
+ if (mbox->file->seeked_mail_size == 0 ||
+ (mbox->file->seeked_uid == 0 && !ignore_zero_uid)) {
/* could be legitimately just not written yet. we're at EOF. */
return 0;
}
@@ -166,7 +168,7 @@
mbox->file->mail_header_size +
mbox->file->seeked_mail_size;
- ret = dbox_file_seek(mbox, mbox->file->file_seq, offset);
+ ret = dbox_file_seek(mbox, mbox->file->file_seq, offset, FALSE);
if (ret <= 0)
return ret;
Index: dbox-file.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-file.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dbox-file.h 28 Jan 2006 22:05:48 -0000 1.2
+++ dbox-file.h 12 Jun 2006 08:24:44 -0000 1.3
@@ -13,8 +13,8 @@
void dbox_file_close(struct dbox_file *file);
/* Returns -1 = error, 0 = EOF (mail was just moved / file broken), 1 = ok */
-int dbox_file_seek(struct dbox_mailbox *mbox,
- uint32_t file_seq, uoff_t offset);
+int dbox_file_seek(struct dbox_mailbox *mbox, uint32_t file_seq, uoff_t offset,
+ bool ignore_zero_uid);
int dbox_file_seek_next_nonexpunged(struct dbox_mailbox *mbox);
void dbox_file_header_init(struct dbox_file_header *hdr);
Index: dbox-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-mail.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dbox-mail.c 8 Jun 2006 17:14:00 -0000 1.11
+++ dbox-mail.c 12 Jun 2006 08:24:44 -0000 1.12
@@ -77,6 +77,8 @@
int *ret_r)
{
struct dbox_mailbox *mbox = (struct dbox_mailbox *)mail->ibox;
+ struct dbox_transaction_context *t =
+ (struct dbox_transaction_context *)mail->trans;
uint32_t seq = mail->mail.mail.seq;
*ret_r = dbox_mail_lookup_offset(mail->trans, seq,
@@ -87,7 +89,8 @@
return TRUE;
}
- if ((*ret_r = dbox_file_seek(mbox, *file_seq_r, *offset_r)) < 0)
+ if ((*ret_r = dbox_file_seek(mbox, *file_seq_r, *offset_r,
+ seq >= t->first_saved_mail_seq)) < 0)
return TRUE;
if (*ret_r > 0) {
/* ok */
Index: dbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-save.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- dbox-save.c 8 Jun 2006 18:21:12 -0000 1.13
+++ dbox-save.c 12 Jun 2006 08:24:44 -0000 1.14
@@ -23,7 +23,6 @@
struct mail_index_transaction *trans;
struct dbox_uidlist_append_ctx *append_ctx;
- uint32_t first_append_seq;
struct mail_index_sync_ctx *index_sync_ctx;
/* updated for each appended mail: */
@@ -230,8 +229,8 @@
if (mail_set_seq(dest_mail, ctx->seq) < 0)
i_unreached();
- if (ctx->first_append_seq == 0)
- ctx->first_append_seq = ctx->seq;
+ if (t->first_saved_mail_seq == 0)
+ t->first_saved_mail_seq = ctx->seq;
t_pop();
*ctx_r = &ctx->ctx;
@@ -313,8 +312,8 @@
int dbox_transaction_save_commit_pre(struct dbox_save_context *ctx)
{
- struct index_transaction_context *idx_trans =
- (struct index_transaction_context *)ctx->ctx.transaction;
+ struct dbox_transaction_context *t =
+ (struct dbox_transaction_context *)ctx->ctx.transaction;
struct dbox_mail_header hdr;
struct dbox_file *file;
struct mail_index_view *view;
@@ -348,8 +347,8 @@
mail_index_append_assign_uids(ctx->trans, uid, &last_uid);
/* update UIDs */
- for (seq = ctx->first_append_seq; seq <= ctx->seq; seq++, uid++) {
- ret = dbox_mail_lookup_offset(idx_trans, seq,
+ for (seq = t->first_saved_mail_seq; seq <= ctx->seq; seq++, uid++) {
+ ret = dbox_mail_lookup_offset(&t->ictx, seq,
&file_seq, &offset);
i_assert(ret > 0); /* it's in memory, shouldn't fail! */
Index: dbox-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dbox-storage.h 9 May 2006 11:57:37 -0000 1.11
+++ dbox-storage.h 12 Jun 2006 08:24:44 -0000 1.12
@@ -70,6 +70,7 @@
struct dbox_transaction_context {
struct index_transaction_context ictx;
+ uint32_t first_saved_mail_seq;
struct dbox_save_context *save_ctx;
};
Index: dbox-sync-expunge.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-sync-expunge.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- dbox-sync-expunge.c 27 Apr 2006 12:33:21 -0000 1.15
+++ dbox-sync-expunge.c 12 Jun 2006 08:24:44 -0000 1.16
@@ -90,13 +90,13 @@
uoff_t full_size;
off_t bytes;
- ret = dbox_file_seek(mbox, orig_entry->file_seq, orig_offset);
+ ret = dbox_file_seek(mbox, orig_entry->file_seq, orig_offset, FALSE);
if (ret >= 0 && mbox->file->hdr.have_expunged_mails != '0') {
/* there are some expunged mails in the file, go through all
of the mails. */
ret = dbox_file_seek(mbox, orig_entry->file_seq,
- mbox->file->header_size);
+ mbox->file->header_size, FALSE);
}
/* skip mails until we find the first we don't want expunged */
@@ -379,7 +379,7 @@
}
/* mails expunged from the end of file, ftruncate() it */
- ret = dbox_file_seek(mbox, entry->file_seq, offset);
+ ret = dbox_file_seek(mbox, entry->file_seq, offset, FALSE);
if (ret <= 0) {
if (ret < 0)
return -1;
Index: dbox-sync-full.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-sync-full.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- dbox-sync-full.c 8 Jun 2006 17:14:00 -0000 1.6
+++ dbox-sync-full.c 12 Jun 2006 08:24:44 -0000 1.7
@@ -116,7 +116,7 @@
uint32_t seq;
int ret;
- if ((ret = dbox_file_seek(mbox, file_seq, 0)) < 0) {
+ if ((ret = dbox_file_seek(mbox, file_seq, 0, FALSE)) < 0) {
/* error / broken file */
return -1;
}
Index: dbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-sync.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- dbox-sync.c 30 May 2006 08:33:20 -0000 1.17
+++ dbox-sync.c 12 Jun 2006 08:24:44 -0000 1.18
@@ -170,7 +170,7 @@
return -1;
}
- if ((ret = dbox_file_seek(mbox, file_seq, offset)) <= 0)
+ if ((ret = dbox_file_seek(mbox, file_seq, offset, FALSE)) <= 0)
return ret;
while (mbox->file->seeked_uid <= uid2) {
@@ -257,7 +257,7 @@
unsigned char keyword_array, keyword_mask = 1;
unsigned int file_idx, first_flag_offset;
- if (dbox_file_seek(ctx->mbox, entry->file_seq, 0) <= 0)
+ if (dbox_file_seek(ctx->mbox, entry->file_seq, 0, FALSE) <= 0)
return -1;
keyword_array = set ? '1' : '0';
@@ -287,7 +287,7 @@
unsigned int first_flag_offset;
int ret;
- if (dbox_file_seek(ctx->mbox, entry->file_seq, 0) <= 0)
+ if (dbox_file_seek(ctx->mbox, entry->file_seq, 0, FALSE) <= 0)
return -1;
if (ctx->mbox->file->keyword_count == 0)
@@ -318,7 +318,7 @@
unsigned int count, file_idx, keyword_idx;
int ret = 0;
- if (dbox_file_seek(ctx->mbox, entry->file_seq, 0) <= 0)
+ if (dbox_file_seek(ctx->mbox, entry->file_seq, 0, FALSE) <= 0)
return -1;
/* Get a list of all new keywords. Using seq_range is the easiest
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-file.c, 1.12,
1.12.2.1 dbox-file.h, 1.2, 1.2.2.1 dbox-mail.c, 1.9.2.1,
1.9.2.2 dbox-save.c, 1.10.2.2, 1.10.2.3 dbox-storage.h, 1.10,
1.10.2.1 dbox-sync-expunge.c, 1.15, 1.15.2.1 dbox-sync-full.c,
1.5.2.1, 1.5.2.2 dbox-sync.c, 1.16.2.1, 1.16.2.2
- Next message: [dovecot-cvs] dovecot/src/lib strfuncs.c, 1.55, 1.56 strfuncs.h,
1.28, 1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list