]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Move quota_args=ignoreunlimited to quota_ignore_unlimited
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 22 Aug 2024 08:14:26 +0000 (11:14 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:14 +0000 (12:34 +0200)
src/plugins/quota/quota-private.h
src/plugins/quota/quota-settings.c
src/plugins/quota/quota-settings.h
src/plugins/quota/quota.c
src/plugins/quota/quota.h

index bff01a4d8422bcd60acfefcf51b21d4af1699a5a..9887f10a6a2b9537653866fac694b826c41de61f 100644 (file)
@@ -89,8 +89,6 @@ struct quota_root {
           to do and it's internally used to figure out whether there have
           been some changes and that quota_warnings should be checked. */
        bool auto_updating:1;
-       /* If user has unlimited quota, disable quota tracking */
-       bool disable_unlimited_tracking:1;
        /* Set while quota is being recalculated to avoid recursion. */
        bool recounting:1;
        /* Did we already check quota_over_status correctness? */
index 330cf4932cf6886e482611f9282ae1ebf1853615..59ffb00f306384e56f9673bf40793dd54bda0768 100644 (file)
@@ -28,6 +28,7 @@ static const struct setting_define quota_setting_defines[] = {
        DEF(STR, quota_driver),
        DEF(STR, quota_args),
        DEF(BOOL, quota_ignore),
+       DEF(BOOL, quota_ignore_unlimited),
        DEF(BOOL, quota_hidden),
        DEF(SIZE, quota_storage_size),
        DEF(UINT, quota_storage_percentage),
@@ -62,6 +63,7 @@ static const struct quota_settings quota_default_settings = {
        .quota_driver = "count",
        .quota_args = "",
        .quota_ignore = FALSE,
+       .quota_ignore_unlimited = FALSE,
        .quota_hidden = FALSE,
        .quota_storage_size = SET_SIZE_UNLIMITED,
        .quota_storage_percentage = 100,
index 2e83c9448f29271e031c4005d3b5e7aabccb21ed..0f13abba2540b3717d5ee7b5661e14940ec35e1b 100644 (file)
@@ -26,6 +26,8 @@ struct quota_settings {
           this differs from unlimited quota, which still tracks the quota,
           even if it is not enforced. */
        bool quota_ignore;
+       /* IF TRUE, quota is ignored only when quota is unlimited. */
+       bool quota_ignore_unlimited;
        /* Quota root is hidden (to e.g. IMAP GETQUOTAROOT) */
        bool quota_hidden;
        /* Quota storage size is counted as:
index 8f911d9384feb8ee34d6cbc581430607f3d1052d..737721a0498b4aa969ceb04243d4695231f4dec7 100644 (file)
@@ -49,10 +49,8 @@ static const struct quota_backend *quota_internal_backends[] = {
 
 static ARRAY(const struct quota_backend*) quota_backends;
 
-static void ignoreunlim_param_handler(struct quota_root *_root, const char *param_value);
 static void noenforcing_param_handler(struct quota_root *_root, const char *param_value);
 
-struct quota_param_parser quota_param_ignoreunlimited = {.param_name = "ignoreunlimited", .param_handler = ignoreunlim_param_handler};
 struct quota_param_parser quota_param_noenforcing = {.param_name = "noenforcing", .param_handler = noenforcing_param_handler};
 
 static enum quota_alloc_result quota_default_test_alloc(
@@ -151,7 +149,6 @@ int quota_root_default_init(struct quota_root *root, const char *args,
                            const char **error_r)
 {
        const struct quota_param_parser default_params[] = {
-               quota_param_ignoreunlimited,
                quota_param_noenforcing,
                {.param_name = NULL}
        };
@@ -269,7 +266,7 @@ quota_root_init(struct quota *quota, struct event *set_event, const char *root_n
        }
        if (root->set->quota_storage_size == 0 &&
            root->set->quota_message_count == 0 &&
-           root->disable_unlimited_tracking) {
+           root->set->quota_ignore_unlimited) {
                quota_root_deinit(root);
                return 0;
        }
@@ -1287,11 +1284,6 @@ void quota_recalculate(struct quota_transaction_context *ctx,
        ctx->recalculate = recalculate;
 }
 
-static void ignoreunlim_param_handler(struct quota_root *_root, const char *param_value ATTR_UNUSED)
-{
-       _root->disable_unlimited_tracking = TRUE;
-}
-
 static void noenforcing_param_handler(struct quota_root *_root, const char *param_value ATTR_UNUSED)
 {
        _root->no_enforcing = TRUE;
index 347f7b5360bdbe4d77a1a1775e5caf47cb2a28fa..a8901a249cddf37c681f6a09716934f4d303859c 100644 (file)
@@ -23,7 +23,6 @@ struct quota_param_parser {
 };
 
 extern struct quota_param_parser quota_param_hidden;
-extern struct quota_param_parser quota_param_ignoreunlimited;
 extern struct quota_param_parser quota_param_noenforcing;
 extern struct quota_param_parser quota_param_ns;