]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: index/dbox-common - Replace i_<log>() with e_<log>()
authorMarco Bettini <marco.bettini@open-xchange.com>
Mon, 11 Jul 2022 07:30:58 +0000 (07:30 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Thu, 4 Aug 2022 12:05:27 +0000 (12:05 +0000)
src/lib-storage/index/dbox-common/dbox-file-fix.c
src/lib-storage/index/dbox-common/dbox-storage.c

index 55a829b0e60d1a2e852245274ad907b944c8b66b..b61e030563a684c0c5b321f61333be8f9eda36b6 100644 (file)
@@ -446,6 +446,7 @@ dbox_file_fix_write_stream(struct dbox_file *file, uoff_t start_offset,
 
 int dbox_file_fix(struct dbox_file *file, uoff_t start_offset)
 {
+       struct event *event = file->storage->storage.event;
        struct ostream *output;
        const char *dir, *p, *temp_path, *broken_path;
        bool deleted, have_messages;
@@ -490,7 +491,7 @@ int dbox_file_fix(struct dbox_file *file, uoff_t start_offset)
                                          "link(%s, %s) failed: %m",
                                          file->cur_path, broken_path);
        } else {
-               i_warning("dbox: Copy of the broken file saved to %s",
+               e_warning(event, "Copy of the broken file saved to %s",
                          broken_path);
        }
        if (!have_messages) {
index 5cac0d65eaa0958a9494751727a6bfb574ae3cbc..a24442f5dd48da1f954fcd4b0644a25de94ef018 100644 (file)
@@ -31,20 +31,22 @@ void dbox_storage_get_list_settings(const struct mail_namespace *ns ATTR_UNUSED,
 
 static bool
 dbox_alt_path_has_changed(const char *root_dir, const char *alt_path,
-                         const char *alt_path2, const char *alt_symlink_path)
+                         const char *alt_path2, const char *alt_symlink_path,
+                         struct event *event)
 {
        const char *linkpath, *error;
 
        if (t_readlink(alt_symlink_path, &linkpath, &error) < 0) {
                if (errno == ENOENT)
                        return alt_path != NULL;
-               i_error("t_readlink(%s) failed: %s", alt_symlink_path, error);
+               e_error(event, "t_readlink(%s) failed: %s", alt_symlink_path, error);
                return FALSE;
        }
 
        if (alt_path == NULL) {
-               i_warning("dbox %s: Original ALT=%s, "
-                         "but currently no ALT path set", root_dir, linkpath);
+               e_warning(event,
+                         "%s: Original ALT=%s, but currently no ALT path set",
+                         root_dir, linkpath);
                return TRUE;
        } else if (strcmp(linkpath, alt_path) != 0) {
                if (strcmp(linkpath, alt_path2) == 0) {
@@ -54,14 +56,14 @@ dbox_alt_path_has_changed(const char *root_dir, const char *alt_path,
                           mdbox. we'll silently replace the symlink. */
                        return TRUE;
                }
-               i_warning("dbox %s: Original ALT=%s, "
-                         "but currently ALT=%s", root_dir, linkpath, alt_path);
+               e_warning(event, "%s: Original ALT=%s, but currently ALT=%s",
+                         root_dir, linkpath, alt_path);
                return TRUE;
        }
        return FALSE;
 }
 
-static void dbox_verify_alt_path(struct mailbox_list *list)
+static void dbox_verify_alt_path(struct mailbox_list *list, struct event *event)
 {
        const char *root_dir, *alt_symlink_path, *alt_path, *alt_path2;
 
@@ -73,7 +75,7 @@ static void dbox_verify_alt_path(struct mailbox_list *list)
        (void)mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX,
                                         &alt_path2);
        if (!dbox_alt_path_has_changed(root_dir, alt_path, alt_path2,
-                                      alt_symlink_path))
+                                      alt_symlink_path, event))
                return;
 
        /* unlink/create the current alt path symlink */
@@ -88,7 +90,7 @@ static void dbox_verify_alt_path(struct mailbox_list *list)
                        ret = symlink(alt_path, alt_symlink_path);
                }
                if (ret < 0 && errno != EEXIST) {
-                       i_error("symlink(%s, %s) failed: %m",
+                       e_error(event, "symlink(%s, %s) failed: %m",
                                alt_path, alt_symlink_path);
                }
        }
@@ -135,7 +137,7 @@ int dbox_storage_create(struct mail_storage *_storage,
        }
 
        if (!ns->list->set.alt_dir_nocheck)
-               dbox_verify_alt_path(ns->list);
+               dbox_verify_alt_path(ns->list, _storage->event);
        return 0;
 }
 
@@ -172,10 +174,11 @@ void dbox_notify_changes(struct mailbox *box)
 }
 
 static bool
-dbox_cleanup_temp_files(struct mailbox_list *list, const char *path,
+dbox_cleanup_temp_files(struct mailbox *box, const char *path,
                        time_t last_scan_time, time_t last_change_time)
 {
-       unsigned int interval = list->mail_set->mail_temp_scan_interval;
+       struct event *event = box->event;
+       unsigned int interval = box->list->mail_set->mail_temp_scan_interval;
 
        /* check once in a while if there are temp files to clean up */
        if (interval == 0) {
@@ -192,7 +195,7 @@ dbox_cleanup_temp_files(struct mailbox_list *list, const char *path,
 
                        if (stat(path, &st) < 0) {
                                if (errno == ENOENT)
-                                       i_error("stat(%s) failed: %m", path);
+                                       e_error(event, "stat(%s) failed: %m", path);
                                return FALSE;
                        }
                        last_change_time = st.st_ctime;
@@ -206,7 +209,7 @@ dbox_cleanup_temp_files(struct mailbox_list *list, const char *path,
                        return stated;
                }
                const char *prefix =
-                       mailbox_list_get_global_temp_prefix(list);
+                       mailbox_list_get_global_temp_prefix(box->list);
                (void)unlink_old_files(path, prefix,
                                       ioloop_time - DBOX_TMP_DELETE_SECS);
                return TRUE;
@@ -273,7 +276,7 @@ int dbox_mailbox_open(struct mailbox *box, time_t path_ctime)
                                  MAIL_INDEX_FSYNC_MASK_EXPUNGES);
 
        const struct mail_index_header *hdr = mail_index_get_header(box->view);
-       if (dbox_cleanup_temp_files(box->list, box_path,
+       if (dbox_cleanup_temp_files(box, box_path,
                                    hdr->last_temp_file_scan, path_ctime)) {
                /* temp files were scanned. update the last scan timestamp. */
                index_mailbox_update_last_temp_file_scan(box);
@@ -379,6 +382,7 @@ int dbox_mailbox_create_indexes(struct mailbox *box,
 
 int dbox_verify_alt_storage(struct mailbox_list *list)
 {
+       struct event *event = list->ns->user->event;
        const char *alt_path;
        struct stat st;
 
@@ -390,7 +394,7 @@ int dbox_verify_alt_storage(struct mailbox_list *list)
        if (stat(alt_path, &st) == 0)
                return 0;
        if (errno != ENOENT) {
-               i_error("stat(%s) failed: %m", alt_path);
+               e_error(event, "stat(%s) failed: %m", alt_path);
                return -1;
        }