From 823268475cd6a1c48ca2d942e47181691b471bf2 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Thu, 1 Mar 2012 19:54:53 +0000 Subject: [PATCH] Use 64 bit integers whenever extracting numbers from daemon replies. --- libdaemon/client/daemon-client.h | 4 ++-- libdm/libdevmapper.h | 1 + libdm/libdm-config.c | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libdaemon/client/daemon-client.h b/libdaemon/client/daemon-client.h index 7b2a80677..15fef709b 100644 --- a/libdaemon/client/daemon-client.h +++ b/libdaemon/client/daemon-client.h @@ -90,8 +90,8 @@ daemon_reply daemon_send_simple(daemon_handle h, const char *id, ...); void daemon_reply_destroy(daemon_reply r); -static inline int daemon_reply_int(daemon_reply r, const char *path, int def) { - return dm_config_find_int(r.cft->root, path, def); +static inline int64_t daemon_reply_int(daemon_reply r, const char *path, int64_t def) { + return dm_config_find_int64(r.cft->root, path, def); } static inline const char *daemon_reply_str(daemon_reply r, const char *path, const char *def) { diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index 83a3282eb..ce8b2bb16 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -1453,6 +1453,7 @@ int dm_config_has_node(const struct dm_config_node *cn, const char *path); const char *dm_config_find_str(const struct dm_config_node *cn, const char *path, const char *fail); const char *dm_config_find_str_allow_empty(const struct dm_config_node *cn, const char *path, const char *fail); int dm_config_find_int(const struct dm_config_node *cn, const char *path, int fail); +int64_t dm_config_find_int64(const struct dm_config_node *cn, const char *path, int64_t fail); float dm_config_find_float(const struct dm_config_node *cn, const char *path, float fail); const struct dm_config_node *dm_config_tree_find_node(const struct dm_config_tree *cft, const char *path); diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c index cd71f4e42..8683b5a57 100644 --- a/libdm/libdm-config.c +++ b/libdm/libdm-config.c @@ -877,6 +877,11 @@ int dm_config_find_int(const struct dm_config_node *cn, const char *path, int fa return (int) _find_config_int64(cn, _find_config_node, path, (int64_t) fail); } +int64_t dm_config_find_int64(const struct dm_config_node *cn, const char *path, int64_t fail) +{ + return _find_config_int64(cn, _find_config_node, path, fail); +} + float dm_config_find_float(const struct dm_config_node *cn, const char *path, float fail) {