]> git.proxmox.com Git - mirror_lxc.git/commitdiff
test/: update API usage
authorFilippo Giunchedi <filippo@esaurito.net>
Sun, 7 Jun 2009 19:48:45 +0000 (21:48 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Sun, 7 Jun 2009 19:48:45 +0000 (21:48 +0200)
Hi,
I've been playing with lxc, though with --enable-test the test/ directory
doesn't compile, the following patch ought to fix this.
I've not tested tests throughly but seems straightforward enough.

Update the API usage in test/ as to make tests compile

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
13 files changed:
test/Makefile.am
test/conf.c
test/confile.c
test/dev.c
test/forward.c
test/ipv4_add.c
test/ipv6_add.c
test/lxc_low_monitor.c
test/macvlan.c
test/movedev.c
test/proxy.c
test/tst_list.c
test/veth.c

index bbc47e9614fcfc24a94ae190043db5f370c60c39..b9168694483bd93d9103639e49352b40c9692d56 100644 (file)
@@ -1,5 +1,7 @@
 if ENABLE_TEST
 
+AM_LDFLAGS = -lutil
+
 INCLUDES= -I$(top_srcdir)/src
 
 noinst_PROGRAMS = \
@@ -29,7 +31,8 @@ tst_list_LDADD = \
 
 confile_SOURCES = confile.c
 confile_LDADD = \
-       $(top_builddir)/src/lxc/lxc_config.o \
+       $(top_builddir)/src/lxc/conf.o \
+       $(top_builddir)/src/lxc/confile.o \
        $(top_builddir)/src/lxc/liblxc.la
 
 conf_SOURCES = conf.c
@@ -96,4 +99,4 @@ lxc_state_SOURCES = lxc_state.c
 lxc_state_LDADD = \
        $(top_builddir)/src/lxc/liblxc.la
 
-endif
\ No newline at end of file
+endif
index 441e3413cb1a695c53694ecefeb5772382a4c0d5..1ba500362a9a37092814d612499e7eb6d6a45fe6 100644 (file)
@@ -27,8 +27,8 @@
 #include <netinet/in.h>
 #include <net/if.h>
 
-#include <lxc/lxc_list.h>
-#include <lxc/lxc_conf.h>
+#include <lxc/list.h>
+#include <lxc/conf.h>
 
 /*
  * I want to setup a container with a veth attached on a bridge, 
index af82bf99d90b3a9f929bfc0257bf20bd9d21d8c8..10bed64196a64d5221b53900bf00a39ce213a616 100644 (file)
@@ -31,7 +31,8 @@
 #include <net/if.h>
 
 #include <lxc/lxc.h>
-#include <lxc/lxc_config.h>
+#include <lxc/conf.h>
+#include <lxc/confile.h>
 
 static void usage(const char *cmd)
 {
@@ -59,7 +60,7 @@ int main(int argc, char *argv[])
        if (!file || !name)
                usage(argv[0]);
 
-       if (lxc_config_init(&lxc_conf)) {
+       if (lxc_conf_init(&lxc_conf)) {
                fprintf(stderr, "failed to initialize configuration structure\n");
                return 1;
        }
index 82752369c55bc75438cb508b9115f542f0dc98e5..b19af44200728ede29dd6eb67426e2759d4f82e2 100644 (file)
@@ -60,11 +60,11 @@ int main(int argc, char *argv[])
        }
 
        if (destroy)
-               ret = device_delete(ifname);
+               ret = lxc_device_delete(ifname);
        else if (!strcmp(flag, "up"))
-               ret = device_up(ifname);
+               ret = lxc_device_up(ifname);
        else if (!strcmp(flag, "down"))
-               ret = device_down(ifname);
+               ret = lxc_device_down(ifname);
 
        if (ret) {
                fprintf(stderr, "failed to set %s: %s\n", 
index 81fead528eb39b2d3d22b8414abc28ab655e6bdd..1628d1a5f00d914bb9af42fb2c16b28a9c0feead 100644 (file)
@@ -59,9 +59,9 @@ int main(int argc, char *argv[])
        }
 
        if (!strcmp(flag, "on"))
-               ret = ip_forward_on(ifname, family);
+               ret = lxc_ip_forward_on(ifname, family);
        else if (!strcmp(flag, "off"))
-               ret = ip_forward_off(ifname, family);
+               ret = lxc_ip_forward_off(ifname, family);
        else {
                usage(argv[0]);
                return 1;
index bcd0cf9d45d1e158f2e2068425cd62822c70c8ae..84046d2132a5e80171ecbf8a4fd71b4a6c8b6f9e 100644 (file)
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
                return 1;
        }
        
-       ret = ip_addr_add(ifname, addr, 24, NULL);
+       ret = lxc_ip_addr_add(ifname, addr, 24, NULL);
        if (ret) {
                fprintf(stderr, "failed to set %s: %s\n", 
                        ifname, strerror(-ret));
index 20fc098c9a43fc75de459e25ed9511d556f50141..13de06fc21b8e1c0070602bb6f4ff3c7b48a61c8 100644 (file)
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
                return 1;
        }
        
-       ret = ip6_addr_add(ifname, addr, 64, NULL);
+       ret = lxc_ip6_addr_add(ifname, addr, 64, NULL);
        if (ret) {
                fprintf(stderr, "failed to set %s: %s\n", 
                        ifname, strerror(-ret));
index 02267d5ac6f04a9115175042decbaf3da429d29e..318be25389b13c66392f0eecc1ae9a662a8afdbd 100644 (file)
@@ -51,15 +51,17 @@ int main(int argc, char *argv[])
        if (!name)
                usage(argv[0]);
 
-       fd = lxc_monitor_open(name);
+       fd = lxc_monitor_open();
        if (fd < 0) {
                fprintf(stderr, "failed to open monitor\n");
                return -1;
        }
        
        for (;;) {
-               lxc_state_t state;
-               lxc_monitor_read(fd, &state);
-               printf("received changing state '%s'\n", lxc_state2str(state));
+               struct lxc_msg msg;
+               lxc_monitor_read(fd, &msg);
+               if (msg.type == lxc_msg_state) {
+                       printf("received changing state '%s'\n", lxc_state2str(msg.value));
+               }
        }
 }
index 4401d4f36de4ebca36c3c69e70c13d9fa1fb61d1..aad50d8f389e9dbaed118e8dcac25cbf0eb4d1cc 100644 (file)
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
                return 1;
        }
 
-       ret = macvlan_create(ifname, peer);
+       ret = lxc_macvlan_create(ifname, peer);
        if (ret) {
                fprintf(stderr, "failed to set %s/%s: %s\n", 
                        ifname, peer, strerror(-ret));
index 592434a126acd1a03ddc8083225007fd5316691f..1c4d9c353afaafb670f12f75d639b1c94a69cf7d 100644 (file)
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
                return 1;
        }
 
-       if (device_move(ifname, pid)) {
+       if (lxc_device_move(ifname, pid)) {
                fprintf(stderr, "failed to move %s\n", ifname);
                return 1;
        }
index f82f492c2bcaba9fd1573768146f9aa75e7dfdf5..97ed88678ec2f6440bc7878179c9b4b00366ae89 100644 (file)
@@ -59,9 +59,9 @@ int main(int argc, char *argv[])
        }
 
        if (!strcmp(flag, "on"))
-               ret = neigh_proxy_on(ifname, family);
+               ret = lxc_neigh_proxy_on(ifname, family);
        else if (!strcmp(flag, "off"))
-               ret = neigh_proxy_off(ifname, family);
+               ret = lxc_neigh_proxy_off(ifname, family);
        else {
                usage(argv[0]);
                return 1;
index 933b692bb7602a94e0a7fe7291013d771b5aaa0c..8b8816bc29fdd4815eb308cff51d916403796444 100644 (file)
@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include <string.h>
-#include <lxc/lxc_list.h>
+#include <lxc/list.h>
 
 int main(int argc, char *argv[])
 {
index 58a784c4de8ef3f535727c25ff2a142df7bb5b49..a47c62f327f129c860b1f8f0d0be4a2d138aebcb 100644 (file)
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
                return 1;
        }
 
-       ret = veth_create(ifname, peer);
+       ret = lxc_veth_create(ifname, peer);
        if (ret) {
                fprintf(stderr, "failed to set %s/%s: %s\n", 
                        ifname, peer, strerror(-ret));