diff options
author | vhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com> | 2006-03-15 12:08:10 +0000 |
---|---|---|
committer | vhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com> | 2006-03-15 12:08:10 +0000 |
commit | 9d34613c4e15899b64e18b00a7ea1c8b411de31d (patch) | |
tree | 5a9a9b4076513c8d6a218b0e3e122a8b72bf323c /tools/xenstore/xenstored_core.c | |
parent | 5ad9b84e65eafa6e789c1f02b33a3dd86ef3ad44 (diff) | |
download | xen-9d34613c4e15899b64e18b00a7ea1c8b411de31d.tar.gz xen-9d34613c4e15899b64e18b00a7ea1c8b411de31d.tar.bz2 xen-9d34613c4e15899b64e18b00a7ea1c8b411de31d.zip |
move XS_DEBUG code into a proper function
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstored_core.c')
-rw-r--r-- | tools/xenstore/xenstored_core.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index bfa71f56bd..7076046801 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -1113,6 +1113,25 @@ static void do_set_perms(struct connection *conn, struct buffered_data *in) send_ack(conn, XS_SET_PERMS); } +static void do_debug(struct connection *conn, struct buffered_data *in) +{ + if (streq(in->buffer, "print")) + xprintf("debug: %s", in->buffer + get_string(in, 0)); + if (streq(in->buffer, "check")) + check_store(); +#ifdef TESTING + /* For testing, we allow them to set id. */ + if (streq(in->buffer, "setid")) { + conn->id = atoi(in->buffer + get_string(in, 0)); + } else if (streq(in->buffer, "failtest")) { + if (get_string(in, 0) < in->used) + srandom(atoi(in->buffer + get_string(in, 0))); + failtest = true; + } +#endif /* TESTING */ + send_ack(conn, XS_DEBUG); +} + /* Process "in" for conn: "in" will vanish after this conversation, so * we can talloc off it for temporary variables. May free "conn". */ @@ -1159,21 +1178,7 @@ static void process_message(struct connection *conn, struct buffered_data *in) break; case XS_DEBUG: - if (streq(in->buffer, "print")) - xprintf("debug: %s", in->buffer + get_string(in, 0)); - if (streq(in->buffer, "check")) - check_store(); -#ifdef TESTING - /* For testing, we allow them to set id. */ - if (streq(in->buffer, "setid")) { - conn->id = atoi(in->buffer + get_string(in, 0)); - } else if (streq(in->buffer, "failtest")) { - if (get_string(in, 0) < in->used) - srandom(atoi(in->buffer + get_string(in, 0))); - failtest = true; - } -#endif /* TESTING */ - send_ack(conn, XS_DEBUG); + do_debug(conn, in); break; case XS_WATCH: |