confile_utils: add lxc_get_conf_uint64()

parent ce3f04bc
...@@ -17,9 +17,11 @@ ...@@ -17,9 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#define __STDC_FORMAT_MACROS
#include "config.h" #include "config.h"
#include <ctype.h> #include <ctype.h>
#include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -672,6 +674,16 @@ int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v) ...@@ -672,6 +674,16 @@ int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v)
return snprintf(retv, inlen, "%d", v); return snprintf(retv, inlen, "%d", v);
} }
int lxc_get_conf_uint64(struct lxc_conf *c, char *retv, int inlen, uint64_t v)
{
if (!retv)
inlen = 0;
else
memset(retv, 0, inlen);
return snprintf(retv, inlen, "%"PRIu64, v);
}
bool parse_limit_value(const char **value, rlim_t *res) bool parse_limit_value(const char **value, rlim_t *res)
{ {
char *endptr = NULL; char *endptr = NULL;
......
...@@ -84,5 +84,7 @@ extern void update_hwaddr(const char *line); ...@@ -84,5 +84,7 @@ extern void update_hwaddr(const char *line);
extern bool new_hwaddr(char *hwaddr); extern bool new_hwaddr(char *hwaddr);
extern int lxc_get_conf_str(char *retv, int inlen, const char *value); extern int lxc_get_conf_str(char *retv, int inlen, const char *value);
extern int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v); extern int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int 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 bool parse_limit_value(const char **value, rlim_t *res);
#endif /* __LXC_CONFILE_UTILS_H */ #endif /* __LXC_CONFILE_UTILS_H */
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