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:
Juergen Gross authored and Jan Beulich committed 2026-04-22 08:58:18 +02:00
1 parent db98de120c
commit 7d96cab925
3 files changed
+19 -2

No files matched your search

+8
View File
@@ -390,6 +390,14 @@ void wrl_apply_debit_trans_commit(struct connection *conn)
wrl_apply_debit_actual(conn->domain); 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) 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) if (d && d->acc[what].val[Q_IDX_SOFT] != Q_VAL_DISABLED)
+2
View File
@@ -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_add(const struct node *node, struct hashtable *domains);
void domain_check_acc(struct hashtable *domains); void domain_check_acc(struct hashtable *domains);
bool feature_available(const struct connection *conn, unsigned int feature);
#endif /* _XENSTORED_DOMAIN_H */ #endif /* _XENSTORED_DOMAIN_H */
+9 -2
View File
@@ -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) int do_watch(const void *ctx, struct connection *conn, struct buffered_data *in)
{ {
struct watch *watch; struct watch *watch;
const char *vec[2]; const char *vec[3];
unsigned int n_pars;
int depth = -1; int depth = -1;
bool relative; 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; return EINVAL;
errno = check_watch_path(conn, ctx, &(vec[0]), &relative); errno = check_watch_path(conn, ctx, &(vec[0]), &relative);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.