On 13.03.26 22:22, Jason Andryuk wrote:
On 2026-03-05 08:51, Juergen Gross wrote:
Add central functions for checking a value (either an absolute one or
the current domain value plus an offset) against a specific quota.

This is in preparation of introducing per-domain quota.

The required changes allow to drop the "update" parameter from
domain_nbentry_fix().

Signed-off-by: Juergen Gross <[email protected]>

diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index e453b3061f..1df9265ad5 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -389,6 +389,25 @@ void wrl_apply_debit_trans_commit(struct connection *conn)
      wrl_apply_debit_actual(conn->domain);
  }
+static bool domain_check_quota_val(struct domain *d, enum accitem what,
+                   unsigned int val)
+{
+    unsigned int quota = hard_quotas[what].val;
+
+    if (!quota || !domid_is_unprivileged(d->domid))
+        return false;
+
+    return val >= quota;

Personally, I don't like the naming of *check* where the "good" return is false.  That seems backwards from what I expect.  So I'd suggest either flipping the return value or renaming.  domain_quota_fail() or something?

I'll go with domain_quota_exceeded().

Thanks,


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to