ia64/xen-unstable

changeset 9292:51b0d4c2d4d9

move XS_DEBUG code into a proper function

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Wed Mar 15 12:08:10 2006 +0000 (2006-03-15)
parents c097485037f7
children 250ff103c291
files tools/xenstore/xenstored_core.c
line diff
     1.1 --- a/tools/xenstore/xenstored_core.c	Wed Mar 15 12:41:58 2006 +0100
     1.2 +++ b/tools/xenstore/xenstored_core.c	Wed Mar 15 12:08:10 2006 +0000
     1.3 @@ -1113,6 +1113,25 @@ static void do_set_perms(struct connecti
     1.4  	send_ack(conn, XS_SET_PERMS);
     1.5  }
     1.6  
     1.7 +static void do_debug(struct connection *conn, struct buffered_data *in)
     1.8 +{
     1.9 +	if (streq(in->buffer, "print"))
    1.10 +		xprintf("debug: %s", in->buffer + get_string(in, 0));
    1.11 +	if (streq(in->buffer, "check"))
    1.12 +		check_store();
    1.13 +#ifdef TESTING
    1.14 +	/* For testing, we allow them to set id. */
    1.15 +	if (streq(in->buffer, "setid")) {
    1.16 +		conn->id = atoi(in->buffer + get_string(in, 0));
    1.17 +	} else if (streq(in->buffer, "failtest")) {
    1.18 +		if (get_string(in, 0) < in->used)
    1.19 +			srandom(atoi(in->buffer + get_string(in, 0)));
    1.20 +		failtest = true;
    1.21 +	}
    1.22 +#endif /* TESTING */
    1.23 +	send_ack(conn, XS_DEBUG);
    1.24 +}
    1.25 +
    1.26  /* Process "in" for conn: "in" will vanish after this conversation, so
    1.27   * we can talloc off it for temporary variables.  May free "conn".
    1.28   */
    1.29 @@ -1159,21 +1178,7 @@ static void process_message(struct conne
    1.30  		break;
    1.31  
    1.32  	case XS_DEBUG:
    1.33 -		if (streq(in->buffer, "print"))
    1.34 -			xprintf("debug: %s", in->buffer + get_string(in, 0));
    1.35 -		if (streq(in->buffer, "check"))
    1.36 -			check_store();
    1.37 -#ifdef TESTING
    1.38 -		/* For testing, we allow them to set id. */
    1.39 -		if (streq(in->buffer, "setid")) {
    1.40 -			conn->id = atoi(in->buffer + get_string(in, 0));
    1.41 -		} else if (streq(in->buffer, "failtest")) {
    1.42 -			if (get_string(in, 0) < in->used)
    1.43 -				srandom(atoi(in->buffer + get_string(in, 0)));
    1.44 -			failtest = true;
    1.45 -		}
    1.46 -#endif /* TESTING */
    1.47 -		send_ack(conn, XS_DEBUG);
    1.48 +		do_debug(conn, in);
    1.49  		break;
    1.50  
    1.51  	case XS_WATCH: