summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/options.c')
-rw-r--r--libglusterfs/src/options.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c
index 30607d2e390..c95808bcb28 100644
--- a/libglusterfs/src/options.c
+++ b/libglusterfs/src/options.c
@@ -121,12 +121,12 @@ static int
xlator_option_validate_sizet(xlator_t *xl, const char *key, const char *value,
volume_option_t *opt, char **op_errstr)
{
- size_t size = 0;
+ uint64_t size = 0;
int ret = 0;
char errstr[256];
/* Check the range */
- if (gf_string2bytesize_size(value, &size) != 0) {
+ if (gf_string2bytesize_uint64(value, &size) != 0) {
snprintf(errstr, 256, "invalid number format \"%s\" in option \"%s\"",
value, key);
gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
@@ -144,9 +144,8 @@ xlator_option_validate_sizet(xlator_t *xl, const char *key, const char *value,
if ((size < opt->min) || (size > opt->max)) {
snprintf(errstr, 256,
- "'%" GF_PRI_SIZET
- "' in 'option %s %s' "
- "is out of range [%.0f - %.0f]",
+ "'%" PRIu64
+ "' in 'option %s %s' is out of range [%.0f - %.0f]",
size, key, value, opt->min, opt->max);
gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", errstr);
ret = -1;
@@ -706,12 +705,12 @@ out:
static int
gf_validate_size(const char *sizestr, volume_option_t *opt)
{
- size_t value = 0;
+ uint64_t value = 0;
int ret = 0;
GF_ASSERT(opt);
- if (gf_string2bytesize_size(sizestr, &value) != 0 || value < opt->min ||
+ if (gf_string2bytesize_uint64(sizestr, &value) != 0 || value < opt->min ||
value % 512) {
ret = -1;
goto out;
@@ -1200,18 +1199,18 @@ pc_or_size(char *in, double *out)
{
double pc = 0;
int ret = 0;
- size_t size = 0;
+ uint64_t size = 0;
if (gf_string2percent(in, &pc) == 0) {
if (pc > 100.0) {
- ret = gf_string2bytesize_size(in, &size);
+ ret = gf_string2bytesize_uint64(in, &size);
if (!ret)
*out = size;
} else {
*out = pc;
}
} else {
- ret = gf_string2bytesize_size(in, &size);
+ ret = gf_string2bytesize_uint64(in, &size);
if (!ret)
*out = size;
}
@@ -1223,7 +1222,7 @@ DEFINE_INIT_OPT(uint64_t, uint64, gf_string2uint64);
DEFINE_INIT_OPT(int64_t, int64, gf_string2int64);
DEFINE_INIT_OPT(uint32_t, uint32, gf_string2uint32);
DEFINE_INIT_OPT(int32_t, int32, gf_string2int32);
-DEFINE_INIT_OPT(size_t, size, gf_string2bytesize_size);
+DEFINE_INIT_OPT(uint64_t, size, gf_string2bytesize_uint64);
DEFINE_INIT_OPT(uint64_t, size_uint64, gf_string2bytesize_uint64);
DEFINE_INIT_OPT(double, percent, gf_string2percent);
DEFINE_INIT_OPT(double, percent_or_size, pc_or_size);
@@ -1238,7 +1237,7 @@ DEFINE_RECONF_OPT(uint64_t, uint64, gf_string2uint64);
DEFINE_RECONF_OPT(int64_t, int64, gf_string2int64);
DEFINE_RECONF_OPT(uint32_t, uint32, gf_string2uint32);
DEFINE_RECONF_OPT(int32_t, int32, gf_string2int32);
-DEFINE_RECONF_OPT(size_t, size, gf_string2bytesize_size);
+DEFINE_RECONF_OPT(uint64_t, size, gf_string2bytesize_uint64);
DEFINE_RECONF_OPT(uint64_t, size_uint64, gf_string2bytesize_uint64);
DEFINE_RECONF_OPT(double, percent, gf_string2percent);
DEFINE_RECONF_OPT(double, percent_or_size, pc_or_size);