summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.c
diff options
context:
space:
mode:
authorVarun Shastry <vshastry@redhat.com>2012-10-12 10:45:36 +0530
committerAnand Avati <avati@redhat.com>2012-10-12 00:14:53 -0700
commit397aa9235e12885cd96ddfb4ba507ea0e5d98f11 (patch)
tree34de1483115ea9fa5b4fb43f2a4a7dbf5bd6bc13 /libglusterfs/src/common-utils.c
parent3dd35245f34a574303617828ed5d1f3cf6fdcdb9 (diff)
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 <vshastry@redhat.com> Reviewed-on: http://review.gluster.org/4068 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r--libglusterfs/src/common-utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 63d7f6e3530..146384fe94d 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;
}