[dovecot-cvs] dovecot/src/lib-index mail-cache-compress.c, 1.20,
1.21 mail-index-private.h, 1.28, 1.29 mail-index-sync-update.c,
1.47, 1.48 mail-index-transaction-private.h, 1.12,
1.13 mail-index-transaction-view.c, 1.5,
1.6 mail-index-transaction.c, 1.28,
1.29 mail-index-view-private.h, 1.9, 1.10 mail-index-view.c,
1.20, 1.21 mail-index.c, 1.148, 1.149 mail-index.h, 1.128,
1.129 mail-transaction-log-view.c, 1.28,
1.29 mail-transaction-log.c, 1.59, 1.60 mail-transaction-log.h,
1.17, 1.18 mail-transaction-util.c, 1.18,
1.19 mail-transaction-util.h, 1.9, 1.10
cras at dovecot.org
cras at dovecot.org
Sun Sep 26 17:15:58 EEST 2004
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index index-storage.h, 1.78,
1.79
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-file.c, 1.4,
1.5 mbox-save.c, 1.63, 1.64 mbox-storage.c, 1.99,
1.100 mbox-sync-parse.c, 1.27, 1.28 mbox-sync.c, 1.92, 1.93
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv29207/lib-index
Modified Files:
mail-cache-compress.c mail-index-private.h
mail-index-sync-update.c mail-index-transaction-private.h
mail-index-transaction-view.c mail-index-transaction.c
mail-index-view-private.h mail-index-view.c mail-index.c
mail-index.h mail-transaction-log-view.c
mail-transaction-log.c mail-transaction-log.h
mail-transaction-util.c mail-transaction-util.h
Log Message:
Renamed "extra record info" and variations of it to "extension" or "ext" in
short.
Index: mail-cache-compress.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-compress.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mail-cache-compress.c 19 Sep 2004 23:46:33 -0000 1.20
+++ mail-cache-compress.c 26 Sep 2004 14:15:54 -0000 1.21
@@ -170,7 +170,7 @@
hdr.field_header_offset =
mail_index_uint32_to_offset(output->offset);
- /* we wrote everything using our internal data_ids. so we want
+ /* we wrote everything using our internal field ids. so we want
mail_cache_header_fields_get() to use them and ignore any
existing id mappings in the old cache file. */
cache->file_fields_count = 0;
Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- mail-index-private.h 5 Sep 2004 17:53:45 -0000 1.28
+++ mail-index-private.h 26 Sep 2004 14:15:54 -0000 1.29
@@ -21,7 +21,7 @@
((struct mail_index_record *) \
PTR_OFFSET((map)->records, (idx) * (map)->hdr->record_size))
-struct mail_index_extra_record_info {
+struct mail_index_ext {
const char *name;
uint32_t hdr_offset;
uint32_t hdr_size;
@@ -29,7 +29,7 @@
uint32_t record_size;
};
-struct mail_index_extra_record_info_header {
+struct mail_index_ext_header {
uint32_t hdr_size;
uint32_t record_offset;
uint32_t record_size;
@@ -43,9 +43,9 @@
void *records; /* struct mail_index_record[] */
unsigned int records_count;
- pool_t extra_records_pool;
- buffer_t *extra_infos; /* struct mail_index_extra_record_info[] */
- buffer_t *extra_infos_id_map; /* uint32_t[] (index -> file) */
+ pool_t extension_pool;
+ buffer_t *extensions; /* struct mail_index_ext[] */
+ buffer_t *ext_id_map; /* uint32_t[] (index -> file) */
void *mmap_base;
size_t mmap_size, mmap_used_size;
@@ -70,8 +70,8 @@
mode_t mode;
gid_t gid;
- pool_t extra_infos_pool;
- buffer_t *extra_infos; /* struct mail_index_extra_record_info[] */
+ pool_t extension_pool;
+ buffer_t *extensions; /* struct mail_index_ext[] */
char *filepath;
int fd;
@@ -128,14 +128,12 @@
void mail_index_unmap(struct mail_index *index, struct mail_index_map *map);
struct mail_index_map *
mail_index_map_to_memory(struct mail_index_map *map, uint32_t new_record_size);
-uint32_t mail_index_map_register_extra_info(struct mail_index *index,
- struct mail_index_map *map,
- const char *name,
- uint32_t hdr_offset,
- uint32_t hdr_size,
- uint32_t record_size);
-int mail_index_map_get_extra_info_idx(struct mail_index_map *map,
- uint32_t data_id, uint32_t *idx_r);
+uint32_t mail_index_map_register_ext(struct mail_index *index,
+ struct mail_index_map *map,
+ const char *name, uint32_t hdr_offset,
+ uint32_t hdr_size, uint32_t record_size);
+int mail_index_map_get_ext_idx(struct mail_index_map *map,
+ uint32_t ext_id, uint32_t *idx_r);
int mail_index_lookup_full(struct mail_index_view *view, uint32_t seq,
struct mail_index_map **map_r,
Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- mail-index-sync-update.c 24 Sep 2004 11:44:33 -0000 1.47
+++ mail-index-sync-update.c 26 Sep 2004 14:15:54 -0000 1.48
@@ -289,40 +289,39 @@
return 1;
}
-static int sync_extra_intro(const struct mail_transaction_extra_intro *u,
- void *context)
+static int sync_ext_intro(const struct mail_transaction_ext_intro *u,
+ void *context)
{
struct mail_index_sync_map_ctx *ctx = context;
- struct mail_index_extra_record_info_header einfo_hdr;
- const struct mail_index_extra_record_info *einfo;
+ struct mail_index_ext_header ext_hdr;
+ const struct mail_index_ext *ext;
struct mail_index_header *hdr;
const char *name;
buffer_t *hdr_buf;
- uint32_t data_id;
+ uint32_t ext_id;
t_push();
name = t_strndup(u + 1, u->name_size);
hdr_buf = ctx->view->map->hdr_copy_buf;
- data_id = mail_index_map_register_extra_info(ctx->view->index,
- ctx->view->map, name,
- hdr_buf->used, u->hdr_size,
- u->record_size);
+ ext_id = mail_index_map_register_ext(ctx->view->index, ctx->view->map,
+ name, hdr_buf->used,
+ u->hdr_size, u->record_size);
- einfo = ctx->view->index->extra_infos->data;
- einfo += data_id;
+ ext = ctx->view->index->extensions->data;
+ ext += ext_id;
- /* name NUL [padding] einfo_hdr [header data] */
+ /* name NUL [padding] ext_hdr [header data] */
buffer_append(hdr_buf, name, strlen(name)+1);
if ((hdr_buf->used % 4) != 0)
buffer_append(hdr_buf, null4, 4 - (hdr_buf->used % 4));
- memset(&einfo_hdr, 0, sizeof(einfo_hdr));
- einfo_hdr.hdr_size = einfo->hdr_size;
- einfo_hdr.record_offset = einfo->record_offset;
- einfo_hdr.record_size = einfo->record_size;
- buffer_append(hdr_buf, &einfo_hdr, sizeof(einfo_hdr));
- buffer_append_zero(hdr_buf, einfo->hdr_size);
+ memset(&ext_hdr, 0, sizeof(ext_hdr));
+ ext_hdr.hdr_size = ext->hdr_size;
+ ext_hdr.record_offset = ext->record_offset;
+ ext_hdr.record_size = ext->record_size;
+ buffer_append(hdr_buf, &ext_hdr, sizeof(ext_hdr));
+ buffer_append_zero(hdr_buf, ext->hdr_size);
hdr = buffer_get_modifyable_data(hdr_buf, NULL);
hdr->header_size = hdr_buf->used;
@@ -331,90 +330,85 @@
t_pop();
- if (data_id != u->data_id) {
+ if (ext_id != u->ext_id) {
mail_transaction_log_view_set_corrupted(ctx->view->log_view,
- "Introduced extra with invalid data id: %u != %u",
- u->data_id, data_id);
+ "Introduced extension with invalid id: %u != %u",
+ u->ext_id, ext_id);
return -1;
}
return 1;
}
-static int sync_extra_reset(const struct mail_transaction_extra_rec_header *u,
- void *context)
+static int sync_ext_reset(const struct mail_transaction_ext_rec_header *u,
+ void *context)
{
struct mail_index_sync_map_ctx *ctx = context;
struct mail_index_view *view = ctx->view;
struct mail_index_map *map = view->map;
- const struct mail_index_extra_record_info *einfo;
+ const struct mail_index_ext *ext;
struct mail_index_record *rec;
uint32_t i;
- if (map->extra_infos == NULL ||
- u->data_id >= map->extra_infos->used / sizeof(*einfo)) {
+ if (map->extensions == NULL ||
+ u->ext_id >= map->extensions->used / sizeof(*ext)) {
mail_transaction_log_view_set_corrupted(view->log_view,
- "Extra reset for unknown data id %u",
- u->data_id);
+ "Extension reset for unknown id %u", u->ext_id);
return -1;
}
- einfo = map->extra_infos->data;
- einfo += u->data_id;
+ ext = map->extensions->data;
+ ext += u->ext_id;
- memset(buffer_get_space_unsafe(map->hdr_copy_buf,
- einfo->hdr_offset, einfo->hdr_size),
- 0, einfo->hdr_size);
+ memset(buffer_get_space_unsafe(map->hdr_copy_buf, ext->hdr_offset,
+ ext->hdr_size), 0, ext->hdr_size);
map->hdr = map->hdr_copy_buf->data;
for (i = 0; i < view->messages_count; i++) {
rec = MAIL_INDEX_MAP_IDX(view->map, i);
- memset(PTR_OFFSET(rec, einfo->record_offset), 0,
- einfo->record_size);
+ memset(PTR_OFFSET(rec, ext->record_offset), 0,
+ ext->record_size);
}
return 1;
}
-static int
-sync_extra_hdr_update(const struct mail_transaction_extra_hdr_update *u,
- void *context)
+static int sync_ext_hdr_update(const struct mail_transaction_ext_hdr_update *u,
+ void *context)
{
struct mail_index_sync_map_ctx *ctx = context;
struct mail_index_map *map = ctx->view->map;
- const struct mail_index_extra_record_info *einfo;
+ const struct mail_index_ext *ext;
- if (map->extra_infos == NULL ||
- u->data_id >= map->extra_infos->used / sizeof(*einfo)) {
+ if (map->extensions == NULL ||
+ u->ext_id >= map->extensions->used / sizeof(*ext)) {
mail_transaction_log_view_set_corrupted(ctx->view->log_view,
- "Extra header update for unknown data id %u",
- u->data_id);
+ "Extension header update for unknown id %u", u->ext_id);
return -1;
}
- einfo = map->extra_infos->data;
- einfo += u->data_id;
+ ext = map->extensions->data;
+ ext += u->ext_id;
- buffer_write(map->hdr_copy_buf, einfo->hdr_offset + u->offset,
+ buffer_write(map->hdr_copy_buf, ext->hdr_offset + u->offset,
u + 1, u->size);
map->hdr = map->hdr_copy_buf->data;
return 1;
}
static int
-sync_extra_rec_update(const struct mail_transaction_extra_rec_header *hdr,
- const struct mail_transaction_extra_rec_update *u,
- void *context)
+sync_ext_rec_update(const struct mail_transaction_ext_rec_header *hdr,
+ const struct mail_transaction_ext_rec_update *u,
+ void *context)
{
struct mail_index_sync_map_ctx *ctx = context;
struct mail_index_view *view = ctx->view;
struct mail_index_record *rec;
- const struct mail_index_extra_record_info *einfo;
+ const struct mail_index_ext *ext;
uint32_t seq;
- if (view->map->extra_infos == NULL ||
- hdr->data_id >= view->map->extra_infos->used / sizeof(*einfo)) {
+ if (view->map->extensions == NULL ||
+ hdr->ext_id >= view->map->extensions->used / sizeof(*ext)) {
mail_transaction_log_view_set_corrupted(view->log_view,
- "Extra record update for unknown data id %u",
- hdr->data_id);
+ "Extension update for unknown id %u", hdr->ext_id);
return -1;
}
@@ -422,12 +416,12 @@
return -1;
if (seq != 0) {
- einfo = view->map->extra_infos->data;
- einfo += hdr->data_id;
+ ext = view->map->extensions->data;
+ ext += hdr->ext_id;
rec = MAIL_INDEX_MAP_IDX(view->map, seq-1);
- memcpy(PTR_OFFSET(rec, einfo->record_offset),
- u + 1, einfo->record_size);
+ memcpy(PTR_OFFSET(rec, ext->record_offset),
+ u + 1, ext->record_size);
}
return 1;
}
@@ -620,16 +614,15 @@
ret = -1;
break;
}
- if ((thdr->type & MAIL_TRANSACTION_EXTRA_INTRO) != 0) {
- const struct mail_index_extra_record_info *einfo;
+ if ((thdr->type & MAIL_TRANSACTION_EXT_INTRO) != 0) {
+ const struct mail_index_ext *ext;
size_t size;
- einfo = buffer_get_data(map->extra_infos, &size);
- einfo += (size / sizeof(*einfo)) - 1;
+ ext = buffer_get_data(map->extensions, &size);
+ ext += (size / sizeof(*ext)) - 1;
- map = mail_index_map_to_memory(map,
- einfo->record_offset +
- einfo->record_size);
+ map = mail_index_map_to_memory(map, ext->record_offset +
+ ext->record_size);
mail_index_sync_replace_map(view, map);
}
}
@@ -690,6 +683,6 @@
struct mail_transaction_map_functions mail_index_map_sync_funcs = {
sync_expunge, sync_append, sync_flag_update,
sync_cache_reset, sync_cache_update, sync_header_update,
- sync_extra_intro, sync_extra_reset,
- sync_extra_hdr_update, sync_extra_rec_update
+ sync_ext_intro, sync_ext_reset,
+ sync_ext_hdr_update, sync_ext_rec_update
};
Index: mail-index-transaction-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction-private.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mail-index-transaction-private.h 12 Sep 2004 10:34:57 -0000 1.12
+++ mail-index-transaction-private.h 26 Sep 2004 14:15:54 -0000 1.13
@@ -19,9 +19,9 @@
unsigned char hdr_change[sizeof(struct mail_index_header)];
unsigned char hdr_mask[sizeof(struct mail_index_header)];
- buffer_t *extra_rec_updates; /* buffer[] */
- buffer_t *extra_intros;
- uint32_t extra_intros_max_id;
+ buffer_t *ext_rec_updates; /* buffer[] */
+ buffer_t *ext_intros;
+ uint32_t ext_intros_max_id;
uint32_t new_cache_file_seq, last_cache_file_seq;
buffer_t *cache_updates;
Index: mail-index-transaction-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction-view.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mail-index-transaction-view.c 15 Sep 2004 13:02:33 -0000 1.5
+++ mail-index-transaction-view.c 26 Sep 2004 14:15:54 -0000 1.6
@@ -134,35 +134,35 @@
return 0;
}
-static int _tview_lookup_extra(struct mail_index_view *view, uint32_t seq,
- uint32_t data_id, const void **data_r)
+static int _tview_lookup_ext(struct mail_index_view *view, uint32_t seq,
+ uint32_t ext_id, const void **data_r)
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
- const struct mail_index_extra_record_info *einfo;
- buffer_t *const *extra_bufs;
+ const struct mail_index_ext *ext;
+ buffer_t *const *ext_bufs;
size_t size, pos;
if (seq < tview->t->first_new_seq)
- return tview->parent->lookup_extra(view, seq, data_id, data_r);
+ return tview->parent->lookup_ext(view, seq, ext_id, data_r);
i_assert(seq <= tview->t->last_new_seq);
- i_assert(data_id < view->index->extra_infos->used / sizeof(*einfo));
+ i_assert(ext_id < view->index->extensions->used / sizeof(*ext));
- einfo = view->index->extra_infos->data;
- einfo += data_id;
+ ext = view->index->extensions->data;
+ ext += ext_id;
- extra_bufs = buffer_get_data(tview->t->extra_rec_updates, &size);
- size /= sizeof(*extra_bufs);
+ ext_bufs = buffer_get_data(tview->t->ext_rec_updates, &size);
+ size /= sizeof(*ext_bufs);
- if (size <= data_id || extra_bufs[data_id] == NULL ||
- !mail_index_seq_buffer_lookup(extra_bufs[data_id], seq,
- einfo->record_size, &pos)) {
+ if (size <= ext_id || ext_bufs[ext_id] == NULL ||
+ !mail_index_seq_buffer_lookup(ext_bufs[ext_id], seq,
+ ext->record_size, &pos)) {
*data_r = NULL;
return 1;
}
- *data_r = CONST_PTR_OFFSET(extra_bufs[data_id]->data, pos);
+ *data_r = CONST_PTR_OFFSET(ext_bufs[ext_id]->data, pos);
return 1;
}
@@ -174,7 +174,7 @@
_tview_lookup_uid,
_tview_lookup_uid_range,
_tview_lookup_first,
- _tview_lookup_extra
+ _tview_lookup_ext
};
struct mail_index_view *
Index: mail-index-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- mail-index-transaction.c 23 Sep 2004 10:18:08 -0000 1.28
+++ mail-index-transaction.c 26 Sep 2004 14:15:54 -0000 1.29
@@ -38,15 +38,15 @@
mail_index_view_transaction_unref(t->view);
- if (t->extra_rec_updates != NULL) {
- recs = buffer_get_modifyable_data(t->extra_rec_updates, &size);
+ if (t->ext_rec_updates != NULL) {
+ recs = buffer_get_modifyable_data(t->ext_rec_updates, &size);
size /= sizeof(*recs);
for (i = 0; i < size; i++) {
if (recs[i] != NULL)
buffer_free(recs[i]);
}
- buffer_free(t->extra_rec_updates);
+ buffer_free(t->ext_rec_updates);
}
if (t->appends != NULL)
@@ -57,8 +57,8 @@
buffer_free(t->updates);
if (t->cache_updates != NULL)
buffer_free(t->cache_updates);
- if (t->extra_intros != NULL)
- buffer_free(t->extra_intros);
+ if (t->ext_intros != NULL)
+ buffer_free(t->ext_intros);
i_free(t);
}
@@ -110,17 +110,16 @@
mail_index_transaction_convert_to_uids(struct mail_index_transaction *t)
{
struct mail_index *index = t->view->index;
- const struct mail_index_extra_record_info *einfos;
+ const struct mail_index_ext *extensions;
buffer_t **updates;
size_t i, size;
if (mail_index_view_lock(t->view) < 0)
return -1;
- if (t->extra_rec_updates != NULL) {
- einfos = buffer_get_data(index->extra_infos, NULL);
- updates = buffer_get_modifyable_data(t->extra_rec_updates,
- &size);
+ if (t->ext_rec_updates != NULL) {
+ extensions = buffer_get_data(index->extensions, NULL);
+ updates = buffer_get_modifyable_data(t->ext_rec_updates, &size);
size /= sizeof(*updates);
for (i = 0; i < size; i++) {
@@ -128,7 +127,7 @@
continue;
mail_index_buffer_convert_to_uids(t, updates[i],
- sizeof(uint32_t) + einfos[i].record_size,
+ sizeof(uint32_t) + extensions[i].record_size,
FALSE);
}
}
@@ -658,32 +657,31 @@
return TRUE;
}
-void mail_index_update_extra_rec(struct mail_index_transaction *t,
- uint32_t seq, uint32_t data_id,
- const void *data)
+void mail_index_update_ext(struct mail_index_transaction *t,
+ uint32_t seq, uint32_t ext_id, const void *data)
{
struct mail_index *index = t->view->index;
+ const struct mail_index_ext *ext;
buffer_t **buf;
- const struct mail_index_extra_record_info *einfo;
i_assert(seq > 0 &&
(seq <= mail_index_view_get_message_count(t->view) ||
seq <= t->last_new_seq));
- i_assert(data_id < index->extra_infos->used / sizeof(*einfo));
+ i_assert(ext_id < index->extensions->used / sizeof(*ext));
t->log_updates = TRUE;
- einfo = index->extra_infos->data;
- einfo += data_id;
+ ext = index->extensions->data;
+ ext += ext_id;
- if (t->extra_rec_updates == NULL) {
- t->extra_rec_updates =
+ if (t->ext_rec_updates == NULL) {
+ t->ext_rec_updates =
buffer_create_dynamic(default_pool, 128, (size_t)-1);
}
- buf = buffer_get_space_unsafe(t->extra_rec_updates,
- data_id * sizeof(buffer_t *),
+ buf = buffer_get_space_unsafe(t->ext_rec_updates,
+ ext_id * sizeof(buffer_t *),
sizeof(buffer_t *));
- mail_index_update_seq_buffer(buf, seq, data, einfo->record_size, NULL);
+ mail_index_update_seq_buffer(buf, seq, data, ext->record_size, NULL);
}
void mail_index_update_header(struct mail_index_transaction *t,
Index: mail-index-view-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view-private.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mail-index-view-private.h 5 Sep 2004 17:53:45 -0000 1.9
+++ mail-index-view-private.h 26 Sep 2004 14:15:54 -0000 1.10
@@ -18,8 +18,8 @@
uint32_t *first_seq_r, uint32_t *last_seq_r);
int (*lookup_first)(struct mail_index_view *view, enum mail_flags flags,
uint8_t flags_mask, uint32_t *seq_r);
- int (*lookup_extra)(struct mail_index_view *view, uint32_t seq,
- uint32_t data_id, const void **data_r);
+ int (*lookup_ext)(struct mail_index_view *view, uint32_t seq,
+ uint32_t ext_id, const void **data_r);
};
struct mail_index_view {
Index: mail-index-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mail-index-view.c 5 Sep 2004 17:53:45 -0000 1.20
+++ mail-index-view.c 26 Sep 2004 14:15:54 -0000 1.21
@@ -407,10 +407,10 @@
return 0;
}
-static int _view_lookup_extra(struct mail_index_view *view, uint32_t seq,
- uint32_t data_id, const void **data_r)
+static int _view_lookup_ext(struct mail_index_view *view, uint32_t seq,
+ uint32_t ext_id, const void **data_r)
{
- const struct mail_index_extra_record_info *einfo;
+ const struct mail_index_ext *ext;
const struct mail_index_record *rec;
struct mail_index_map *map;
uint32_t idx, offset;
@@ -420,15 +420,15 @@
return -1;
if (rec == NULL ||
- !mail_index_map_get_extra_info_idx(view->map, data_id, &idx)) {
+ !mail_index_map_get_ext_idx(view->map, ext_id, &idx)) {
*data_r = NULL;
return ret;
}
- einfo = view->map->extra_infos->data;
- einfo += idx;
+ ext = view->map->extensions->data;
+ ext += idx;
- offset = einfo->record_offset;
+ offset = ext->record_offset;
*data_r = offset == 0 ? NULL : CONST_PTR_OFFSET(rec, offset);
return ret;
}
@@ -484,10 +484,10 @@
return view->methods.lookup_first(view, flags, flags_mask, seq_r);
}
-int mail_index_lookup_extra(struct mail_index_view *view, uint32_t seq,
- uint32_t data_id, const void **data_r)
+int mail_index_lookup_ext(struct mail_index_view *view, uint32_t seq,
+ uint32_t ext_id, const void **data_r)
{
- return view->methods.lookup_extra(view, seq, data_id, data_r);
+ return view->methods.lookup_ext(view, seq, ext_id, data_r);
}
static struct mail_index_view_methods view_methods = {
@@ -498,7 +498,7 @@
_view_lookup_uid,
_view_lookup_uid_range,
_view_lookup_first,
- _view_lookup_extra
+ _view_lookup_ext
};
struct mail_index_view *mail_index_view_open(struct mail_index *index)
Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -d -r1.148 -r1.149
--- mail-index.c 23 Sep 2004 20:26:59 -0000 1.148
+++ mail-index.c 26 Sep 2004 14:15:54 -0000 1.149
@@ -26,11 +26,9 @@
index->prefix = i_strdup(prefix);
index->fd = -1;
- index->extra_infos_pool =
- pool_alloconly_create("extra_infos_pool", 256);
- index->extra_infos =
- buffer_create_dynamic(index->extra_infos_pool,
- 64, (size_t)-1);
+ index->extension_pool = pool_alloconly_create("extension", 256);
+ index->extensions =
+ buffer_create_dynamic(index->extension_pool, 64, (size_t)-1);
index->mode = 0600;
index->gid = (gid_t)-1;
@@ -40,7 +38,7 @@
void mail_index_free(struct mail_index *index)
{
mail_index_close(index);
- pool_unref(index->extra_infos_pool);
+ pool_unref(index->extension_pool);
i_free(index->error);
i_free(index->dir);
@@ -55,23 +53,22 @@
index->gid = gid;
}
-uint32_t mail_index_register_record_extra(struct mail_index *index,
- const char *name, uint32_t hdr_size,
- uint16_t record_size)
+uint32_t mail_index_ext_register(struct mail_index *index, const char *name,
+ uint32_t hdr_size, uint16_t record_size)
{
- const struct mail_index_extra_record_info *einfos;
- struct mail_index_extra_record_info info;
- size_t extra_count;
+ const struct mail_index_ext *extensions;
+ struct mail_index_ext ext;
+ size_t ext_count;
unsigned int i;
- einfos = buffer_get_data(index->extra_infos, &extra_count);
- extra_count /= sizeof(*einfos);
+ extensions = buffer_get_data(index->extensions, &ext_count);
+ ext_count /= sizeof(*extensions);
/* see if it's there already */
- for (i = 0; i < extra_count; i++) {
- if (strcmp(einfos[i].name, name) == 0) {
- i_assert(einfos[i].hdr_size == hdr_size);
- i_assert(einfos[i].record_size == record_size);
+ for (i = 0; i < ext_count; i++) {
+ if (strcmp(extensions[i].name, name) == 0) {
+ i_assert(extensions[i].hdr_size == hdr_size);
+ i_assert(extensions[i].record_size == record_size);
return i;
}
}
@@ -79,111 +76,102 @@
i_assert(hdr_size % 4 == 0);
i_assert(record_size % 4 == 0);
- memset(&info, 0, sizeof(info));
- info.name = p_strdup(index->extra_infos_pool, name);
- info.hdr_size = hdr_size;
- info.record_size = record_size;
+ memset(&ext, 0, sizeof(ext));
+ ext.name = p_strdup(index->extension_pool, name);
+ ext.hdr_size = hdr_size;
+ ext.record_size = record_size;
- buffer_append(index->extra_infos, &info, sizeof(info));
- return extra_count;
+ buffer_append(index->extensions, &ext, sizeof(ext));
+ return ext_count;
}
-static void mail_index_map_create_extra_infos(struct mail_index_map *map,
- unsigned int initial_count)
+static void mail_index_map_init_extbufs(struct mail_index_map *map,
+ unsigned int initial_count)
{
- size_t extra_infos_size, extra_infos_id_map_size, size;
+ size_t ext_size, ext_id_map_size, size;
- extra_infos_size = initial_count *
- sizeof(struct mail_index_extra_record_info);
- extra_infos_id_map_size = initial_count * sizeof(uint32_t);
- if (map->extra_records_pool == NULL) {
- size = extra_infos_size + extra_infos_id_map_size +
- initial_count * 20;
- map->extra_records_pool =
- pool_alloconly_create("extra_infos",
+ ext_size = initial_count * sizeof(struct mail_index_ext);
+ ext_id_map_size = initial_count * sizeof(uint32_t);
+ if (map->extension_pool == NULL) {
+ size = ext_size + ext_id_map_size +
+ (initial_count * 20); /* for names */
+ map->extension_pool =
+ pool_alloconly_create("extensions",
nearest_power(size));
+ } else {
+ p_clear(map->extension_pool);
}
- map->extra_infos = buffer_create_dynamic(map->extra_records_pool,
- extra_infos_size, (size_t)-1);
- map->extra_infos_id_map = buffer_create_dynamic(map->extra_records_pool,
- extra_infos_id_map_size,
- (size_t)-1);
+ map->extensions = buffer_create_dynamic(map->extension_pool,
+ ext_size, (size_t)-1);
+ map->ext_id_map = buffer_create_dynamic(map->extension_pool,
+ ext_id_map_size, (size_t)-1);
}
-uint32_t mail_index_map_register_extra_info(struct mail_index *index,
- struct mail_index_map *map,
- const char *name,
- uint32_t hdr_offset,
- uint32_t hdr_size,
- uint32_t record_size)
+uint32_t mail_index_map_register_ext(struct mail_index *index,
+ struct mail_index_map *map,
+ const char *name, uint32_t hdr_offset,
+ uint32_t hdr_size, uint32_t record_size)
{
- const struct mail_index_extra_record_info *last_einfo;
- struct mail_index_extra_record_info *einfo;
+ const struct mail_index_ext *last_ext;
+ struct mail_index_ext *ext;
size_t size;
- uint32_t idx, data_id;
+ uint32_t idx, ext_id;
- if (map->extra_infos == NULL) {
- mail_index_map_create_extra_infos(map, 5);
- last_einfo = NULL;
+ if (map->extensions == NULL) {
+ mail_index_map_init_extbufs(map, 5);
+ last_ext = NULL;
idx = 0;
} else {
- last_einfo = buffer_get_data(map->extra_infos, &size);
- idx = size / sizeof(*last_einfo);
+ last_ext = buffer_get_data(map->extensions, &size);
+ idx = size / sizeof(*last_ext);
if (idx == 0)
- last_einfo = NULL;
+ last_ext = NULL;
else
- last_einfo += idx - 1;
+ last_ext += idx - 1;
}
- einfo = buffer_append_space_unsafe(map->extra_infos, sizeof(*einfo));
- memset(einfo, 0, sizeof(*einfo));
+ ext = buffer_append_space_unsafe(map->extensions, sizeof(*ext));
+ memset(ext, 0, sizeof(*ext));
- einfo->name = p_strdup(map->extra_records_pool, name);
- einfo->hdr_offset = hdr_offset;
- einfo->hdr_size = hdr_size;
- einfo->record_size = record_size;
+ ext->name = p_strdup(map->extension_pool, name);
+ ext->hdr_offset = hdr_offset;
+ ext->hdr_size = hdr_size;
+ ext->record_size = record_size;
- if (last_einfo != NULL) {
- einfo->record_offset = last_einfo->record_offset +
- last_einfo->record_size;
+ if (last_ext != NULL) {
+ ext->record_offset = last_ext->record_offset +
+ last_ext->record_size;
} else {
- einfo->record_offset = sizeof(struct mail_index_record);
+ ext->record_offset = sizeof(struct mail_index_record);
}
- data_id = mail_index_register_record_extra(index, name,
- hdr_size, record_size);
- buffer_write(map->extra_infos_id_map, data_id * sizeof(uint32_t),
+ ext_id = mail_index_ext_register(index, name, hdr_size, record_size);
+ buffer_write(map->ext_id_map, ext_id * sizeof(uint32_t),
&idx, sizeof(idx));
return idx;
}
-static int mail_index_read_extra_infos(struct mail_index *index,
- struct mail_index_map *map)
+static int mail_index_read_extensions(struct mail_index *index,
+ struct mail_index_map *map)
{
- const struct mail_index_extra_record_info_header *einfo_hdr;
+ const struct mail_index_ext_header *ext_hdr;
unsigned int i, old_count;
const char *name;
- uint32_t data_id, offset, name_offset;
+ uint32_t ext_id, offset, name_offset;
offset = map->hdr->base_header_size;
- if (offset == map->hdr->header_size &&
- map->extra_records_pool == NULL) {
+ if (offset == map->hdr->header_size && map->extension_pool == NULL) {
/* nothing to do, skip allocatations and all */
return 1;
}
- old_count = index->extra_infos->used /
- sizeof(struct mail_index_extra_record_info);
+ old_count = index->extensions->used / sizeof(struct mail_index_ext);
+ mail_index_map_init_extbufs(map, old_count + 5);
- if (map->extra_records_pool != NULL)
- p_clear(map->extra_records_pool);
- mail_index_map_create_extra_infos(map, old_count + 5);
- data_id = (uint32_t)-1;
- for (i = 0; i < old_count; i++) {
- buffer_append(map->extra_infos_id_map,
- &data_id, sizeof(data_id));
- }
+ ext_id = (uint32_t)-1;
+ for (i = 0; i < old_count; i++)
+ buffer_append(map->ext_id_map, &ext_id, sizeof(ext_id));
name = map->hdr_base;
while (offset < map->hdr->header_size) {
@@ -201,10 +189,10 @@
while (offset < map->hdr->header_size && (offset % 4) != 0)
offset++;
- einfo_hdr = CONST_PTR_OFFSET(map->hdr_base, offset);
+ ext_hdr = CONST_PTR_OFFSET(map->hdr_base, offset);
- if (offset + sizeof(*einfo_hdr) > map->hdr->header_size ||
- offset + sizeof(*einfo_hdr) + einfo_hdr->hdr_size >
+ if (offset + sizeof(*ext_hdr) > map->hdr->header_size ||
+ offset + sizeof(*ext_hdr) + ext_hdr->hdr_size >
map->hdr->header_size) {
mail_index_set_error(index, "Corrupted index file %s: "
"Header extension goes outside header",
@@ -212,13 +200,12 @@
return -1;
}
- mail_index_map_register_extra_info(index, map,
- name + name_offset,
- offset + sizeof(*einfo_hdr),
- einfo_hdr->hdr_size,
- einfo_hdr->record_size);
+ mail_index_map_register_ext(index, map, name + name_offset,
+ offset + sizeof(*ext_hdr),
+ ext_hdr->hdr_size,
+ ext_hdr->record_size);
- offset += sizeof(*einfo_hdr) + einfo_hdr->hdr_size;
+ offset += sizeof(*ext_hdr) + ext_hdr->hdr_size;
}
return 1;
}
@@ -286,7 +273,7 @@
hdr->first_deleted_uid_lowwater > hdr->next_uid)
return 0;
- return mail_index_read_extra_infos(index, map);
+ return mail_index_read_extensions(index, map);
}
static void mail_index_map_clear(struct mail_index *index,
@@ -319,8 +306,8 @@
i_assert(map->refcount == 0);
mail_index_map_clear(index, map);
- if (map->extra_records_pool != NULL)
- pool_unref(map->extra_records_pool);
+ if (map->extension_pool != NULL)
+ pool_unref(map->extension_pool);
buffer_free(map->hdr_copy_buf);
i_free(map);
}
@@ -632,7 +619,7 @@
{
struct mail_index_map *mem_map;
struct mail_index_header *hdr;
- struct mail_index_extra_record_info *einfos;
+ struct mail_index_ext *extensions;
void *src, *dest;
size_t size, copy_size;
unsigned int i, count;
@@ -673,38 +660,39 @@
hdr->record_size = new_record_size;
mem_map->hdr = hdr;
- /* copy extra_infos */
- if (map->extra_infos_id_map != NULL) {
- count = map->extra_infos_id_map->used / sizeof(uint32_t);
- mail_index_map_create_extra_infos(mem_map, count);
+ /* copy extensions */
+ if (map->ext_id_map != NULL) {
+ count = map->ext_id_map->used / sizeof(uint32_t);
+ mail_index_map_init_extbufs(mem_map, count);
- buffer_append_buf(mem_map->extra_infos, map->extra_infos,
+ buffer_append_buf(mem_map->extensions, map->extensions,
+ 0, (size_t)-1);
+ buffer_append_buf(mem_map->ext_id_map, map->ext_id_map,
0, (size_t)-1);
- buffer_append_buf(mem_map->extra_infos_id_map,
- map->extra_infos_id_map, 0, (size_t)-1);
/* fix the name pointers to use our own pool */
- einfos = buffer_get_modifyable_data(mem_map->extra_infos, NULL);
+ extensions = buffer_get_modifyable_data(mem_map->extensions,
+ NULL);
for (i = 0; i < count; i++) {
- einfos[i].name = p_strdup(mem_map->extra_records_pool,
- einfos[i].name);
+ extensions[i].name = p_strdup(mem_map->extension_pool,
+ extensions[i].name);
}
}
return mem_map;
}
-int mail_index_map_get_extra_info_idx(struct mail_index_map *map,
- uint32_t data_id, uint32_t *idx_r)
+int mail_index_map_get_ext_idx(struct mail_index_map *map,
+ uint32_t ext_id, uint32_t *idx_r)
{
const uint32_t *id_map;
- if (map->extra_infos_id_map == NULL ||
- map->extra_infos_id_map->used / sizeof(*id_map) <= data_id)
+ if (map->ext_id_map == NULL ||
+ map->ext_id_map->used / sizeof(*id_map) <= ext_id)
return 0;
- id_map = map->extra_infos_id_map->data;
- *idx_r = id_map[data_id];
+ id_map = map->ext_id_map->data;
+ *idx_r = id_map[ext_id];
return *idx_r != (uint32_t)-1;
}
Index: mail-index.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- mail-index.h 21 Sep 2004 14:40:06 -0000 1.128
+++ mail-index.h 26 Sep 2004 14:15:55 -0000 1.129
@@ -140,12 +140,10 @@
void mail_index_set_permissions(struct mail_index *index,
mode_t mode, gid_t gid);
-/* register extra data to be used in mail_index_record. name is a unique
- identifier for the data. if same name is tried to be registered multiple
- times, the rest are ignored. returns identifier for the name. */
-uint32_t mail_index_register_record_extra(struct mail_index *index,
- const char *name, uint32_t hdr_size,
- uint16_t record_size);
+/* register index extension. name is a unique identifier for the extension.
+ returns identifier for the name. */
+uint32_t mail_index_ext_register(struct mail_index *index, const char *name,
+ uint32_t hdr_size, uint16_t record_size);
int mail_index_open(struct mail_index *index, enum mail_index_open_flags flags);
void mail_index_close(struct mail_index *index);
@@ -258,10 +256,10 @@
mail_index_lookup()->uid. */
int mail_index_lookup_uid(struct mail_index_view *view, uint32_t seq,
uint32_t *uid_r);
-/* Returns the wanted extra data for given message. If it doesn't exist,
+/* Returns the wanted extension record for given message. If it doesn't exist,
*data_r is set to NULL. Return values are same as for mail_index_lookup(). */
-int mail_index_lookup_extra(struct mail_index_view *view, uint32_t seq,
- uint32_t data_id, const void **data_r);
+int mail_index_lookup_ext(struct mail_index_view *view, uint32_t seq,
+ uint32_t ext_id, const void **data_r);
/* Convert UID range to sequence range. If no UIDs are found, sequences are
set to 0. Note that any of the returned sequences may have been expunged
already. */
@@ -290,10 +288,9 @@
/* Update field in header. */
void mail_index_update_header(struct mail_index_transaction *t,
size_t offset, const void *data, size_t size);
-/* Update extra record field. */
-void mail_index_update_extra_rec(struct mail_index_transaction *t,
- uint32_t seq, uint32_t data_id,
- const void *data);
+/* Update extension record. */
+void mail_index_update_ext(struct mail_index_transaction *t,
+ uint32_t seq, uint32_t ext_id, const void *data);
/* Returns the last error code. */
enum mail_index_error mail_index_get_last_error(struct mail_index *index);
Index: mail-transaction-log-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log-view.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- mail-transaction-log-view.c 12 Sep 2004 12:14:19 -0000 1.28
+++ mail-transaction-log-view.c 26 Sep 2004 14:15:55 -0000 1.29
@@ -22,7 +22,7 @@
uint32_t prev_file_seq;
uoff_t prev_file_offset;
- uint32_t max_extra_data_id;
+ uint32_t max_ext_id;
unsigned int broken:1;
};
@@ -333,36 +333,36 @@
"extra bits in header type: 0x%x",
hdr->type & MAIL_TRANSACTION_TYPE_MASK);
return -1;
- } else if (hdr->type == MAIL_TRANSACTION_EXTRA_INTRO) {
- const struct mail_transaction_extra_intro *intro = data;
+ } else if (hdr->type == MAIL_TRANSACTION_EXT_INTRO) {
+ const struct mail_transaction_ext_intro *intro = data;
- if (intro->data_id > view->max_extra_data_id)
- view->max_extra_data_id = intro->data_id;
+ if (intro->ext_id > view->max_ext_id)
+ view->max_ext_id = intro->ext_id;
if (intro->name_size >
hdr_size - sizeof(*hdr) - sizeof(*intro)) {
mail_transaction_log_file_set_corrupted(file,
- "extra intro: name_size too large");
+ "extension intro: name_size too large");
return -1;
}
- } else if (hdr->type == MAIL_TRANSACTION_EXTRA_REC_UPDATE ||
- hdr->type == MAIL_TRANSACTION_EXTRA_HDR_UPDATE ||
- hdr->type == MAIL_TRANSACTION_EXTRA_RESET) {
- const uint32_t *data_id = data;
- uint32_t max_data_id;
+ } else if (hdr->type == MAIL_TRANSACTION_EXT_REC_UPDATE ||
+ hdr->type == MAIL_TRANSACTION_EXT_HDR_UPDATE ||
+ hdr->type == MAIL_TRANSACTION_EXT_RESET) {
+ const uint32_t *ext_id = data;
+ uint32_t max_ext_id;
- max_data_id = view->log->index->map->extra_infos == NULL ? 0 :
- (view->log->index->map->extra_infos->used /
- sizeof(struct mail_index_extra_record_info));
- if (view->max_extra_data_id > max_data_id)
- max_data_id = view->max_extra_data_id;
+ max_ext_id = view->log->index->map->extensions == NULL ? 0 :
+ (view->log->index->map->extensions->used /
+ sizeof(struct mail_index_ext));
+ if (view->max_ext_id > max_ext_id)
+ max_ext_id = view->max_ext_id;
/* don't check this error if we're just skipping over this.
- we could have skipped over the extra_intro just before this
+ we could have skipped over the ext_intro just before this
which is the reason we don't yet know it. */
- if (*data_id >= max_data_id && (type_mask & hdr->type) != 0) {
+ if (*ext_id >= max_ext_id && (type_mask & hdr->type) != 0) {
mail_transaction_log_file_set_corrupted(file,
- "extra record update out of range (%u >= %u)",
- *data_id, max_data_id);
+ "extension update out of range (%u >= %u)",
+ *ext_id, max_ext_id);
return -1;
}
}
Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- mail-transaction-log.c 20 Sep 2004 20:42:00 -0000 1.59
+++ mail-transaction-log.c 26 Sep 2004 14:15:55 -0000 1.60
@@ -970,36 +970,35 @@
}
static void
-transaction_save_extra_intro(struct mail_index_transaction *t,
- const struct mail_transaction_extra_intro *intro)
+transaction_save_ext_intro(struct mail_index_transaction *t,
+ const struct mail_transaction_ext_intro *intro)
{
const char *name;
void *p;
- uint32_t data_id;
+ uint32_t ext_id;
size_t pos;
- if (t->extra_intros == NULL) {
- t->extra_intros =
- buffer_create_dynamic(default_pool, 128, (size_t)-1);
+ if (t->ext_intros == NULL) {
+ t->ext_intros = buffer_create_dynamic(default_pool,
+ 128, (size_t)-1);
}
t_push();
name = t_strndup((const char *)(intro+1), intro->name_size);
- data_id = mail_index_register_record_extra(t->view->index, name,
- intro->hdr_size,
- intro->record_size);
- pos = data_id * sizeof(intro->data_id);
- if (pos > t->extra_intros->used) {
+ ext_id = mail_index_ext_register(t->view->index, name,
+ intro->hdr_size, intro->record_size);
+ pos = ext_id * sizeof(intro->ext_id);
+ if (pos > t->ext_intros->used) {
/* unused records are -1 */
- p = buffer_append_space_unsafe(t->extra_intros,
- pos - t->extra_intros->used);
- memset(p, 0xff, pos - t->extra_intros->used);
+ p = buffer_append_space_unsafe(t->ext_intros,
+ pos - t->ext_intros->used);
+ memset(p, 0xff, pos - t->ext_intros->used);
}
- buffer_write(t->extra_intros, pos,
- &intro->data_id, sizeof(intro->data_id));
- if (intro->data_id > t->extra_intros_max_id)
- t->extra_intros_max_id = intro->data_id;
+ buffer_write(t->ext_intros, pos,
+ &intro->ext_id, sizeof(intro->ext_id));
+ if (intro->ext_id > t->ext_intros_max_id)
+ t->ext_intros_max_id = intro->ext_id;
t_pop();
}
@@ -1029,10 +1028,10 @@
max_cache_file_seq = reset->new_file_seq;
break;
}
- case MAIL_TRANSACTION_EXTRA_INTRO: {
- const struct mail_transaction_extra_intro *intro = data;
+ case MAIL_TRANSACTION_EXT_INTRO: {
+ const struct mail_transaction_ext_intro *intro = data;
- transaction_save_extra_intro(t, intro);
+ transaction_save_ext_intro(t, intro);
break;
}
}
@@ -1163,46 +1162,46 @@
}
static int
-mail_transaction_log_register_extra(struct mail_transaction_log_file *file,
- struct mail_index_transaction *t,
- uint32_t data_id, uint32_t *idx_r)
+mail_transaction_log_register_ext(struct mail_transaction_log_file *file,
+ struct mail_index_transaction *t,
+ uint32_t ext_id, uint32_t *idx_r)
{
- const struct mail_index_extra_record_info *einfo;
- struct mail_transaction_extra_intro *intro;
+ const struct mail_index_ext *ext;
+ struct mail_transaction_ext_intro *intro;
const uint32_t *id_map;
buffer_t *buf;
size_t size;
int ret;
/* first check if it's already in nonsynced part of transaction log */
- if (t->extra_intros != NULL) {
- id_map = buffer_get_data(t->extra_intros, &size);
+ if (t->ext_intros != NULL) {
+ id_map = buffer_get_data(t->ext_intros, &size);
size /= sizeof(*id_map);
- if (data_id < size && id_map[data_id] != (uint32_t)-1) {
- *idx_r = id_map[data_id];
+ if (ext_id < size && id_map[ext_id] != (uint32_t)-1) {
+ *idx_r = id_map[ext_id];
return 0;
}
}
- *idx_r = t->extra_intros_max_id++;
+ *idx_r = t->ext_intros_max_id++;
- einfo = t->view->index->extra_infos->data;
- einfo += data_id;
+ ext = t->view->index->extensions->data;
+ ext += ext_id;
/* nope, register */
t_push();
buf = buffer_create_dynamic(pool_datastack_create(), 128, (size_t)-1);
intro = buffer_append_space_unsafe(buf, sizeof(*intro));
- intro->data_id = *idx_r;
- intro->hdr_size = einfo->hdr_size;
- intro->record_size = einfo->record_size;
- intro->name_size = strlen(einfo->name);
- buffer_append(buf, einfo->name, intro->name_size);
+ intro->ext_id = *idx_r;
+ intro->hdr_size = ext->hdr_size;
+ intro->record_size = ext->record_size;
+ intro->name_size = strlen(ext->name);
+ buffer_append(buf, ext->name, intro->name_size);
if ((buf->used % 4) != 0)
buffer_append(buf, null4, 4 - (buf->used % 4));
- ret = log_append_buffer(file, buf, NULL, MAIL_TRANSACTION_EXTRA_INTRO,
+ ret = log_append_buffer(file, buf, NULL, MAIL_TRANSACTION_EXT_INTRO,
t->view->external);
t_pop();
return ret;
@@ -1212,7 +1211,7 @@
uint32_t *log_file_seq_r,
uoff_t *log_file_offset_r)
{
- struct mail_transaction_extra_rec_header extra_rec_hdr;
+ struct mail_transaction_ext_rec_header ext_rec_hdr;
struct mail_index_view *view = t->view;
struct mail_index *index;
struct mail_transaction_log *log;
@@ -1283,13 +1282,13 @@
t->cache_updates = NULL;
}
- t->extra_intros_max_id = t->view->index->map->extra_infos == NULL ? 0 :
- (t->view->index->map->extra_infos->used /
- sizeof(struct mail_index_extra_record_info));
+ t->ext_intros_max_id = t->view->index->map->extensions == NULL ? 0 :
+ (t->view->index->map->extensions->used /
+ sizeof(struct mail_index_ext));
if (t->appends != NULL ||
(t->cache_updates != NULL && t->new_cache_file_seq == 0) ||
- (t->extra_rec_updates != NULL && t->extra_rec_updates->used > 0)) {
+ (t->ext_rec_updates != NULL && t->ext_rec_updates->used > 0)) {
if (mail_transaction_log_scan_pending(log, t) < 0) {
if (!log->index->log_locked)
mail_transaction_log_file_unlock(file);
@@ -1319,33 +1318,32 @@
view->external);
}
- if (t->extra_rec_updates == NULL) {
+ if (t->ext_rec_updates == NULL) {
updates = NULL;
size = 0;
} else {
- updates = buffer_get_modifyable_data(t->extra_rec_updates,
- &size);
+ updates = buffer_get_modifyable_data(t->ext_rec_updates, &size);
size /= sizeof(*updates);
}
hdr_buf = buffer_create_data(pool_datastack_create(),
- &extra_rec_hdr, sizeof(extra_rec_hdr));
- buffer_set_used_size(hdr_buf, sizeof(extra_rec_hdr));
+ &ext_rec_hdr, sizeof(ext_rec_hdr));
+ buffer_set_used_size(hdr_buf, sizeof(ext_rec_hdr));
for (i = 0; i < size && ret == 0; i++) {
if (updates[i] == NULL)
continue;
- if (!mail_index_map_get_extra_info_idx(index->map, i, &idx)) {
+ if (!mail_index_map_get_ext_idx(index->map, i, &idx)) {
/* new one */
- ret = mail_transaction_log_register_extra(file, t, i,
- &idx);
+ ret = mail_transaction_log_register_ext(file, t, i,
+ &idx);
if (ret < 0)
break;
}
- extra_rec_hdr.data_id = idx;
+ ext_rec_hdr.ext_id = idx;
ret = log_append_buffer(file, updates[i], hdr_buf,
- MAIL_TRANSACTION_EXTRA_REC_UPDATE,
+ MAIL_TRANSACTION_EXT_REC_UPDATE,
view->external);
}
Index: mail-transaction-log.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mail-transaction-log.h 5 Sep 2004 17:53:45 -0000 1.17
+++ mail-transaction-log.h 26 Sep 2004 14:15:55 -0000 1.18
@@ -19,10 +19,10 @@
MAIL_TRANSACTION_CACHE_RESET = 0x00000008,
MAIL_TRANSACTION_CACHE_UPDATE = 0x00000010,
MAIL_TRANSACTION_HEADER_UPDATE = 0x00000020,
- MAIL_TRANSACTION_EXTRA_INTRO = 0x00000040,
- MAIL_TRANSACTION_EXTRA_RESET = 0x00000080,
- MAIL_TRANSACTION_EXTRA_HDR_UPDATE = 0x00000100,
- MAIL_TRANSACTION_EXTRA_REC_UPDATE = 0x00000200,
+ MAIL_TRANSACTION_EXT_INTRO = 0x00000040,
+ MAIL_TRANSACTION_EXT_RESET = 0x00000080,
+ MAIL_TRANSACTION_EXT_HDR_UPDATE = 0x00000100,
+ MAIL_TRANSACTION_EXT_REC_UPDATE = 0x00000200,
MAIL_TRANSACTION_TYPE_MASK = 0x0000ffff,
@@ -68,26 +68,26 @@
/* unsigned char data[]; */
};
-struct mail_transaction_extra_intro {
- uint32_t data_id; /* must be first */
+struct mail_transaction_ext_intro {
+ uint32_t ext_id; /* must be first */
uint32_t hdr_size;
uint16_t record_size;
uint16_t name_size;
/* unsigned char name[]; */
};
-struct mail_transaction_extra_hdr_update {
- uint32_t data_id; /* must be first */
+struct mail_transaction_ext_hdr_update {
+ uint32_t ext_id; /* must be first */
uint16_t offset;
uint16_t size;
/* unsigned char data[]; */
};
-struct mail_transaction_extra_rec_header {
- uint32_t data_id; /* must be first */
+struct mail_transaction_ext_rec_header {
+ uint32_t ext_id; /* must be first */
};
-struct mail_transaction_extra_rec_update {
+struct mail_transaction_ext_rec_update {
uint32_t uid;
/* unsigned char data[]; */
};
Index: mail-transaction-util.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-util.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- mail-transaction-util.c 11 Sep 2004 18:01:10 -0000 1.18
+++ mail-transaction-util.c 26 Sep 2004 14:15:55 -0000 1.19
@@ -25,11 +25,11 @@
{ MAIL_TRANSACTION_CACHE_UPDATE, 0,
sizeof(struct mail_transaction_cache_update) },
{ MAIL_TRANSACTION_HEADER_UPDATE, 0, 1 }, /* variable size, use 1 */
- { MAIL_TRANSACTION_EXTRA_INTRO, 0, 1 },
- { MAIL_TRANSACTION_EXTRA_RESET, 0,
- sizeof(struct mail_transaction_extra_rec_header) },
- { MAIL_TRANSACTION_EXTRA_HDR_UPDATE, 0, 1 },
- { MAIL_TRANSACTION_EXTRA_REC_UPDATE, 0, 1 },
+ { MAIL_TRANSACTION_EXT_INTRO, 0, 1 },
+ { MAIL_TRANSACTION_EXT_RESET, 0,
+ sizeof(struct mail_transaction_ext_rec_header) },
+ { MAIL_TRANSACTION_EXT_HDR_UPDATE, 0, 1 },
+ { MAIL_TRANSACTION_EXT_REC_UPDATE, 0, 1 },
{ 0, 0, 0 }
};
@@ -148,11 +148,11 @@
}
break;
}
- case MAIL_TRANSACTION_EXTRA_INTRO: {
- const struct mail_transaction_extra_intro *rec = data;
+ case MAIL_TRANSACTION_EXT_INTRO: {
+ const struct mail_transaction_ext_intro *rec = data;
unsigned int i;
- if (func_map->extra_intro == NULL)
+ if (func_map->ext_intro == NULL)
break;
for (i = 0; i < hdr->size; ) {
@@ -162,7 +162,7 @@
}
rec = CONST_PTR_OFFSET(data, i);
- ret = func_map->extra_intro(rec, context);
+ ret = func_map->ext_intro(rec, context);
if (ret <= 0)
break;
@@ -170,31 +170,31 @@
}
break;
}
- case MAIL_TRANSACTION_EXTRA_RESET: {
- const struct mail_transaction_extra_rec_header *rec = data;
+ case MAIL_TRANSACTION_EXT_RESET: {
+ const struct mail_transaction_ext_rec_header *rec = data;
unsigned int i, size;
- if (func_map->extra_reset == NULL)
+ if (func_map->ext_reset == NULL)
break;
size = hdr->size / sizeof(*rec);
for (i = 0; i < size; i++) {
- ret = func_map->extra_reset(&rec[i], context);
+ ret = func_map->ext_reset(&rec[i], context);
if (ret <= 0)
break;
}
break;
}
- case MAIL_TRANSACTION_EXTRA_HDR_UPDATE: {
- const struct mail_transaction_extra_hdr_update *rec = data;
+ case MAIL_TRANSACTION_EXT_HDR_UPDATE: {
+ const struct mail_transaction_ext_hdr_update *rec = data;
unsigned int i;
- if (func_map->extra_hdr_update == NULL)
+ if (func_map->ext_hdr_update == NULL)
break;
for (i = 0; i < hdr->size; ) {
rec = CONST_PTR_OFFSET(data, i);
- ret = func_map->extra_hdr_update(rec, context);
+ ret = func_map->ext_hdr_update(rec, context);
if (ret <= 0)
break;
@@ -202,34 +202,34 @@
}
break;
}
- case MAIL_TRANSACTION_EXTRA_REC_UPDATE: {
- const struct mail_transaction_extra_rec_header *ehdr = data;
- const struct mail_transaction_extra_rec_update *rec, *end;
- const struct mail_index_extra_record_info *einfo;
+ case MAIL_TRANSACTION_EXT_REC_UPDATE: {
+ const struct mail_transaction_ext_rec_header *ehdr = data;
+ const struct mail_transaction_ext_rec_update *rec, *end;
+ const struct mail_index_ext *ext;
unsigned int record_size;
- if (func_map->extra_rec_update == NULL)
+ if (func_map->ext_rec_update == NULL)
break;
rec = CONST_PTR_OFFSET(data, sizeof(*ehdr));
- if (map->extra_infos == NULL ||
- ehdr->data_id >= map->extra_infos->used / sizeof(*einfo)) {
- /* broken. let the extra_rec_update handler do the
+ if (map->extensions == NULL ||
+ ehdr->ext_id >= map->extensions->used / sizeof(*ext)) {
+ /* broken. let the ext_rec_update handler do the
error handling. */
- ret = func_map->extra_rec_update(ehdr, rec, context);
+ ret = func_map->ext_rec_update(ehdr, rec, context);
if (ret >= 0)
i_unreached();
break;
}
- einfo = map->extra_infos->data;
- einfo += ehdr->data_id;
- record_size = sizeof(*ehdr) + einfo->record_size;
+ ext = map->extensions->data;
+ ext += ehdr->ext_id;
+ record_size = sizeof(*ehdr) + ext->record_size;
end = CONST_PTR_OFFSET(data, hdr->size);
while (rec != end) {
- ret = func_map->extra_rec_update(ehdr, rec, context);
+ ret = func_map->ext_rec_update(ehdr, rec, context);
if (ret <= 0)
break;
Index: mail-transaction-util.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-util.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mail-transaction-util.h 5 Sep 2004 17:53:45 -0000 1.9
+++ mail-transaction-util.h 26 Sep 2004 14:15:55 -0000 1.10
@@ -19,17 +19,15 @@
void *context);
int (*header_update)(const struct mail_transaction_header_update *u,
void *context);
- int (*extra_intro)(const struct mail_transaction_extra_intro *u,
- void *context);
- int (*extra_reset)(const struct mail_transaction_extra_rec_header *u,
- void *context);
- int (*extra_hdr_update)
- (const struct mail_transaction_extra_hdr_update *u,
- void *context);
- int (*extra_rec_update)
- (const struct mail_transaction_extra_rec_header *hdr,
- const struct mail_transaction_extra_rec_update *u,
- void *context);
+ int (*ext_intro)(const struct mail_transaction_ext_intro *u,
+ void *context);
+ int (*ext_reset)(const struct mail_transaction_ext_rec_header *u,
+ void *context);
+ int (*ext_hdr_update)(const struct mail_transaction_ext_hdr_update *u,
+ void *context);
+ int (*ext_rec_update)(const struct mail_transaction_ext_rec_header *hdr,
+ const struct mail_transaction_ext_rec_update *u,
+ void *context);
};
const struct mail_transaction_type_map *
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index index-storage.h, 1.78,
1.79
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-file.c, 1.4,
1.5 mbox-save.c, 1.63, 1.64 mbox-storage.c, 1.99,
1.100 mbox-sync-parse.c, 1.27, 1.28 mbox-sync.c, 1.92, 1.93
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list