]> git.proxmox.com Git - mirror_lxc.git/commitdiff
confile: make parse_limit_value() static
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 4 Mar 2019 19:31:52 +0000 (20:31 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 4 Mar 2019 19:42:12 +0000 (20:42 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c
src/lxc/confile_utils.c
src/lxc/confile_utils.h

index a61add7544691c4821d9ca7edd350dce7c42764f..8f94635d1bfc0a025687f40645fa6afadee348c4 100644 (file)
@@ -1450,6 +1450,26 @@ static int set_config_cgroup_relative(const char *key, const char *value,
        return -EINVAL;
 }
 
+static bool parse_limit_value(const char **value, rlim_t *res)
+{
+       char *endptr = NULL;
+
+       if (strncmp(*value, "unlimited", STRLITERALLEN("unlimited")) == 0) {
+               *res = RLIM_INFINITY;
+               *value += STRLITERALLEN("unlimited");
+               return true;
+       }
+
+       errno = 0;
+       *res = strtoull(*value, &endptr, 10);
+       if (errno || !endptr)
+               return false;
+
+       *value = endptr;
+
+       return true;
+}
+
 static int set_config_prlimit(const char *key, const char *value,
                            struct lxc_conf *lxc_conf, void *data)
 {
index 72db49a080095a1c1e164bece172388f99a00204..50777c448190db68193ee230a9b08f5baa416d40 100644 (file)
@@ -669,6 +669,7 @@ int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v)
 
        return fulllen;
 }
+
 int lxc_get_conf_size_t(struct lxc_conf *c, char *retv, int inlen, size_t v)
 {
        int len;
@@ -699,26 +700,6 @@ int lxc_get_conf_uint64(struct lxc_conf *c, char *retv, int inlen, uint64_t v)
        return fulllen;
 }
 
-bool parse_limit_value(const char **value, rlim_t *res)
-{
-       char *endptr = NULL;
-
-       if (strncmp(*value, "unlimited", STRLITERALLEN("unlimited")) == 0) {
-               *res = RLIM_INFINITY;
-               *value += STRLITERALLEN("unlimited");
-               return true;
-       }
-
-       errno = 0;
-       *res = strtoull(*value, &endptr, 10);
-       if (errno || !endptr)
-               return false;
-
-       *value = endptr;
-
-       return true;
-}
-
 static int lxc_container_name_to_pid(const char *lxcname_or_pid,
                                     const char *lxcpath)
 {
index b097edc0fb28cdda1de2fcacc70846e5729228e6..5a3bcc914cd58b138ea803886169fb0cd0493877 100644 (file)
@@ -73,7 +73,6 @@ extern int lxc_get_conf_bool(struct lxc_conf *c, char *retv, int inlen, bool v);
 extern int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v);
 extern int lxc_get_conf_size_t(struct lxc_conf *c, char *retv, int inlen, size_t v);
 extern int lxc_get_conf_uint64(struct lxc_conf *c, char *retv, int inlen, uint64_t v);
-extern bool parse_limit_value(const char **value, rlim_t *res);
 extern int lxc_inherit_namespace(const char *lxcname_or_pid,
                                 const char *lxcpath, const char *namespace);
 extern int sig_parse(const char *signame);