aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xenstored_domain.c
diff options
context:
space:
mode:
authorvhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>2006-04-13 16:21:13 +0000
committervhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>2006-04-13 16:21:13 +0000
commite43071c7b1a81fe80595bb6a42214d1029e8a88d (patch)
treeb9a1b215f0a8ced8902dfd5a214a2ba2cbd34a8f /tools/xenstore/xenstored_domain.c
parent9f15c912a7ef65c4a6452ca9338fccc85a8f6170 (diff)
downloadxen-e43071c7b1a81fe80595bb6a42214d1029e8a88d.tar.gz
xen-e43071c7b1a81fe80595bb6a42214d1029e8a88d.tar.bz2
xen-e43071c7b1a81fe80595bb6a42214d1029e8a88d.zip
add quota to xenstored.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstored_domain.c')
-rw-r--r--tools/xenstore/xenstored_domain.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 27f906dda6..0de6f99c17 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -74,6 +74,12 @@ struct domain
/* Have we noticed that this domain is shutdown? */
int shutdown;
+
+ /* number of entry from this domain in the store */
+ int nbentry;
+
+ /* number of watch for this domain */
+ int nbwatch;
};
static LIST_HEAD(domains);
@@ -285,6 +291,8 @@ static struct domain *new_domain(void *context, unsigned int domid,
domain->conn->id = domid;
domain->remote_port = port;
+ domain->nbentry = 0;
+ domain->nbwatch = 0;
return domain;
}
@@ -562,6 +570,50 @@ int domain_init(void)
return eventchn_fd;
}
+void domain_entry_inc(struct connection *conn)
+{
+ if (!conn || !conn->domain)
+ return;
+ conn->domain->nbentry++;
+}
+
+void domain_entry_dec(struct connection *conn)
+{
+ if (!conn || !conn->domain)
+ return;
+ if (conn->domain->nbentry)
+ conn->domain->nbentry--;
+}
+
+int domain_entry(struct connection *conn)
+{
+ return (conn && conn->domain && conn->domain->domid)
+ ? conn->domain->nbentry
+ : 0;
+}
+
+void domain_watch_inc(struct connection *conn)
+{
+ if (!conn || !conn->domain)
+ return;
+ conn->domain->nbwatch++;
+}
+
+void domain_watch_dec(struct connection *conn)
+{
+ if (!conn || !conn->domain)
+ return;
+ if (conn->domain->nbwatch)
+ conn->domain->nbwatch--;
+}
+
+int domain_watch(struct connection *conn)
+{
+ return (conn && conn->domain && conn->domain->domid)
+ ? conn->domain->nbwatch
+ : 0;
+}
+
/*
* Local variables:
* c-file-style: "linux"