* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
-
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+#include <arpa/inet.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <arpa/inet.h>
#include "conf.h"
+#include "config.h"
#include "confile.h"
#include "confile_utils.h"
#include "error.h"
#include "list.h"
#include "log.h"
#include "lxccontainer.h"
+#include "macro.h"
#include "network.h"
#include "parse.h"
#include "utils.h"
TRACE("type: macvlan");
if (netdev->priv.macvlan_attr.mode > 0) {
- char *macvlan_mode;
+ char *mode;
- macvlan_mode = lxc_macvlan_flag_to_mode(
+ mode = lxc_macvlan_flag_to_mode(
netdev->priv.macvlan_attr.mode);
TRACE("macvlan mode: %s",
- macvlan_mode ? macvlan_mode
- : "(invalid mode)");
+ mode ? mode : "(invalid mode)");
}
break;
case LXC_NET_VLAN:
lxc_list_init(networks);
}
-static struct macvlan_mode {
+static struct lxc_macvlan_mode {
char *name;
int mode;
} macvlan_mode[] = {
retlen = strlcpy(valuep, value, size);
if (retlen >= size)
- ERROR("Network devie name \"%s\" is too long (>= %zu)", value,
+ ERROR("Network device name \"%s\" is too long (>= %zu)", value,
size);
return 0;
return value_len;
}
+int lxc_get_conf_bool(struct lxc_conf *c, char *retv, int inlen, bool v)
+{
+ int len;
+ int fulllen = 0;
+
+ if (!retv)
+ inlen = 0;
+ else
+ memset(retv, 0, inlen);
+
+ strprint(retv, inlen, "%d", v);
+
+ return fulllen;
+}
+
int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v)
{
int len;
{
char *endptr = NULL;
- if (strncmp(*value, "unlimited", sizeof("unlimited") - 1) == 0) {
+ if (strncmp(*value, "unlimited", STRLITERALLEN("unlimited")) == 0) {
*res = RLIM_INFINITY;
- *value += sizeof("unlimited") - 1;
+ *value += STRLITERALLEN("unlimited");
return true;
}