]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: quota_root_iter_next() - Iterate all visible roots
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 8 Jun 2017 17:25:11 +0000 (20:25 +0300)
committerGitLab <gitlab@git.dovecot.net>
Mon, 12 Jun 2017 12:39:11 +0000 (15:39 +0300)
Don't try to skip the roots that don't have an active quota. imap_quota
plugin does the skipping now itself, and quota_clone shouldn't really be
even used with more than one quota root.

src/plugins/quota/quota-private.h
src/plugins/quota/quota.c

index 55fbae30986882af6f6bd60db8f031c3fd600492..25222c074709cca885cb6dda2270d45d63019cf2 100644 (file)
@@ -125,9 +125,6 @@ struct quota_root {
           may change these by reading the limits elsewhere (e.g. Maildir++,
           FS quota) */
        int64_t bytes_limit, count_limit;
-       /* 1 = quota root has resources and should be returned when iterating
-          quota roots, 0 = not, -1 = unknown. */
-       int resource_ret;
 
        /* Module-specific contexts. See quota_module_id. */
        ARRAY(void) quota_module_contexts;
index e15f534c5c58edc11c18c20d1b18aaffcbfe066d..06452edd0797801d70b89614e3fd09c535cf7000 100644 (file)
@@ -395,7 +395,6 @@ quota_root_init(struct quota_root_settings *root_set, struct quota *quota,
        struct quota_root *root;
 
        root = root_set->backend->v.alloc();
-       root->resource_ret = -1;
        root->pool = pool_alloconly_create("quota root", 512);
        root->set = root_set;
        root->quota = quota;
@@ -680,8 +679,6 @@ struct quota_root *quota_root_iter_next(struct quota_root_iter *iter)
 {
        struct quota_root *const *roots, *root = NULL;
        unsigned int count;
-       uint64_t value, limit;
-       int ret;
 
        if (iter->quota == NULL)
                return NULL;
@@ -694,22 +691,8 @@ struct quota_root *quota_root_iter_next(struct quota_root_iter *iter)
                if (!quota_root_is_visible(roots[iter->i], iter->box, FALSE))
                        continue;
 
-               ret = roots[iter->i]->resource_ret;
-               if (ret == -1) {
-                       ret = quota_get_resource(roots[iter->i], "",
-                                                QUOTA_NAME_STORAGE_KILOBYTES,
-                                                &value, &limit);
-               }
-               if (ret == 0) {
-                       ret = quota_get_resource(roots[iter->i], "",
-                                                QUOTA_NAME_MESSAGES,
-                                                &value, &limit);
-               }
-               roots[iter->i]->resource_ret = ret;
-               if (ret > 0) {
-                       root = roots[iter->i];
-                       break;
-               }
+               root = roots[iter->i];
+               break;
        }
 
        iter->i++;