ia64/xen-unstable

changeset 3083:d6216cd62518

bitkeeper revision 1.1159.185.2 (41a269b15k7UWMnYkt8ucV_UMrjAtA)

Merge scramble.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-2.0-testing.bk
into scramble.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
author kaf24@scramble.cl.cam.ac.uk
date Mon Nov 22 22:35:29 2004 +0000 (2004-11-22)
parents bcf10071709c 4b6b3f4ac66d
children 3cfac953da9e
files tools/xfrd/Makefile tools/xfrd/debug.h tools/xfrd/sxpr_parser.c tools/xfrd/xen_domain.c tools/xfrd/xfrd.c
line diff
     1.1 --- a/tools/xfrd/Makefile	Mon Nov 22 17:51:03 2004 +0000
     1.2 +++ b/tools/xfrd/Makefile	Mon Nov 22 22:35:29 2004 +0000
     1.3 @@ -26,11 +26,15 @@ XFRD_PROG_OBJ += $(UTIL_LIB)
     1.4  # Define to use stubs, undefine to use the real Xen functions.
     1.5  #CPPFLAGS += -D _XEN_XFR_STUB_
     1.6  
     1.7 +ifeq ($(SXPR_DEBUG),1)
     1.8 +CPPFLAGS += -D _XEN_XFR_STUB_ -D SXPR_PARSER_MAIN
     1.9 +endif
    1.10 +
    1.11  CC := gcc
    1.12  
    1.13  CFLAGS += -g
    1.14  CFLAGS += -Wall
    1.15 -CFALGS += -Werror
    1.16 +CFLAGS += -Werror
    1.17  CFLAGS += $(INCLUDES)
    1.18  # Make gcc generate dependencies.
    1.19  CFLAGS += -Wp,-MD,.$(@F).d
     2.1 --- a/tools/xfrd/debug.h	Mon Nov 22 17:51:03 2004 +0000
     2.2 +++ b/tools/xfrd/debug.h	Mon Nov 22 22:35:29 2004 +0000
     2.3 @@ -45,6 +45,7 @@
     2.4  #else
     2.5  
     2.6  #include <stdio.h>
     2.7 +#include <unistd.h>
     2.8  
     2.9  #ifdef DEBUG
    2.10  
     3.1 --- a/tools/xfrd/sxpr_parser.c	Mon Nov 22 17:51:03 2004 +0000
     3.2 +++ b/tools/xfrd/sxpr_parser.c	Mon Nov 22 22:35:29 2004 +0000
     3.3 @@ -242,6 +242,8 @@ int Parser_pop(Parser *p){
     3.4      int err = 0;
     3.5      ParserState *s = p->state;
     3.6      p->state = s->parent;
     3.7 +    if (p->start_state == s)
     3.8 +        p->start_state = NULL;
     3.9      ParserState_free(s);
    3.10      return err;
    3.11  }
    3.12 @@ -374,7 +376,7 @@ Sxpr Parser_get_all(Parser *p){
    3.13      if(CONSP(p->val)){
    3.14          v = p->val;
    3.15          p->val = ONONE;
    3.16 -    } else if(CONSP(p->start_state->val)){
    3.17 +    } else if(p->start_state && CONSP(p->start_state->val)){
    3.18          v = p->start_state->val;
    3.19          p->start_state->val = ONULL;
    3.20          v = nrev(v);
    3.21 @@ -808,26 +810,13 @@ int at_eof(Parser *p){
    3.22      return p->eof;
    3.23  }
    3.24  
    3.25 -//#define SXPR_PARSER_MAIN
    3.26  #ifdef SXPR_PARSER_MAIN
    3.27  /* Stuff for standalone testing. */
    3.28  
    3.29  #include "file_stream.h"
    3.30  #include "string_stream.h"
    3.31  
    3.32 -int stringof(Sxpr exp, char **s){
    3.33 -    int err = 0;
    3.34 -    if(ATOMP(exp)){
    3.35 -        *s = atom_name(exp);
    3.36 -    } else if(STRINGP(exp)){
    3.37 -        *s = string_string(exp);
    3.38 -    } else {
    3.39 -        err = -EINVAL;
    3.40 -        *s = NULL;
    3.41 -    }
    3.42 -    return err;
    3.43 -}
    3.44 -
    3.45 +extern int stringof(Sxpr exp, char **s);
    3.46  int child_string(Sxpr exp, Sxpr key, char **s){
    3.47      int err = 0;
    3.48      Sxpr val = sxpr_child_value(exp, key, ONONE);
    3.49 @@ -835,22 +824,7 @@ int child_string(Sxpr exp, Sxpr key, cha
    3.50      return err;
    3.51  }
    3.52  
    3.53 -int intof(Sxpr exp, int *v){
    3.54 -    int err = 0;
    3.55 -    char *s;
    3.56 -    unsigned long l;
    3.57 -    if(INTP(exp)){
    3.58 -        *v = OBJ_INT(exp);
    3.59 -    } else {
    3.60 -        err = stringof(exp, &s);
    3.61 -        if(err) goto exit;
    3.62 -        err = convert_atoul(s, &l);
    3.63 -        *v = (int)l;
    3.64 -    }
    3.65 - exit:
    3.66 -    return err;
    3.67 -}
    3.68 -
    3.69 +extern int intof(Sxpr exp, int *v);
    3.70  int child_int(Sxpr exp, Sxpr key, int *v){
    3.71      int err = 0;
    3.72      Sxpr val = sxpr_child_value(exp, key, ONONE);
     4.1 --- a/tools/xfrd/xen_domain.c	Mon Nov 22 17:51:03 2004 +0000
     4.2 +++ b/tools/xfrd/xen_domain.c	Mon Nov 22 22:35:29 2004 +0000
     4.3 @@ -83,7 +83,7 @@ int xen_domain_snd(Conn *xend, IOStream 
     4.4      }
     4.5      
     4.6      dom = 99;
     4.7 -    err = domain_suspend(dom, xend);
     4.8 +    err = domain_suspend(xend, dom);
     4.9      IOStream_close(io);
    4.10    exit:
    4.11  #else 
     5.1 --- a/tools/xfrd/xfrd.c	Mon Nov 22 17:51:03 2004 +0000
     5.2 +++ b/tools/xfrd/xfrd.c	Mon Nov 22 22:35:29 2004 +0000
     5.3 @@ -171,6 +171,25 @@ void usage(int err){
     5.4      exit(err ? 1 : 0);
     5.5  }
     5.6  
     5.7 +typedef struct Args {
     5.8 +    int bufsize;
     5.9 +    unsigned long port;
    5.10 +    int verbose;
    5.11 +    int compress;
    5.12 +} Args;
    5.13 +
    5.14 +/** Transfer states. */
    5.15 +enum {
    5.16 +    XFR_INIT,
    5.17 +    XFR_HELLO,
    5.18 +    XFR_STATE,
    5.19 +    XFR_RUN,
    5.20 +    XFR_FAIL,
    5.21 +    XFR_DONE,
    5.22 +    XFR_MAX
    5.23 +};
    5.24 +
    5.25 +#ifndef SXPR_PARSER_MAIN
    5.26  /** Short options. Options followed by ':' take an argument. */
    5.27  static char *short_opts = (char[]){
    5.28      OPT_PORT,     ':',
    5.29 @@ -190,23 +209,12 @@ static struct option const long_opts[] =
    5.30      { NULL,         0,                 NULL, 0            }
    5.31  };
    5.32  
    5.33 -typedef struct Args {
    5.34 -    int bufsize;
    5.35 -    unsigned long port;
    5.36 -    int verbose;
    5.37 -    int compress;
    5.38 -} Args;
    5.39 +/** Xfrd arguments. */
    5.40 +static Args _args = {};
    5.41  
    5.42 -/** Transfer states. */
    5.43 -enum {
    5.44 -    XFR_INIT,
    5.45 -    XFR_HELLO,
    5.46 -    XFR_STATE,
    5.47 -    XFR_RUN,
    5.48 -    XFR_FAIL,
    5.49 -    XFR_DONE,
    5.50 -    XFR_MAX
    5.51 -};
    5.52 +/** Xfrd arguments. */
    5.53 +static Args *args = &_args;
    5.54 +#endif
    5.55  
    5.56  /** Initialize an array element for a constant to its string name. */
    5.57  #define VALDEF(val) { val, #val }
    5.58 @@ -318,12 +326,6 @@ int XfrState_first_err_state(XfrState *s
    5.59      return s->err_state;
    5.60  }
    5.61  
    5.62 -/** Xfrd arguments. */
    5.63 -static Args _args = {};
    5.64 -
    5.65 -/** Xfrd arguments. */
    5.66 -static Args *args = &_args;
    5.67 -
    5.68  /** Set xfrd default arguments.
    5.69   *
    5.70   * @param args arguments to set
    5.71 @@ -1212,6 +1214,7 @@ int xfrd_main(Args *args){
    5.72      return err;
    5.73  }
    5.74  
    5.75 +#ifndef SXPR_PARSER_MAIN
    5.76  /** Parse command-line arguments and call the xfrd main program.
    5.77   *
    5.78   * @param arg argument count
    5.79 @@ -1265,4 +1268,4 @@ int main(int argc, char *argv[]){
    5.80      }
    5.81      return (err ? 1 : 0);
    5.82  }
    5.83 -
    5.84 +#endif