DEF(BOOL_HIDDEN, mailbox_list_iter_from_index_dir),
DEF(BOOL_HIDDEN, mailbox_list_drop_noselect),
DEF(BOOL_HIDDEN, mailbox_list_validate_fs_names),
+ DEF(STR, mail_volatile_path),
DEF(BOOL_HIDDEN, mail_full_filesystem_access),
DEF(BOOL, maildir_stat_dirs),
DEF(BOOL, mail_shared_explicit_inbox),
.mailbox_list_iter_from_index_dir = FALSE,
.mailbox_list_drop_noselect = TRUE,
.mailbox_list_validate_fs_names = TRUE,
+ .mail_volatile_path = "",
.mail_full_filesystem_access = FALSE,
.maildir_stat_dirs = FALSE,
.mail_shared_explicit_inbox = FALSE,
OFFSET(mail_location),
OFFSET(mailbox_list_index_prefix),
OFFSET(mailbox_list_iter_from_index_dir),
+ OFFSET(mail_volatile_path),
};
static void
bool mailbox_list_iter_from_index_dir;
bool mailbox_list_drop_noselect;
bool mailbox_list_validate_fs_names;
+ const char *mail_volatile_path;
bool mail_full_filesystem_access;
bool maildir_stat_dirs;
bool mail_shared_explicit_inbox;
set.gid = perm->file_create_gid;
set.gid_origin = perm->file_create_gid_origin;
- if (box->list->set.volatile_dir == NULL)
+ if (box->list->mail_set->mail_volatile_path[0] == '\0')
lock_path = t_strdup_printf("%s/%s", box->index->dir, lock_fname);
else {
unsigned char box_name_sha1[SHA1_RESULTLEN];
structure would be pretty troublesome. It would also make
it more difficult to perform the automated deletion of empty
lock directories. */
- str_printfa(str, "%s/%s.", box->list->set.volatile_dir,
+ str_printfa(str, "%s/%s.", box->list->mail_set->mail_volatile_path,
lock_fname);
sha1_get_digest(box->name, strlen(box->name), box_name_sha1);
binary_to_hex_append(str, box_name_sha1, sizeof(box_name_sha1));
struct mailbox_list *inbox_list =
mail_namespace_find_inbox(user->namespaces)->list;
- return inbox_list->set.volatile_dir;
+ const char *path = inbox_list->mail_set->mail_volatile_path;
+ return path[0] == '\0' ? NULL : path;
}
int mail_user_lock_file_create(struct mail_user *user, const char *lock_fname,
};
struct mailbox_list *inbox_list =
mail_namespace_find_inbox(user->namespaces)->list;
- if (inbox_list->set.volatile_dir == NULL)
+ if (inbox_list->mail_set->mail_volatile_path[0] == '\0')
path = t_strdup_printf("%s/%s", home, lock_fname);
else {
- path = t_strdup_printf("%s/%s", inbox_list->set.volatile_dir,
- lock_fname);
+ path = t_strdup_printf("%s/%s",
+ inbox_list->mail_set->mail_volatile_path,
+ lock_fname);
lock_set.mkdir_mode = 0700;
}
return mail_storage_lock_create(path, &lock_set, mail_set, lock_r, error_r);
p_strdup(list->pool, set->mailbox_dir_name);
list->set.alt_dir = p_strdup(list->pool, set->alt_dir);
list->set.alt_dir_nocheck = set->alt_dir_nocheck;
- list->set.volatile_dir = p_strdup(list->pool, set->volatile_dir);
list->set.index_control_use_maildir_name =
set->index_control_use_maildir_name;
dest = &set_r->maildir_name;
else if (strcmp(key, "MAILBOXDIR") == 0)
dest = &set_r->mailbox_dir_name;
- else if (strcmp(key, "VOLATILEDIR") == 0)
- dest = &set_r->volatile_dir;
else if (strcmp(key, "FULLDIRNAME") == 0) {
set_r->index_control_use_maildir_name = TRUE;
dest = &set_r->maildir_name;
set.gid_origin = perm.file_create_gid_origin;
lock_fname = MAILBOX_LIST_LOCK_FNAME;
- if (list->set.volatile_dir != NULL) {
- /* Use VOLATILEDIR. It's shared with all mailbox_lists, so use
- hash of the namespace prefix as a way to make this lock name
- unique across the namespaces. */
+ if (list->mail_set->mail_volatile_path[0] != '\0') {
+ /* Use volatile directory. It's shared with all mailbox_lists,
+ so use hash of the namespace prefix as a way to make this
+ lock name unique across the namespaces. */
unsigned char ns_prefix_hash[SHA1_RESULTLEN];
sha1_get_digest(list->ns->prefix, list->ns->prefix_len,
ns_prefix_hash);
lock_fname = t_strconcat(MAILBOX_LIST_LOCK_FNAME,
binary_to_hex(ns_prefix_hash, sizeof(ns_prefix_hash)), NULL);
- lock_dir = list->set.volatile_dir;
+ lock_dir = list->mail_set->mail_volatile_path;
set.mkdir_mode = 0700;
} else if (mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_INDEX,
&lock_dir)) {
const char *index_cache_dir;
const char *control_dir;
const char *alt_dir; /* FIXME: dbox-specific.. */
- /* Backend-local directory where volatile data, such as lock files,
- can be temporarily created. This setting allows specifying a
- separate directory for them to reduce disk I/O on the real storage.
- The volatile_dir can point to an in-memory filesystem. */
- const char *volatile_dir;
const char *inbox_path;
const char *subscription_fname;