c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#ifndef QUOTA_PRIVATE_H
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#define QUOTA_PRIVATE_H
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen#include "mail-storage-private.h"
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen#include "mail-namespace.h"
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen#include "quota.h"
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen/* Modules should use do "my_id = quota_module_id++" and
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen use quota_module_contexts[id] for their own purposes. */
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenextern unsigned int quota_module_id;
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenstruct quota {
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct mail_user *user;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct quota_settings *set;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct quota_root *) roots;
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct mail_namespace *) namespaces;
5be5d875996999585de785ac33f96ff1569f1a0eTimo Sirainen struct mail_namespace *unwanted_ns;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen};
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenstruct quota_settings {
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen pool_t pool;
3fe44a0df5a0bdd80c495f79cbf0e384441d6fccTimo Sirainen
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct quota_root_settings *) root_sets;
64f889c7c1707f9951755c997d750639be5dd41cMartti Rannanjärvi enum quota_alloc_result (*test_alloc)(
b62139aae0a0099d0ede35b164b2870479f9b027Martti Rannanjärvi struct quota_transaction_context *ctx, uoff_t size,
b62139aae0a0099d0ede35b164b2870479f9b027Martti Rannanjärvi const char **error_r);
62300a38f91227b9de043a9a8ec1d4f1978e1138Timo Sirainen
7f4fa37676bac8efcf4e2ac706172b1bad779a8aMartti Rannanjärvi uoff_t max_mail_size;
b87436ebb957a9eb182be72ba00e2c8eae59a2e4Timo Sirainen const char *quota_exceeded_msg;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool debug:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool initialized:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool vsizes:1;
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen};
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
12dc81583d1958cb301a617e19fbd40e8d376397Timo Sirainenstruct quota_rule {
81e4bda7d481c57cd049a0a68daab733b1ca9c44Timo Sirainen const char *mailbox_mask;
12dc81583d1958cb301a617e19fbd40e8d376397Timo Sirainen
12dc81583d1958cb301a617e19fbd40e8d376397Timo Sirainen int64_t bytes_limit, count_limit;
3851ad9fcb25635f02b46d44586742ef1081876bTimo Sirainen /* relative to default_rule */
d7babe048f9ae1afa5357973b8de8c929753a216Timo Sirainen int bytes_percent, count_percent;
2b682d8d3661800f16aceaa45fa4de9b6b140a59Timo Sirainen
2b682d8d3661800f16aceaa45fa4de9b6b140a59Timo Sirainen /* Don't include this mailbox in quota */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool ignore:1;
12dc81583d1958cb301a617e19fbd40e8d376397Timo Sirainen};
12dc81583d1958cb301a617e19fbd40e8d376397Timo Sirainen
503e5ef896c7b4a51cf73efb0d132860a8c747e6Timo Sirainenstruct quota_warning_rule {
3851ad9fcb25635f02b46d44586742ef1081876bTimo Sirainen struct quota_rule rule;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *command;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool reverse:1;
503e5ef896c7b4a51cf73efb0d132860a8c747e6Timo Sirainen};
503e5ef896c7b4a51cf73efb0d132860a8c747e6Timo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainenstruct quota_backend_vfuncs {
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct quota_root *(*alloc)(void);
9b61a6db87c026656f8d2ae214e4486b98a069c0Timo Sirainen int (*init)(struct quota_root *root, const char *args,
9b61a6db87c026656f8d2ae214e4486b98a069c0Timo Sirainen const char **error_r);
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen void (*deinit)(struct quota_root *root);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen bool (*parse_rule)(struct quota_root_settings *root_set,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct quota_rule *rule,
12dc81583d1958cb301a617e19fbd40e8d376397Timo Sirainen const char *str, const char **error_r);
e83a11eb1dc0dea31754396e1d07c5205d810104Martti Rannanjärvi int (*init_limits)(struct quota_root *root, const char **error_r);
12dc81583d1958cb301a617e19fbd40e8d376397Timo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen /* called once for each namespace */
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen void (*namespace_added)(struct quota *quota,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen struct mail_namespace *ns);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen const char *const *(*get_resources)(struct quota_root *root);
1379bb74c2855aaf3415fdfe965164a44ac3c001Martti Rannanjärvi /* Backends return success as QUOTA_GET_RESULT_LIMITED, and returning
1379bb74c2855aaf3415fdfe965164a44ac3c001Martti Rannanjärvi QUOTA_GET_RESULT_UNLIMITED is prohibited by quota_get_resource(),
1379bb74c2855aaf3415fdfe965164a44ac3c001Martti Rannanjärvi which is the only caller of this vfunc. */
1379bb74c2855aaf3415fdfe965164a44ac3c001Martti Rannanjärvi enum quota_get_result (*get_resource)(struct quota_root *root,
1379bb74c2855aaf3415fdfe965164a44ac3c001Martti Rannanjärvi const char *name,
1379bb74c2855aaf3415fdfe965164a44ac3c001Martti Rannanjärvi uint64_t *value_r,
1379bb74c2855aaf3415fdfe965164a44ac3c001Martti Rannanjärvi const char **error_r);
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen int (*update)(struct quota_root *root,
7b3b617e946d5b32078baa821f5fc05f775e1dfeMartti Rannanjärvi struct quota_transaction_context *ctx,
7b3b617e946d5b32078baa821f5fc05f775e1dfeMartti Rannanjärvi const char **error_r);
6d6bbe8787354bbb69d0c03187adfe0f497d70b8Timo Sirainen bool (*match_box)(struct quota_root *root, struct mailbox *box);
048e40f9364fa68482bc276dd4a5d595a3d742e9Timo Sirainen void (*flush)(struct quota_root *root);
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen};
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainenstruct quota_backend {
3fe44a0df5a0bdd80c495f79cbf0e384441d6fccTimo Sirainen /* quota backends equal if backend1.name == backend2.name */
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen const char *name;
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen struct quota_backend_vfuncs v;
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen};
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenstruct quota_root_settings {
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen /* Unique quota root name. */
73583cff4f0ca9ee87204256ca1994adf17cb94cTimo Sirainen const char *name;
666286d8ecc6c450b2232dcc628f79454215acfcTimo Sirainen /* Name in settings, e.g. "quota", "quota2", .. */
666286d8ecc6c450b2232dcc628f79454215acfcTimo Sirainen const char *set_name;
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct quota_settings *set;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *args;
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const struct quota_backend *backend;
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct quota_rule default_rule;
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct quota_rule) rules;
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct quota_warning_rule) warning_rules;
2521fd0986302cdabc8b0711eef63ac188f32cd6Timo Sirainen const char *limit_set;
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen /* If user is under quota before saving a mail, allow the last mail to
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen bring the user over quota by this many bytes. */
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen uint64_t last_mail_max_extra_bytes;
ad0fe438255666726723a93f3112df6e103028afTimo Sirainen struct quota_rule grace_rule;
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen /* Limits in default_rule override backend's quota limits */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool force_default_rule:1;
10207755f33a4cf1a1e901968137ae4f2bc93bbfTimo Sirainen /* TRUE if any of the warning_rules have reverse==TRUE */
10207755f33a4cf1a1e901968137ae4f2bc93bbfTimo Sirainen bool have_reverse_warnings:1;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen};
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenstruct quota_root {
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen pool_t pool;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct quota_root_settings *set;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct quota *quota;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct quota_backend backend;
2521fd0986302cdabc8b0711eef63ac188f32cd6Timo Sirainen struct dict *limit_set_dict;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
2d8b23805db6f06b8b38174fb6e135386694f429Timo Sirainen /* this quota root applies only to this namespace. it may also be
2d8b23805db6f06b8b38174fb6e135386694f429Timo Sirainen a public namespace without an owner. */
2d8b23805db6f06b8b38174fb6e135386694f429Timo Sirainen struct mail_namespace *ns;
766115d2b2e6dbcf59f90d3b3866851cf6f740feTimo Sirainen /* this is set in quota init(), because namespaces aren't known yet.
766115d2b2e6dbcf59f90d3b3866851cf6f740feTimo Sirainen when accessing shared users the ns_prefix may be non-NULL but
766115d2b2e6dbcf59f90d3b3866851cf6f740feTimo Sirainen ns=NULL, so when checking if quota root applies only to a specific
766115d2b2e6dbcf59f90d3b3866851cf6f740feTimo Sirainen namespace use the ns_prefix!=NULL check. */
2d8b23805db6f06b8b38174fb6e135386694f429Timo Sirainen const char *ns_prefix;
2d8b23805db6f06b8b38174fb6e135386694f429Timo Sirainen
b1678954f83e1059b981e2def52a70054fa71399Timo Sirainen /* initially the same as set->default_rule.*_limit, but some backends
b1678954f83e1059b981e2def52a70054fa71399Timo Sirainen may change these by reading the limits elsewhere (e.g. Maildir++,
b1678954f83e1059b981e2def52a70054fa71399Timo Sirainen FS quota) */
b1678954f83e1059b981e2def52a70054fa71399Timo Sirainen int64_t bytes_limit, count_limit;
b1678954f83e1059b981e2def52a70054fa71399Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen /* Module-specific contexts. See quota_module_id. */
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(void) quota_module_contexts;
d5d23d5ff8b7a06d2ead489ddcf55ee8fb5ca7b6Timo Sirainen
d5d23d5ff8b7a06d2ead489ddcf55ee8fb5ca7b6Timo Sirainen /* don't enforce quota when saving */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool no_enforcing:1;
e2e64c109827f782e9e20b50a15c7489479bcadaTimo Sirainen /* quota is automatically updated. update() should be called but the
f9362223346d10a5866b376ed227b77b26ea4292Timo Sirainen bytes won't be changed. count is still changed, because it's cheap
f9362223346d10a5866b376ed227b77b26ea4292Timo Sirainen to do and it's internally used to figure out whether there have
f9362223346d10a5866b376ed227b77b26ea4292Timo Sirainen been some changes and that quota_warnings should be checked. */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool auto_updating:1;
d19d3aa4eafa34b48b7d7d311c9db31e1898576aTimo Sirainen /* If user has unlimited quota, disable quota tracking */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool disable_unlimited_tracking:1;
8eb223b84389a7b75a39d46484f5166d221305ebTimo Sirainen /* Set while quota is being recalculated to avoid recursion. */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool recounting:1;
3f7583189249a28892cd5bd69e15681c7a8a619bTimo Sirainen /* Quota root is hidden (to e.g. IMAP GETQUOTAROOT) */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool hidden:1;
c16f2d0725a16559cdeedec7628ce616725000cbTimo Sirainen /* Did we already check quota_over_flag correctness? */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool quota_over_flag_checked:1;
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen};
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenstruct quota_transaction_context {
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen union mailbox_transaction_module_context module_ctx;
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen struct quota *quota;
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct mailbox *box;
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen int64_t bytes_used, count_used;
30ad2b0309119501efad06c72ec9b1561b90d4afTimo Sirainen /* how many bytes/mails can be saved until limit is reached.
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen (set once, not updated by bytes_used/count_used).
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen if last_mail_max_extra_bytes>0, the bytes_ceil is initially
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen increased by that much, while bytes_ceil2 contains the real ceiling.
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen after the first allocation is done, bytes_ceil is set to
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen bytes_ceil2. */
bc7a4cf2c06702ebaedba9a7c15ce657d5856f63Timo Sirainen uint64_t bytes_ceil, bytes_ceil2, count_ceil;
b863b7e3fccf75f90f613b875f02fd1781e14e5eTimo Sirainen /* How many bytes/mails we are over quota. Like *_ceil, these are set
b863b7e3fccf75f90f613b875f02fd1781e14e5eTimo Sirainen only once and not updated by bytes_used/count_used. (Either *_ceil
b863b7e3fccf75f90f613b875f02fd1781e14e5eTimo Sirainen or *_over is always zero.) */
269370f66e320a071700e33d9f2584eb46d96a90Timo Sirainen uint64_t bytes_over, count_over;
fbdd091ef000e3ec4db34c054736c91ef9bc48ceTimo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct mail *tmp_mail;
39dea5f2e78f6bfc3adc0655176f596ee211938fTimo Sirainen enum quota_recalculate recalculate;
6800c6607013d4fdef5a4f764bae407301c6cce8Timo Sirainen
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool limits_set:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool failed:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool sync_transaction:1;
e2e64c109827f782e9e20b50a15c7489479bcadaTimo Sirainen /* TRUE if all roots have auto_updating=TRUE */
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool auto_updating:1;
ad759d5e8971dd3dae17f40087bcb50f7bc4599eTimo Sirainen /* Quota doesn't need to be updated within this transaction. */
ad759d5e8971dd3dae17f40087bcb50f7bc4599eTimo Sirainen bool no_quota_updates:1;
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen};
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen/* Register storage to all user's quota roots. */
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenvoid quota_add_user_namespace(struct quota *quota, struct mail_namespace *ns);
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenvoid quota_remove_user_namespace(struct mail_namespace *ns);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
a4922fa0c7de2aa332bc1361abf6f93f001fc02eTimo Sirainenint quota_root_default_init(struct quota_root *root, const char *args,
a4922fa0c7de2aa332bc1361abf6f93f001fc02eTimo Sirainen const char **error_r);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenstruct quota *quota_get_mail_user_quota(struct mail_user *user);
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenbool quota_root_is_namespace_visible(struct quota_root *root,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen struct mail_namespace *ns);
2b682d8d3661800f16aceaa45fa4de9b6b140a59Timo Sirainenstruct quota_rule *
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenquota_root_rule_find(struct quota_root_settings *root_set, const char *name);
2b682d8d3661800f16aceaa45fa4de9b6b140a59Timo Sirainen
d761c26f2bbf514e0fc0c6ed9bc52627a4179eabTimo Sirainenvoid quota_root_recalculate_relative_rules(struct quota_root_settings *root_set,
d761c26f2bbf514e0fc0c6ed9bc52627a4179eabTimo Sirainen int64_t bytes_limit,
d761c26f2bbf514e0fc0c6ed9bc52627a4179eabTimo Sirainen int64_t count_limit);
92c671c1667ea1bea90030a2b69298bf8c541623Timo Sirainen/* Returns 1 if values were returned successfully, 0 if we're recursing into
92c671c1667ea1bea90030a2b69298bf8c541623Timo Sirainen the same function, -1 if error. */
d2cbbecf76de3f4eb945895fab5760ed0a28281cMartti Rannanjärviint quota_count(struct quota_root *root, uint64_t *bytes_r, uint64_t *count_r,
4f52de745cf26ee9dcbde7ca4500d442116226cfMartti Rannanjärvi enum quota_get_result *error_result_r, const char **error_r);
62300a38f91227b9de043a9a8ec1d4f1978e1138Timo Sirainen
b863b7e3fccf75f90f613b875f02fd1781e14e5eTimo Sirainenint quota_root_parse_grace(struct quota_root_settings *root_set,
b863b7e3fccf75f90f613b875f02fd1781e14e5eTimo Sirainen const char *value, const char **error_r);
b863b7e3fccf75f90f613b875f02fd1781e14e5eTimo Sirainenbool quota_warning_match(const struct quota_warning_rule *w,
b863b7e3fccf75f90f613b875f02fd1781e14e5eTimo Sirainen uint64_t bytes_before, uint64_t bytes_current,
f97866381675fe12cdab0f2d56a059fe7b88457aTimo Sirainen uint64_t count_before, uint64_t count_current,
f97866381675fe12cdab0f2d56a059fe7b88457aTimo Sirainen const char **reason_r);
b863b7e3fccf75f90f613b875f02fd1781e14e5eTimo Sirainenbool quota_transaction_is_over(struct quota_transaction_context *ctx, uoff_t size);
efd291767a612b2cf3421f3d4ff1c3d8abd78484Martti Rannanjärviint quota_transaction_set_limits(struct quota_transaction_context *ctx,
c975f4c0c6a767050755e824d5a5ddeb1dbf7f6eMartti Rannanjärvi enum quota_get_result *error_result_r,
efd291767a612b2cf3421f3d4ff1c3d8abd78484Martti Rannanjärvi const char **error_r);
b863b7e3fccf75f90f613b875f02fd1781e14e5eTimo Sirainen
bd2a176b573f9679e7e45339c20ef71704f071c0Aki Tuomivoid quota_backend_register(const struct quota_backend *backend);
bd2a176b573f9679e7e45339c20ef71704f071c0Aki Tuomivoid quota_backend_unregister(const struct quota_backend *backend);
bd2a176b573f9679e7e45339c20ef71704f071c0Aki Tuomi
1379bb74c2855aaf3415fdfe965164a44ac3c001Martti Rannanjärvi#define QUOTA_UNKNOWN_RESOURCE_ERROR_STRING "Unknown quota resource"
1379bb74c2855aaf3415fdfe965164a44ac3c001Martti Rannanjärvi
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen#endif