All backends have replaced the args with global settings.
return &root->root;
}
-static int count_quota_init(struct quota_root *root, const char *args,
- const char **error_r)
+static int count_quota_init(struct quota_root *root,
+ const char **error_r ATTR_UNUSED)
{
event_set_append_log_prefix(root->backend.event, "quota-count: ");
root->auto_updating = TRUE;
- return quota_root_default_init(root, args, error_r);
+ return 0;
}
static void count_quota_deinit(struct quota_root *_root)
return &root->root;
}
-static int fs_quota_init(struct quota_root *_root, const char *args ATTR_UNUSED,
- const char **error_r)
+static int fs_quota_init(struct quota_root *_root, const char **error_r)
{
struct fs_quota_root *root = (struct fs_quota_root *)_root;
return &root->root;
}
-static int imapc_quota_init(struct quota_root *_root, const char *args ATTR_UNUSED,
- const char **error_r)
+static int imapc_quota_init(struct quota_root *_root, const char **error_r)
{
struct imapc_quota_root *root = (struct imapc_quota_root *)_root;
return &root->root;
}
-static int maildir_quota_init(struct quota_root *_root, const char *args,
- const char **error_r)
+static int maildir_quota_init(struct quota_root *_root,
+ const char **error_r ATTR_UNUSED)
{
event_set_append_log_prefix(_root->backend.event, "quota-maildir: ");
- return quota_root_default_init(_root, args, error_r);
+ return 0;
}
static void maildir_quota_deinit(struct quota_root *_root)
struct quota_backend_vfuncs {
struct quota_root *(*alloc)(void);
- int (*init)(struct quota_root *root, const char *args,
- const char **error_r);
+ int (*init)(struct quota_root *root, const char **error_r);
void (*deinit)(struct quota_root *root);
/* called once for each namespace */
struct mail_namespace *ns);
void quota_remove_user_namespace(struct mail_namespace *ns);
-int quota_root_default_init(struct quota_root *root, const char *args,
- const char **error_r);
struct quota *quota_get_mail_user_quota(struct mail_user *user);
/* Returns 1 if values were returned successfully, 0 if we're recursing into
DEF(STR, quota_name),
DEF(STR, quota_driver),
- DEF(STR, quota_args),
DEF(BOOL, quota_ignore),
DEF(BOOL, quota_ignore_unlimited),
DEF(BOOL, quota_enforce),
.quota_name = "",
.quota_driver = "count",
- .quota_args = "",
.quota_ignore = FALSE,
.quota_ignore_unlimited = FALSE,
.quota_enforce = TRUE,
/* Client-visible name of the quota root */
const char *quota_name;
const char *quota_driver;
- const char *quota_args;
/* If TRUE, quota is not tracked at all (for this mailbox). This is
typically set only for specific mailboxes or namespaces. Note that
this differs from unlimited quota, which still tracks the quota,
pool_unref(&pool);
}
-int quota_root_default_init(struct quota_root *root, const char *args,
- const char **error_r)
-{
- const struct quota_param_parser default_params[] = {
- {.param_name = NULL}
- };
- return quota_parse_parameters(root, &args, error_r, default_params, TRUE);
-}
-
static int
quota_root_settings_get(struct quota_root *root, struct event *set_event,
const struct quota_settings **set_r,
root->set->quota_storage_size;
root->count_limit = root->set->quota_message_count;
- if (root->backend.v.init(root, root->set->quota_args, error_r) < 0) {
+ if (root->backend.v.init(root, error_r) < 0) {
*error_r = t_strdup_printf("%s quota init failed: %s",
root->backend.name, *error_r);
{
ctx->recalculate = recalculate;
}
-
-int quota_parse_parameters(struct quota_root *root, const char **args, const char **error_r,
- const struct quota_param_parser *valid_params, bool fail_on_unknown)
-{
- const char *tmp_param_name, *tmp_param_val;
- size_t tmp_param_len;
-
- while (*args != NULL && (*args)[0] != '\0') {
- for (; valid_params->param_name != NULL; ++valid_params) {
- tmp_param_name = valid_params->param_name;
- tmp_param_len = strlen(valid_params->param_name);
- i_assert(*args != NULL);
- if (strncmp(*args, tmp_param_name, tmp_param_len) == 0) {
- tmp_param_val = NULL;
- *args += tmp_param_len;
- if (tmp_param_name[tmp_param_len - 1] == '=') {
- const char *next_colon = strchr(*args, ':');
- tmp_param_val = (next_colon == NULL)?
- t_strdup(*args):
- t_strdup_until(*args, next_colon);
- *args = (next_colon == NULL) ? NULL : next_colon + 1;
- }
- else if ((*args)[0] == '\0' ||
- (*args)[0] == ':') {
- *args = ((*args)[0] == ':') ? *args + 1 : NULL;
- /* in case parameter is a boolean second parameter
- * string parameter value will be ignored by param_handler
- * we just need some non-NULL value
- * to indicate that argument is to be processed */
- tmp_param_val = "";
- }
- if (tmp_param_val != NULL) {
- valid_params->param_handler(root, tmp_param_val);
- break;
- }
- }
- }
- if (valid_params->param_name == NULL) {
- if (fail_on_unknown) {
- *error_r = t_strdup_printf(
- "Unknown parameter for backend %s: %s",
- root->backend.name, *args);
- return -1;
- }
- else {
- break;
- }
- }
- }
- return 0;
-}
/* Execute quota_over_scripts if needed. */
void quota_over_status_check_startup(struct quota *quota);
-/* Common quota parameters parsing loop */
-int quota_parse_parameters(struct quota_root *root, const char **args, const char **error_r,
- const struct quota_param_parser *valid_params, bool fail_on_unknown);
-
#endif