dovecot-2.0: mdbox: Renamed dbox_map* to mdbox_map*.

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 29 18:53:10 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/ac62dbb6a355
changeset: 11218:ac62dbb6a355
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 29 18:53:07 2010 +0300
description:
mdbox: Renamed dbox_map* to mdbox_map*.

diffstat:

 src/lib-storage/index/dbox-multi/mdbox-file.c            |    2 +-
 src/lib-storage/index/dbox-multi/mdbox-mail.c            |   18 +-
 src/lib-storage/index/dbox-multi/mdbox-map-private.h     |   17 +-
 src/lib-storage/index/dbox-multi/mdbox-map.c             |  316 ++++++++++---------
 src/lib-storage/index/dbox-multi/mdbox-map.h             |  102 +++---
 src/lib-storage/index/dbox-multi/mdbox-purge.c           |   48 +-
 src/lib-storage/index/dbox-multi/mdbox-save.c            |   38 +-
 src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c |   16 +-
 src/lib-storage/index/dbox-multi/mdbox-storage.c         |   22 +-
 src/lib-storage/index/dbox-multi/mdbox-storage.h         |    2 +-
 src/lib-storage/index/dbox-multi/mdbox-sync.c            |   10 +-
 src/lib-storage/index/dbox-multi/mdbox-sync.h            |    2 +-
 12 files changed, 299 insertions(+), 294 deletions(-)

diffs (truncated from 1598 to 300 lines):

diff -r 6e1bbf87749f -r ac62dbb6a355 src/lib-storage/index/dbox-multi/mdbox-file.c
--- a/src/lib-storage/index/dbox-multi/mdbox-file.c	Thu Apr 29 18:43:51 2010 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-file.c	Thu Apr 29 18:53:07 2010 +0300
@@ -264,7 +264,7 @@
 int mdbox_file_create_fd(struct dbox_file *file, const char *path, bool parents)
 {
 	struct mdbox_file *mfile = (struct mdbox_file *)file;
-	struct dbox_map *map = mfile->storage->map;
+	struct mdbox_map *map = mfile->storage->map;
 	mode_t old_mask;
 	const char *p, *dir;
 	int fd;
diff -r 6e1bbf87749f -r ac62dbb6a355 src/lib-storage/index/dbox-multi/mdbox-mail.c
--- a/src/lib-storage/index/dbox-multi/mdbox-mail.c	Thu Apr 29 18:43:51 2010 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-mail.c	Thu Apr 29 18:53:07 2010 +0300
@@ -41,10 +41,10 @@
 		}
 		mbox->map_uid_validity = hdr.map_uid_validity;
 	}
-	if (dbox_map_open_or_create(mbox->storage->map) < 0)
+	if (mdbox_map_open_or_create(mbox->storage->map) < 0)
 		return -1;
 
-	cur_map_uid_validity = dbox_map_get_uid_validity(mbox->storage->map);
+	cur_map_uid_validity = mdbox_map_get_uid_validity(mbox->storage->map);
 	if (cur_map_uid_validity != mbox->map_uid_validity) {
 		mail_storage_set_critical(&mbox->storage->storage.storage,
 			"mdbox %s: map uidvalidity mismatch (%u vs %u)",
@@ -68,10 +68,10 @@
 		return;
 	}
 
-	dbox_map_set_corrupted(mbox->storage->map,
-			       "Unexpectedly lost %s uid=%u map_uid=%u",
-			       mailbox_get_vname(_mail->box),
-			       _mail->uid, map_uid);
+	mdbox_map_set_corrupted(mbox->storage->map,
+				"Unexpectedly lost %s uid=%u map_uid=%u",
+				mailbox_get_vname(_mail->box),
+				_mail->uid, map_uid);
 }
 
 static int dbox_mail_open_init(struct dbox_mail *mail, uint32_t map_uid)
@@ -81,8 +81,8 @@
 	uint32_t file_id;
 	int ret;
 
-	if ((ret = dbox_map_lookup(mbox->storage->map, map_uid,
-				   &file_id, &mail->offset)) <= 0) {
+	if ((ret = mdbox_map_lookup(mbox->storage->map, map_uid,
+				    &file_id, &mail->offset)) <= 0) {
 		if (ret < 0)
 			return -1;
 
@@ -141,7 +141,7 @@
 				return -1;
 			}
 			prev_file_id = mfile->file_id;
-			if (dbox_map_refresh(mbox->storage->map) < 0)
+			if (mdbox_map_refresh(mbox->storage->map) < 0)
 				return -1;
 			dbox_file_unref(&mail->open_file);
 		}
