Commit 7e610d7f by Filippo Giunchedi Committed by Daniel Lezcano

test/: update API usage

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: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 14901127
if ENABLE_TEST if ENABLE_TEST
AM_LDFLAGS = -lutil
INCLUDES= -I$(top_srcdir)/src INCLUDES= -I$(top_srcdir)/src
noinst_PROGRAMS = \ noinst_PROGRAMS = \
...@@ -29,7 +31,8 @@ tst_list_LDADD = \ ...@@ -29,7 +31,8 @@ tst_list_LDADD = \
confile_SOURCES = confile.c confile_SOURCES = confile.c
confile_LDADD = \ 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 $(top_builddir)/src/lxc/liblxc.la
conf_SOURCES = conf.c conf_SOURCES = conf.c
...@@ -96,4 +99,4 @@ lxc_state_SOURCES = lxc_state.c ...@@ -96,4 +99,4 @@ lxc_state_SOURCES = lxc_state.c
lxc_state_LDADD = \ lxc_state_LDADD = \
$(top_builddir)/src/lxc/liblxc.la $(top_builddir)/src/lxc/liblxc.la
endif endif
\ No newline at end of file
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <net/if.h> #include <net/if.h>
#include <lxc/lxc_list.h> #include <lxc/list.h>
#include <lxc/lxc_conf.h> #include <lxc/conf.h>
/* /*
* I want to setup a container with a veth attached on a bridge, * I want to setup a container with a veth attached on a bridge,
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
#include <net/if.h> #include <net/if.h>
#include <lxc/lxc.h> #include <lxc/lxc.h>
#include <lxc/lxc_config.h> #include <lxc/conf.h>
#include <lxc/confile.h>
static void usage(const char *cmd) static void usage(const char *cmd)
{ {
...@@ -59,7 +60,7 @@ int main(int argc, char *argv[]) ...@@ -59,7 +60,7 @@ int main(int argc, char *argv[])
if (!file || !name) if (!file || !name)
usage(argv[0]); usage(argv[0]);
if (lxc_config_init(&lxc_conf)) { if (lxc_conf_init(&lxc_conf)) {
fprintf(stderr, "failed to initialize configuration structure\n"); fprintf(stderr, "failed to initialize configuration structure\n");
return 1; return 1;
} }
......
...@@ -60,11 +60,11 @@ int main(int argc, char *argv[]) ...@@ -60,11 +60,11 @@ int main(int argc, char *argv[])
} }
if (destroy) if (destroy)
ret = device_delete(ifname); ret = lxc_device_delete(ifname);
else if (!strcmp(flag, "up")) else if (!strcmp(flag, "up"))
ret = device_up(ifname); ret = lxc_device_up(ifname);
else if (!strcmp(flag, "down")) else if (!strcmp(flag, "down"))
ret = device_down(ifname); ret = lxc_device_down(ifname);
if (ret) { if (ret) {
fprintf(stderr, "failed to set %s: %s\n", fprintf(stderr, "failed to set %s: %s\n",
......
...@@ -59,9 +59,9 @@ int main(int argc, char *argv[]) ...@@ -59,9 +59,9 @@ int main(int argc, char *argv[])
} }
if (!strcmp(flag, "on")) if (!strcmp(flag, "on"))
ret = ip_forward_on(ifname, family); ret = lxc_ip_forward_on(ifname, family);
else if (!strcmp(flag, "off")) else if (!strcmp(flag, "off"))
ret = ip_forward_off(ifname, family); ret = lxc_ip_forward_off(ifname, family);
else { else {
usage(argv[0]); usage(argv[0]);
return 1; return 1;
......
...@@ -55,7 +55,7 @@ int main(int argc, char *argv[]) ...@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
ret = ip_addr_add(ifname, addr, 24, NULL); ret = lxc_ip_addr_add(ifname, addr, 24, NULL);
if (ret) { if (ret) {
fprintf(stderr, "failed to set %s: %s\n", fprintf(stderr, "failed to set %s: %s\n",
ifname, strerror(-ret)); ifname, strerror(-ret));
......
...@@ -55,7 +55,7 @@ int main(int argc, char *argv[]) ...@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
ret = ip6_addr_add(ifname, addr, 64, NULL); ret = lxc_ip6_addr_add(ifname, addr, 64, NULL);
if (ret) { if (ret) {
fprintf(stderr, "failed to set %s: %s\n", fprintf(stderr, "failed to set %s: %s\n",
ifname, strerror(-ret)); ifname, strerror(-ret));
......
...@@ -51,15 +51,17 @@ int main(int argc, char *argv[]) ...@@ -51,15 +51,17 @@ int main(int argc, char *argv[])
if (!name) if (!name)
usage(argv[0]); usage(argv[0]);
fd = lxc_monitor_open(name); fd = lxc_monitor_open();
if (fd < 0) { if (fd < 0) {
fprintf(stderr, "failed to open monitor\n"); fprintf(stderr, "failed to open monitor\n");
return -1; return -1;
} }
for (;;) { for (;;) {
lxc_state_t state; struct lxc_msg msg;
lxc_monitor_read(fd, &state); lxc_monitor_read(fd, &msg);
printf("received changing state '%s'\n", lxc_state2str(state)); if (msg.type == lxc_msg_state) {
printf("received changing state '%s'\n", lxc_state2str(msg.value));
}
} }
} }
...@@ -55,7 +55,7 @@ int main(int argc, char *argv[]) ...@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
ret = macvlan_create(ifname, peer); ret = lxc_macvlan_create(ifname, peer);
if (ret) { if (ret) {
fprintf(stderr, "failed to set %s/%s: %s\n", fprintf(stderr, "failed to set %s/%s: %s\n",
ifname, peer, strerror(-ret)); ifname, peer, strerror(-ret));
......
...@@ -55,7 +55,7 @@ int main(int argc, char *argv[]) ...@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
if (device_move(ifname, pid)) { if (lxc_device_move(ifname, pid)) {
fprintf(stderr, "failed to move %s\n", ifname); fprintf(stderr, "failed to move %s\n", ifname);
return 1; return 1;
} }
......
...@@ -59,9 +59,9 @@ int main(int argc, char *argv[]) ...@@ -59,9 +59,9 @@ int main(int argc, char *argv[])
} }
if (!strcmp(flag, "on")) if (!strcmp(flag, "on"))
ret = neigh_proxy_on(ifname, family); ret = lxc_neigh_proxy_on(ifname, family);
else if (!strcmp(flag, "off")) else if (!strcmp(flag, "off"))
ret = neigh_proxy_off(ifname, family); ret = lxc_neigh_proxy_off(ifname, family);
else { else {
usage(argv[0]); usage(argv[0]);
return 1; return 1;
......
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <lxc/lxc_list.h> #include <lxc/list.h>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
......
...@@ -55,7 +55,7 @@ int main(int argc, char *argv[]) ...@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
ret = veth_create(ifname, peer); ret = lxc_veth_create(ifname, peer);
if (ret) { if (ret) {
fprintf(stderr, "failed to set %s/%s: %s\n", fprintf(stderr, "failed to set %s/%s: %s\n",
ifname, peer, strerror(-ret)); ifname, peer, strerror(-ret));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment