From 58a44782d9a9a24c4f671526918fc58c74fad48c Mon Sep 17 00:00:00 2001 From: Aleksandr Mezin Date: Fri, 27 May 2016 15:13:18 +0600 Subject: [PATCH] python-lxc: don't use private lxc/confile.h Signed-off-by: Aleksandr Mezin --- src/python-lxc/lxc.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c index fbbabdb8f..b69116d79 100644 --- a/src/python-lxc/lxc.c +++ b/src/python-lxc/lxc.c @@ -25,7 +25,6 @@ #include #include "structmember.h" #include -#include "lxc/confile.h" #include #include #include @@ -58,6 +57,10 @@ # define CLONE_NEWNET 0x40000000 #endif +/* From sys/personality.h */ +#define PER_LINUX 0x0000 +#define PER_LINUX32 0x0008 + /* Helper functions */ /* Copied from lxc/utils.c */ @@ -77,6 +80,36 @@ again: return status; } +/* Copied from lxc/confile.c, with HAVE_SYS_PERSONALITY_H check removed */ +signed long lxc_config_parse_arch(const char *arch) +{ + struct per_name { + char *name; + unsigned long per; + } pername[] = { + { "x86", PER_LINUX32 }, + { "linux32", PER_LINUX32 }, + { "i386", PER_LINUX32 }, + { "i486", PER_LINUX32 }, + { "i586", PER_LINUX32 }, + { "i686", PER_LINUX32 }, + { "athlon", PER_LINUX32 }, + { "linux64", PER_LINUX }, + { "x86_64", PER_LINUX }, + { "amd64", PER_LINUX }, + }; + size_t len = sizeof(pername) / sizeof(pername[0]); + + size_t i; + + for (i = 0; i < len; i++) { + if (!strcmp(pername[i].name, arch)) + return pername[i].per; + } + + return -1; +} + char** convert_tuple_to_char_pointer_array(PyObject *argv) { int argc;