ia64/xen-unstable

changeset 3084:5281b60ddd27

bitkeeper revision 1.1159.183.4 (41a26aceaXU8CHj-DqjbnM3q7zLf2g)

Merge ssh://xenbk@gandalf.hpl.hp.com//var/bk/xeno-unstable.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/iap10/xeno-clone/xeno.bk
author iap10@labyrinth.cl.cam.ac.uk
date Mon Nov 22 22:40:14 2004 +0000 (2004-11-22)
parents 0dfcf477fdd3 4b6b3f4ac66d
children 3cfac953da9e b7cbbc4c7a3e
files tools/libxutil/sxpr_parser.c tools/xfrd/Makefile tools/xfrd/debug.h tools/xfrd/xen_domain.c tools/xfrd/xfrd.c
line diff
     1.1 --- a/tools/libxutil/sxpr_parser.c	Mon Nov 22 16:49:15 2004 +0000
     1.2 +++ b/tools/libxutil/sxpr_parser.c	Mon Nov 22 22:40:14 2004 +0000
     1.3 @@ -258,6 +258,8 @@ int Parser_pop(Parser *p){
     1.4      int err = 0;
     1.5      ParserState *s = p->state;
     1.6      p->state = s->parent;
     1.7 +    if (p->start_state == s)
     1.8 +        p->start_state = NULL;
     1.9      ParserState_free(s);
    1.10      return err;
    1.11  }
    1.12 @@ -390,7 +392,7 @@ Sxpr Parser_get_all(Parser *p){
    1.13      if(CONSP(p->val)){
    1.14          v = p->val;
    1.15          p->val = ONONE;
    1.16 -    } else if(CONSP(p->start_state->val)){
    1.17 +    } else if(p->start_state && CONSP(p->start_state->val)){
    1.18          v = p->start_state->val;
    1.19          p->start_state->val = ONULL;
    1.20          v = nrev(v);
    1.21 @@ -824,26 +826,13 @@ int at_eof(Parser *p){
    1.22      return p->eof;
    1.23  }
    1.24  
    1.25 -//#define SXPR_PARSER_MAIN
    1.26  #ifdef SXPR_PARSER_MAIN
    1.27  /* Stuff for standalone testing. */
    1.28  
    1.29  #include "file_stream.h"
    1.30  #include "string_stream.h"
    1.31  
    1.32 -int stringof(Sxpr exp, char **s){
    1.33 -    int err = 0;
    1.34 -    if(ATOMP(exp)){
    1.35 -        *s = atom_name(exp);
    1.36 -    } else if(STRINGP(exp)){
    1.37 -        *s = string_string(exp);
    1.38 -    } else {
    1.39 -        err = -EINVAL;
    1.40 -        *s = NULL;
    1.41 -    }
    1.42 -    return err;
    1.43 -}
    1.44 -
    1.45 +extern int stringof(Sxpr exp, char **s);
    1.46  int child_string(Sxpr exp, Sxpr key, char **s){
    1.47      int err = 0;
    1.48      Sxpr val = sxpr_child_value(exp, key, ONONE);
    1.49 @@ -851,22 +840,7 @@ int child_string(Sxpr exp, Sxpr key, cha
    1.50      return err;
    1.51  }
    1.52  
    1.53 -int intof(Sxpr exp, int *v){
    1.54 -    int err = 0;
    1.55 -    char *s;
    1.56 -    unsigned long l;
    1.57 -    if(INTP(exp)){
    1.58 -        *v = OBJ_INT(exp);
    1.59 -    } else {
    1.60 -        err = stringof(exp, &s);
    1.61 -        if(err) goto exit;
    1.62 -        err = convert_atoul(s, &l);
    1.63 -        *v = (int)l;
    1.64 -    }
    1.65 - exit:
    1.66 -    return err;
    1.67 -}
    1.68 -
    1.69 +extern int intof(Sxpr exp, int *v);
    1.70  int child_int(Sxpr exp, Sxpr key, int *v){
    1.71      int err = 0;
    1.72      Sxpr val = sxpr_child_value(exp, key, ONONE);
     2.1 --- a/tools/xfrd/Makefile	Mon Nov 22 16:49:15 2004 +0000
     2.2 +++ b/tools/xfrd/Makefile	Mon Nov 22 22:40:14 2004 +0000
     2.3 @@ -26,11 +26,15 @@ XFRD_PROG_OBJ += $(UTIL_LIB)
     2.4  # Define to use stubs, undefine to use the real Xen functions.
     2.5  #CPPFLAGS += -D _XEN_XFR_STUB_
     2.6  
     2.7 +ifeq ($(SXPR_DEBUG),1)
     2.8 +CPPFLAGS += -D _XEN_XFR_STUB_ -D SXPR_PARSER_MAIN
     2.9 +endif
    2.10 +
    2.11  CC := gcc
    2.12  
    2.13  CFLAGS += -g
    2.14  CFLAGS += -Wall
    2.15 -CFALGS += -Werror
    2.16 +CFLAGS += -Werror
    2.17  CFLAGS += $(INCLUDES)
    2.18  # Make gcc generate dependencies.
    2.19  CFLAGS += -Wp,-MD,.$(@F).d
     3.1 --- a/tools/xfrd/debug.h	Mon Nov 22 16:49:15 2004 +0000
     3.2 +++ b/tools/xfrd/debug.h	Mon Nov 22 22:40:14 2004 +0000
     3.3 @@ -45,6 +45,7 @@
     3.4  #else
     3.5  
     3.6  #include <stdio.h>
     3.7 +#include <unistd.h>
     3.8  
     3.9  #ifdef DEBUG
    3.10  
     4.1 --- a/tools/xfrd/xen_domain.c	Mon Nov 22 16:49:15 2004 +0000
     4.2 +++ b/tools/xfrd/xen_domain.c	Mon Nov 22 22:40:14 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 16:49:15 2004 +0000
     5.2 +++ b/tools/xfrd/xfrd.c	Mon Nov 22 22:40:14 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