From 397aa9235e12885cd96ddfb4ba507ea0e5d98f11 Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Fri, 12 Oct 2012 10:45:36 +0530 Subject: features/quota: Accept float numbers for quota limit. Quota limit can be given a floating value like 2.5GB or 0.5TB, which was not possible before. Change-Id: I2c89fd521e8b70be51252677c7986abcfa9d11a2 BUG: 819394 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/4068 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/common-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libglusterfs/src/common-utils.c') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 63d7f6e35..146384fe9 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1257,7 +1257,7 @@ err: int gf_string2bytesize (const char *str, uint64_t *n) { - uint64_t value = 0ULL; + double value = 0.0; char *tail = NULL; int old_errno = 0; const char *s = NULL; @@ -1278,7 +1278,7 @@ gf_string2bytesize (const char *str, uint64_t *n) old_errno = errno; errno = 0; - value = strtoull (str, &tail, 10); + value = strtod (str, &tail); if (errno == ERANGE || errno == EINVAL) return -1; @@ -1302,7 +1302,7 @@ gf_string2bytesize (const char *str, uint64_t *n) return -1; } - *n = value; + *n = (uint64_t) value; return 0; } -- cgit