diff options
author | cl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk> | 2005-07-26 15:13:56 +0000 |
---|---|---|
committer | cl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk> | 2005-07-26 15:13:56 +0000 |
commit | e04c630cb24b65d871f061074bea23174cadf841 (patch) | |
tree | 31950e1ab897968f879a0513db58b1f3f9dfe6c9 /tools/xenstore/xenstored_core.h | |
parent | e08ecc0000058e476a61af2b503ce34580bd63bc (diff) | |
download | xen-e04c630cb24b65d871f061074bea23174cadf841.tar.gz xen-e04c630cb24b65d871f061074bea23174cadf841.tar.bz2 xen-e04c630cb24b65d871f061074bea23174cadf841.zip |
Change from bool indicating blocked to an enum: when watches go
synchronous this makes it easier (because then we have two reasons
to block)
Instead of using return value, use explicit state member inside
struct connection.
Signed-off-by: Rusty Russel <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Diffstat (limited to 'tools/xenstore/xenstored_core.h')
-rw-r--r-- | tools/xenstore/xenstored_core.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h index 4aae32e95e..75a9bfe0a6 100644 --- a/tools/xenstore/xenstored_core.h +++ b/tools/xenstore/xenstored_core.h @@ -47,6 +47,14 @@ struct connection; typedef int connwritefn_t(struct connection *, const void *, unsigned int); typedef int connreadfn_t(struct connection *, void *, unsigned int); +enum state +{ + /* Blocked by transaction. */ + BLOCKED, + /* Completed */ + OK, +}; + struct connection { struct list_head list; @@ -57,8 +65,11 @@ struct connection /* Who am I? 0 for socket connections. */ domid_t id; - /* Are we blocked waiting for a transaction to end? Contains node. */ - char *blocked; + /* Blocked on transaction? */ + enum state state; + + /* Node we are waiting for (if state == BLOCKED) */ + char *blocked_by; /* Is this a read-only connection? */ bool can_write; @@ -100,14 +111,14 @@ bool is_child(const char *child, const char *parent); /* Create a new buffer with lifetime of context. */ struct buffered_data *new_buffer(void *ctx); -bool send_reply(struct connection *conn, enum xsd_sockmsg_type type, - const void *data, unsigned int len); +void send_reply(struct connection *conn, enum xsd_sockmsg_type type, + const void *data, unsigned int len); /* Some routines (write, mkdir, etc) just need a non-error return */ -bool send_ack(struct connection *conn, enum xsd_sockmsg_type type); +void send_ack(struct connection *conn, enum xsd_sockmsg_type type); /* Send an error: error is usually "errno". */ -bool send_error(struct connection *conn, int error); +void send_error(struct connection *conn, int error); /* Canonicalize this path if possible. */ char *canonicalize(struct connection *conn, const char *node); |