mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/xenstored: add depth handling to XS_WATCH
In case XENSTORE_SERVER_FEATURE_WATCHDEPTH is set, allow XS_WATCH to have "depth" as 3rd parameter. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
This commit is contained in:
1 parent
db98de120c
commit
7d96cab925
3 files changed
+19
-2
No files matched your search
@@ -390,6 +390,14 @@ void wrl_apply_debit_trans_commit(struct connection *conn)
|
||||
wrl_apply_debit_actual(conn->domain);
|
||||
}
|
||||
|
||||
bool feature_available(const struct connection *conn, unsigned int feature)
|
||||
{
|
||||
if (!conn->domain)
|
||||
return XENSTORE_FEATURES & feature;
|
||||
|
||||
return conn->domain->features & feature;
|
||||
}
|
||||
|
||||
static unsigned int domain_get_soft_quota(struct domain *d, enum accitem what)
|
||||
{
|
||||
if (d && d->acc[what].val[Q_IDX_SOFT] != Q_VAL_DISABLED)
|
||||
|
||||
@@ -188,4 +188,6 @@ struct hashtable *domain_check_acc_init(void);
|
||||
void domain_check_acc_add(const struct node *node, struct hashtable *domains);
|
||||
void domain_check_acc(struct hashtable *domains);
|
||||
|
||||
bool feature_available(const struct connection *conn, unsigned int feature);
|
||||
|
||||
#endif /* _XENSTORED_DOMAIN_H */
|
||||
@@ -213,11 +213,18 @@ static struct watch *add_watch(struct connection *conn, const char *path,
|
||||
int do_watch(const void *ctx, struct connection *conn, struct buffered_data *in)
|
||||
{
|
||||
struct watch *watch;
|
||||
const char *vec[2];
|
||||
const char *vec[3];
|
||||
unsigned int n_pars;
|
||||
int depth = -1;
|
||||
bool relative;
|
||||
|
||||
if (get_strings(in, vec, ARRAY_SIZE(vec)) != ARRAY_SIZE(vec))
|
||||
n_pars = get_strings(in, vec, ARRAY_SIZE(vec));
|
||||
if (n_pars == 3 &&
|
||||
feature_available(conn, XENSTORE_SERVER_FEATURE_WATCHDEPTH)) {
|
||||
depth = atoi(vec[2]);
|
||||
if (depth < 0)
|
||||
return EINVAL;
|
||||
} else if (n_pars != 2)
|
||||
return EINVAL;
|
||||
|
||||
errno = check_watch_path(conn, ctx, &(vec[0]), &relative);
|
||||
|
||||