~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/lib-index/mail-index-private.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
         PTR_OFFSET((map)->rec_map->records, (idx) * (map)->hdr.record_size))
40
40
 
41
41
#define MAIL_TRANSACTION_FLAG_UPDATE_IS_INTERNAL(u) \
42
 
        ((((u)->add_flags | (u)->remove_flags) & \
43
 
          MAIL_INDEX_FLAGS_MASK) == 0)
 
42
        ((((u)->add_flags | (u)->remove_flags) & MAIL_INDEX_FLAGS_MASK) == 0 && \
 
43
         (u)->modseq_inc_flag == 0)
44
44
 
45
45
#define MAIL_INDEX_EXT_KEYWORDS "keywords"
46
46
 
115
115
};
116
116
 
117
117
struct mail_index_record_map {
118
 
        ARRAY_DEFINE(maps, struct mail_index_map *);
 
118
        ARRAY(struct mail_index_map *) maps;
119
119
 
120
120
        void *mmap_base;
121
121
        size_t mmap_size, mmap_used_size;
122
 
        unsigned int lock_id;
123
122
 
124
123
        buffer_t *buffer;
125
124
 
128
127
 
129
128
        struct mail_index_map_modseq *modseq;
130
129
        uint32_t last_appended_uid;
131
 
 
132
 
        /* If this mapping is written to disk and write_atomic=FALSE,
133
 
           write_seq_* specify the message sequence range that needs to be
134
 
           written. */
135
 
        uint32_t write_seq_first, write_seq_last;
136
130
};
137
131
 
138
132
struct mail_index_map {
144
138
        buffer_t *hdr_copy_buf;
145
139
 
146
140
        pool_t extension_pool;
147
 
        ARRAY_DEFINE(extensions, struct mail_index_ext);
148
 
        ARRAY_DEFINE(ext_id_map, uint32_t); /* index -> file */
 
141
        ARRAY(struct mail_index_ext) extensions;
 
142
        ARRAY(uint32_t) ext_id_map; /* index -> file */
149
143
 
150
 
        ARRAY_DEFINE(keyword_idx_map, unsigned int); /* file -> index */
 
144
        ARRAY(unsigned int) keyword_idx_map; /* file -> index */
151
145
 
152
146
        struct mail_index_record_map *rec_map;
153
 
 
154
 
        unsigned int write_base_header:1;
155
 
        unsigned int write_ext_header:1;
156
 
        unsigned int write_atomic:1; /* write to a new file and rename() */
157
147
};
158
148
 
159
149
struct mail_index_module_register {
173
163
        unsigned int open_count;
174
164
        enum mail_index_open_flags flags;
175
165
        enum fsync_mode fsync_mode;
176
 
        enum mail_index_sync_type fsync_mask;
 
166
        enum mail_index_fsync_mask fsync_mask;
177
167
        mode_t mode;
178
168
        gid_t gid;
179
169
        char *gid_origin;
180
170
 
181
171
        pool_t extension_pool;
182
 
        ARRAY_DEFINE(extensions, struct mail_index_registered_ext);
 
172
        ARRAY(struct mail_index_registered_ext) extensions;
183
173
 
184
174
        uint32_t ext_hdr_init_id;
185
175
        void *ext_hdr_init_data;
186
176
 
187
 
        ARRAY_DEFINE(sync_lost_handlers, mail_index_sync_lost_handler_t *);
 
177
        ARRAY(mail_index_sync_lost_handler_t *) sync_lost_handlers;
188
178
 
189
179
        char *filepath;
190
180
        int fd;
209
199
        /* syncing will update this if non-NULL */
210
200
        struct mail_index_transaction_commit_result *sync_commit_result;
211
201
 
212
 
        int lock_type, shared_lock_count, excl_lock_count;
 
202
        int lock_type;
213
203
        unsigned int lock_id_counter;
214
204
        enum file_lock_method lock_method;
215
205
        unsigned int max_lock_timeout_secs;
219
209
 
220
210
        pool_t keywords_pool;
221
211
        ARRAY_TYPE(keywords) keywords;
222
 
        struct hash_table *keywords_hash; /* name -> idx */
 
212
        HASH_TABLE(char *, void *) keywords_hash; /* name -> unsigned int idx */
223
213
 
224
214
        uint32_t keywords_ext_id;
225
215
        uint32_t modseq_ext_id;
227
217
        unsigned int view_count;
228
218
 
229
219
        /* Module-specific contexts. */
230
 
        ARRAY_DEFINE(module_contexts, union mail_index_module_context *);
 
220
        ARRAY(union mail_index_module_context *) module_contexts;
231
221
 
232
222
        char *error;
233
223
        unsigned int nodiskspace:1;
277
267
void mail_index_flush_read_cache(struct mail_index *index, const char *path,
278
268
                                 int fd, bool locked);
279
269
 
280
 
/* Returns 0 = ok, -1 = error. */
281
 
int mail_index_lock_shared(struct mail_index *index, unsigned int *lock_id_r);
282
 
/* Returns 1 = ok, 0 = already locked, -1 = error. */
283
 
int mail_index_try_lock_exclusive(struct mail_index *index,
284
 
                                  unsigned int *lock_id_r);
285
 
void mail_index_unlock(struct mail_index *index, unsigned int *lock_id);
286
 
/* Returns TRUE if given lock_id is valid. */
287
 
bool mail_index_is_locked(struct mail_index *index, unsigned int lock_id);
288
 
 
289
270
int mail_index_lock_fd(struct mail_index *index, const char *path, int fd,
290
271
                       int lock_type, unsigned int timeout_secs,
291
272
                       struct file_lock **lock_r);
350
331
 
351
332
void mail_index_fsck_locked(struct mail_index *index);
352
333
 
353
 
int mail_index_set_error(struct mail_index *index, const char *fmt, ...)
 
334
void mail_index_set_error(struct mail_index *index, const char *fmt, ...)
354
335
        ATTR_FORMAT(2, 3);
355
336
/* "%s failed with index file %s: %m" */
356
 
int mail_index_set_syscall_error(struct mail_index *index,
357
 
                                 const char *function);
 
337
void mail_index_set_syscall_error(struct mail_index *index,
 
338
                                  const char *function);
358
339
/* "%s failed with file %s: %m" */
359
 
int mail_index_file_set_syscall_error(struct mail_index *index,
360
 
                                      const char *filepath,
361
 
                                      const char *function);
 
340
void mail_index_file_set_syscall_error(struct mail_index *index,
 
341
                                       const char *filepath,
 
342
                                       const char *function);
362
343
 
363
344
#endif