aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xfrd
diff options
context:
space:
mode:
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2004-11-22 22:40:14 +0000
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2004-11-22 22:40:14 +0000
commit62d6a29b71d8fbdedfcb63c2cd1bfc72392bfa3e (patch)
treefeff303bf10a37b2b750601bbe0273108bc7a4a1 /tools/xfrd
parent9b16be0d193484f12088efa92862113629286610 (diff)
parent4c24023b976968dee9d65378dddeb0e083021b9d (diff)
downloadxen-62d6a29b71d8fbdedfcb63c2cd1bfc72392bfa3e.tar.gz
xen-62d6a29b71d8fbdedfcb63c2cd1bfc72392bfa3e.tar.bz2
xen-62d6a29b71d8fbdedfcb63c2cd1bfc72392bfa3e.zip
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
Diffstat (limited to 'tools/xfrd')
-rw-r--r--tools/xfrd/Makefile6
-rw-r--r--tools/xfrd/debug.h1
-rw-r--r--tools/xfrd/xen_domain.c2
-rw-r--r--tools/xfrd/xfrd.c49
4 files changed, 33 insertions, 25 deletions
diff --git a/tools/xfrd/Makefile b/tools/xfrd/Makefile
index c1478ce690..2330d829c4 100644
--- a/tools/xfrd/Makefile
+++ b/tools/xfrd/Makefile
@@ -26,11 +26,15 @@ XFRD_PROG_OBJ += $(UTIL_LIB)
# Define to use stubs, undefine to use the real Xen functions.
#CPPFLAGS += -D _XEN_XFR_STUB_
+ifeq ($(SXPR_DEBUG),1)
+CPPFLAGS += -D _XEN_XFR_STUB_ -D SXPR_PARSER_MAIN
+endif
+
CC := gcc
CFLAGS += -g
CFLAGS += -Wall
-CFALGS += -Werror
+CFLAGS += -Werror
CFLAGS += $(INCLUDES)
# Make gcc generate dependencies.
CFLAGS += -Wp,-MD,.$(@F).d
diff --git a/tools/xfrd/debug.h b/tools/xfrd/debug.h
index 1f5a19d54d..3df5345095 100644
--- a/tools/xfrd/debug.h
+++ b/tools/xfrd/debug.h
@@ -45,6 +45,7 @@
#else
#include <stdio.h>
+#include <unistd.h>
#ifdef DEBUG
diff --git a/tools/xfrd/xen_domain.c b/tools/xfrd/xen_domain.c
index abc7b7dc3c..64567900b4 100644
--- a/tools/xfrd/xen_domain.c
+++ b/tools/xfrd/xen_domain.c
@@ -83,7 +83,7 @@ int xen_domain_snd(Conn *xend, IOStream *io,
}
dom = 99;
- err = domain_suspend(dom, xend);
+ err = domain_suspend(xend, dom);
IOStream_close(io);
exit:
#else
diff --git a/tools/xfrd/xfrd.c b/tools/xfrd/xfrd.c
index 236b67755b..136a614aa3 100644
--- a/tools/xfrd/xfrd.c
+++ b/tools/xfrd/xfrd.c
@@ -171,6 +171,25 @@ void usage(int err){
exit(err ? 1 : 0);
}
+typedef struct Args {
+ int bufsize;
+ unsigned long port;
+ int verbose;
+ int compress;
+} Args;
+
+/** Transfer states. */
+enum {
+ XFR_INIT,
+ XFR_HELLO,
+ XFR_STATE,
+ XFR_RUN,
+ XFR_FAIL,
+ XFR_DONE,
+ XFR_MAX
+};
+
+#ifndef SXPR_PARSER_MAIN
/** Short options. Options followed by ':' take an argument. */
static char *short_opts = (char[]){
OPT_PORT, ':',
@@ -190,23 +209,12 @@ static struct option const long_opts[] = {
{ NULL, 0, NULL, 0 }
};
-typedef struct Args {
- int bufsize;
- unsigned long port;
- int verbose;
- int compress;
-} Args;
+/** Xfrd arguments. */
+static Args _args = {};
-/** Transfer states. */
-enum {
- XFR_INIT,
- XFR_HELLO,
- XFR_STATE,
- XFR_RUN,
- XFR_FAIL,
- XFR_DONE,
- XFR_MAX
-};
+/** Xfrd arguments. */
+static Args *args = &_args;
+#endif
/** Initialize an array element for a constant to its string name. */
#define VALDEF(val) { val, #val }
@@ -318,12 +326,6 @@ int XfrState_first_err_state(XfrState *s){
return s->err_state;
}
-/** Xfrd arguments. */
-static Args _args = {};
-
-/** Xfrd arguments. */
-static Args *args = &_args;
-
/** Set xfrd default arguments.
*
* @param args arguments to set
@@ -1212,6 +1214,7 @@ int xfrd_main(Args *args){
return err;
}
+#ifndef SXPR_PARSER_MAIN
/** Parse command-line arguments and call the xfrd main program.
*
* @param arg argument count
@@ -1265,4 +1268,4 @@ int main(int argc, char *argv[]){
}
return (err ? 1 : 0);
}
-
+#endif