From: Timo Sirainen Date: Thu, 22 Aug 2024 08:14:26 +0000 (+0300) Subject: quota: Move quota_args=ignoreunlimited to quota_ignore_unlimited X-Git-Tag: 2.4.1~660 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e493f7749fc457e481a9f0a7da0cc2dffcd506ed;p=thirdparty%2Fdovecot%2Fcore.git quota: Move quota_args=ignoreunlimited to quota_ignore_unlimited --- diff --git a/src/plugins/quota/quota-private.h b/src/plugins/quota/quota-private.h index bff01a4d84..9887f10a6a 100644 --- a/src/plugins/quota/quota-private.h +++ b/src/plugins/quota/quota-private.h @@ -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? */ diff --git a/src/plugins/quota/quota-settings.c b/src/plugins/quota/quota-settings.c index 330cf4932c..59ffb00f30 100644 --- a/src/plugins/quota/quota-settings.c +++ b/src/plugins/quota/quota-settings.c @@ -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, diff --git a/src/plugins/quota/quota-settings.h b/src/plugins/quota/quota-settings.h index 2e83c9448f..0f13abba25 100644 --- a/src/plugins/quota/quota-settings.h +++ b/src/plugins/quota/quota-settings.h @@ -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: diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index 8f911d9384..737721a049 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -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; diff --git a/src/plugins/quota/quota.h b/src/plugins/quota/quota.h index 347f7b5360..a8901a249c 100644 --- a/src/plugins/quota/quota.h +++ b/src/plugins/quota/quota.h @@ -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;