diff -r 6e1bbf87749f -r ac62dbb6a355 src/lib-storage/index/dbox-multi/mdbox-map-private.h
--- a/src/lib-storage/index/dbox-multi/mdbox-map-private.h	Thu Apr 29 18:43:51 2010 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-map-private.h	Thu Apr 29 18:53:07 2010 +0300
@@ -6,10 +6,10 @@
 struct dbox_mail_lookup_rec {
 	uint32_t map_uid;
 	uint16_t refcount;
-	struct dbox_map_mail_index_record rec;
+	struct mdbox_map_mail_index_record rec;
 };
 
-struct dbox_map {
+struct mdbox_map {
 	struct mdbox_storage *storage;
 	const struct mdbox_settings *set;
 	char *path;
@@ -25,13 +25,13 @@
 	const char *create_gid_origin;
 };
 
-struct dbox_map_append {
+struct mdbox_map_append {
 	struct dbox_file_append_context *file_append;
 	uoff_t offset, size;
 };
 
-struct dbox_map_append_context {
-	struct dbox_map *map;
+struct mdbox_map_append_context {
+	struct mdbox_map *map;
 
 	struct mail_index_sync_ctx *sync_ctx;
 	struct mail_index_view *sync_view;
@@ -39,7 +39,7 @@
 
 	ARRAY_DEFINE(file_appends, struct dbox_file_append_context *);
 	ARRAY_DEFINE(files, struct dbox_file *);
-	ARRAY_DEFINE(appends, struct dbox_map_append);
+	ARRAY_DEFINE(appends, struct mdbox_map_append);
 
 	uint32_t first_new_file_id;
 
@@ -49,7 +49,8 @@
 	unsigned int committed:1;
 };
 
-int dbox_map_view_lookup_rec(struct dbox_map *map, struct mail_index_view *view,
-			     uint32_t seq, struct dbox_mail_lookup_rec *rec_r);
+int mdbox_map_view_lookup_rec(struct mdbox_map *map,
+			      struct mail_index_view *view, uint32_t seq,
+			      struct dbox_mail_lookup_rec *rec_r);
 
 #endif
diff -r 6e1bbf87749f -r ac62dbb6a355 src/lib-storage/index/dbox-multi/mdbox-map.c
--- a/src/lib-storage/index/dbox-multi/mdbox-map.c	Thu Apr 29 18:43:51 2010 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-map.c	Thu Apr 29 18:53:07 2010 +0300
@@ -20,8 +20,8 @@
 
 #define MAP_STORAGE(map) (&(map)->storage->storage.storage)
 
-struct dbox_map_transaction_context {
-	struct dbox_map *map;
+struct mdbox_map_transaction_context {
+	struct mdbox_map *map;
 	struct mail_index_transaction *trans;
 	struct mail_index_sync_ctx *sync_ctx;
 
@@ -29,7 +29,7 @@
 	unsigned int success:1;
 };
 
-void dbox_map_set_corrupted(struct dbox_map *map, const char *format, ...)
+void mdbox_map_set_corrupted(struct mdbox_map *map, const char *format, ...)
 {
 	va_list args;
 
@@ -43,22 +43,22 @@
 	mdbox_storage_set_corrupted(map->storage);
 }
 
-struct dbox_map *
-dbox_map_init(struct mdbox_storage *storage, struct mailbox_list *root_list,
-	      const char *path)
+struct mdbox_map *
+mdbox_map_init(struct mdbox_storage *storage, struct mailbox_list *root_list,
+	       const char *path)
 {
-	struct dbox_map *map;
+	struct mdbox_map *map;
 	gid_t tmp_gid;
 	const char *tmp_origin;
 
-	map = i_new(struct dbox_map, 1);
+	map = i_new(struct mdbox_map, 1);
 	map->storage = storage;
 	map->set = storage->set;
 	map->path = i_strdup(path);
 	map->index = mail_index_alloc(path, MDBOX_GLOBAL_INDEX_PREFIX);
 	map->map_ext_id = mail_index_ext_register(map->index, "map",
-				sizeof(struct dbox_map_mail_index_header),
-				sizeof(struct dbox_map_mail_index_record),
+				sizeof(struct mdbox_map_mail_index_header),
+				sizeof(struct mdbox_map_mail_index_record),
 				sizeof(uint32_t));
 	map->ref_ext_id = mail_index_ext_register(map->index, "ref", 0,
 				sizeof(uint16_t), sizeof(uint16_t));
@@ -73,9 +73,9 @@
 	return map;
 }
 
-void dbox_map_deinit(struct dbox_map **_map)
+void mdbox_map_deinit(struct mdbox_map **_map)
 {
-	struct dbox_map *map = *_map;
+	struct mdbox_map *map = *_map;
 
 	*_map = NULL;
 
@@ -88,7 +88,7 @@
 	i_free(map);
 }
 
-static int dbox_map_mkdir_storage(struct dbox_map *map)
+static int mdbox_map_mkdir_storage(struct mdbox_map *map)
 {
 	if (mkdir_parents_chgrp(map->path, map->create_dir_mode,
 				map->create_gid, map->create_gid_origin) < 0 &&
@@ -100,7 +100,7 @@
 	return 0;
 }
 
-static void dbox_map_cleanup(struct dbox_map *map)
+static void mdbox_map_cleanup(struct mdbox_map *map)
 {
 	struct stat st;
 
@@ -118,7 +118,7 @@
 	}
 }
 
-static int dbox_map_open_internal(struct dbox_map *map, bool create_missing)
+static int mdbox_map_open_internal(struct mdbox_map *map, bool create_missing)
 {
 	enum mail_index_open_flags open_flags;
 	int ret;
@@ -132,7 +132,7 @@
 		mail_storage_settings_to_index_flags(MAP_STORAGE(map)->set);
 	if (create_missing) {
 		open_flags |= MAIL_INDEX_OPEN_FLAG_CREATE;
-		if (dbox_map_mkdir_storage(map) < 0)
+		if (mdbox_map_mkdir_storage(map) < 0)
 			return -1;
 	}
 	ret = mail_index_open(map->index, open_flags,
@@ -149,21 +149,21 @@
 	}
 
 	map->view = mail_index_view_open(map->index);
-	dbox_map_cleanup(map);
+	mdbox_map_cleanup(map);
 	return 1;
 }
 
-int dbox_map_open(struct dbox_map *map)
+int mdbox_map_open(struct mdbox_map *map)
 {
-	return dbox_map_open_internal(map, FALSE);
+	return mdbox_map_open_internal(map, FALSE);
 }
 
-int dbox_map_open_or_create(struct dbox_map *map)
+int mdbox_map_open_or_create(struct mdbox_map *map)
 {
-	return dbox_map_open_internal(map, TRUE) <= 0 ? -1 : 0;
+	return mdbox_map_open_internal(map, TRUE) <= 0 ? -1 : 0;
 }
 
-int dbox_map_refresh(struct dbox_map *map)
+int mdbox_map_refresh(struct mdbox_map *map)
 {
 	struct mail_index_view_sync_ctx *ctx;
 	bool delayed_expunges;
@@ -189,8 +189,8 @@
 }
 
 static void
-mdbox_map_get_ext_hdr(struct dbox_map *map, struct mail_index_view *view,
-		      struct dbox_map_mail_index_header *hdr_r)
+mdbox_map_get_ext_hdr(struct mdbox_map *map, struct mail_index_view *view,
+		      struct mdbox_map_mail_index_header *hdr_r)
 {
 	const void *data;
 	size_t data_size;
@@ -200,18 +200,19 @@
 	memcpy(hdr_r, data, I_MIN(data_size, sizeof(*hdr_r)));
 }
 
-uint32_t mdbox_map_get_rebuild_count(struct dbox_map *map)
+uint32_t mdbox_map_get_rebuild_count(struct mdbox_map *map)
 {
-	struct dbox_map_mail_index_header hdr;
+	struct mdbox_map_mail_index_header hdr;
 
 	mdbox_map_get_ext_hdr(map, map->view, &hdr);
 	return hdr.rebuild_count;
 }
 
-static int dbox_map_lookup_seq(struct dbox_map *map, uint32_t seq,
-			       const struct dbox_map_mail_index_record **rec_r)
+static int
+mdbox_map_lookup_seq(struct mdbox_map *map, uint32_t seq,
+		     const struct mdbox_map_mail_index_record **rec_r)
 {
-	const struct dbox_map_mail_index_record *rec;
+	const struct mdbox_map_mail_index_record *rec;
 	const void *data;
 	uint32_t uid;
 	bool expunged;
@@ -222,7 +223,7 @@
 
 	if (rec == NULL || rec->file_id == 0) {
 		mail_index_lookup_uid(map->view, seq, &uid);
-		dbox_map_set_corrupted(map, "file_id=0 for map_uid=%u", uid);
+		mdbox_map_set_corrupted(map, "file_id=0 for map_uid=%u", uid);
 		return -1;
 	}
 	*rec_r = rec;
@@ -230,11 +231,11 @@
 }
 
 static int
-dbox_map_get_seq(struct dbox_map *map, uint32_t map_uid, uint32_t *seq_r)
+mdbox_map_get_seq(struct mdbox_map *map, uint32_t map_uid, uint32_t *seq_r)
 {
 	if (!mail_index_lookup_seq(map->view, map_uid, seq_r)) {
 		/* not found - try again after a refresh */
-		if (dbox_map_refresh(map) < 0)


More information about the dovecot-cvs mailing list