diff options
| author | Harshavardhana <harsha@harshavardhana.net> | 2014-04-17 15:54:34 -0700 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2014-04-24 14:41:48 -0700 | 
| commit | a3cb38e3edf005bef73da4c9cfd958474a14d50f (patch) | |
| tree | a406029332a9eb096c14d441160bb670a42df8cb /libglusterfs/src/options.c | |
| parent | 9c13471b109587a639662fc690384285bee02bc6 (diff) | |
build: MacOSX Porting fixes
git@forge.gluster.org:~schafdog/glusterfs-core/osx-glusterfs
Working functionality on MacOSX
 - GlusterD (management daemon)
 - GlusterCLI (management cli)
 - GlusterFS FUSE (using OSXFUSE)
 - GlusterNFS (without NLM - issues with rpc.statd)
Change-Id: I20193d3f8904388e47344e523b3787dbeab044ac
BUG: 1089172
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Signed-off-by: Dennis Schafroth <dennis@schafroth.com>
Tested-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Dennis Schafroth <dennis@schafroth.com>
Reviewed-on: http://review.gluster.org/7503
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/options.c')
| -rw-r--r-- | libglusterfs/src/options.c | 38 | 
1 files changed, 20 insertions, 18 deletions
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c index a0881b4ad91..f63c60476da 100644 --- a/libglusterfs/src/options.c +++ b/libglusterfs/src/options.c @@ -79,7 +79,7 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,                  goto out;          } -        if ((opt->validate == GF_OPT_VALIDATE_MIN)) { +        if (opt->validate == GF_OPT_VALIDATE_MIN) {                  if (inputll < opt->min) {                          snprintf (errstr, 256,                                    "'%lld' in 'option %s %s' is smaller than " @@ -88,8 +88,8 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,                          gf_log (xl->name, GF_LOG_ERROR, "%s", errstr);                          goto out;                  } -        } else if ((opt->validate == GF_OPT_VALIDATE_MAX)) { -                if ((inputll > opt->max)) { +        } else if (opt->validate == GF_OPT_VALIDATE_MAX) { +                if (inputll > opt->max) {                          snprintf (errstr, 256,                                    "'%lld' in 'option %s %s' is greater than "                                    "maximum value '%.0f'", inputll, key, @@ -118,12 +118,12 @@ static int  xlator_option_validate_sizet (xlator_t *xl, const char *key, const char *value,                                volume_option_t *opt, char **op_errstr)  { -        uint64_t  size = 0; +        size_t  size = 0;          int       ret = 0;          char      errstr[256];          /* Check the range */ -        if (gf_string2bytesize (value, &size) != 0) { +        if (gf_string2bytesize_size (value, &size) != 0) {                  snprintf (errstr, 256,                            "invalid number format \"%s\" in option \"%s\"",                            value, key); @@ -142,13 +142,13 @@ xlator_option_validate_sizet (xlator_t *xl, const char *key, const char *value,          if ((size < opt->min) || (size > opt->max)) {                  if ((strncmp (key, "cache-size", 10) == 0) &&                      (size > opt->max)) { -                       snprintf (errstr, 256, "Cache size %"PRId64" is out of " +                       snprintf (errstr, 256, "Cache size %" GF_PRI_SIZET " is out of "                                   "range [%.0f - %.0f]",                                   size, opt->min, opt->max);                         gf_log (xl->name, GF_LOG_WARNING, "%s", errstr);                  } else {                          snprintf (errstr, 256, -                                  "'%"PRId64"' in 'option %s %s' " +                                  "'%" GF_PRI_SIZET "' in 'option %s %s' "                                    "is out of range [%.0f - %.0f]",                                    size, key, value, opt->min, opt->max);                          gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); @@ -478,7 +478,7 @@ xlator_option_validate_double (xlator_t *xl, const char *key, const char *value,                  goto out;          } -        if ((opt->validate == GF_OPT_VALIDATE_MIN)) { +        if (opt->validate == GF_OPT_VALIDATE_MIN) {                  if (input < opt->min) {                          snprintf (errstr, 256,                                    "'%f' in 'option %s %s' is smaller than " @@ -487,8 +487,8 @@ xlator_option_validate_double (xlator_t *xl, const char *key, const char *value,                          gf_log (xl->name, GF_LOG_ERROR, "%s", errstr);                          goto out;                  } -        } else if ((opt->validate == GF_OPT_VALIDATE_MAX)) { -                if ((input > opt->max)) { +        } else if (opt->validate == GF_OPT_VALIDATE_MAX) { +                if (input > opt->max) {                          snprintf (errstr, 256,                                    "'%f' in 'option %s %s' is greater than "                                    "maximum value '%f'", input, key, @@ -617,12 +617,12 @@ out:  static int  gf_validate_size (const char *sizestr, volume_option_t *opt)  { -        uint64_t                value = 0; +        size_t                value = 0;          int                     ret = 0;          GF_ASSERT (opt); -        if (gf_string2bytesize (sizestr, &value) != 0 || +        if (gf_string2bytesize_size (sizestr, &value) != 0 ||              value < opt->min ||              value % 512) {                  ret = -1; @@ -787,7 +787,7 @@ xlator_option_validate (xlator_t *xl, char *key, char *value,                  [GF_OPTION_TYPE_MAX]         = NULL,          }; -        if (opt->type < 0 || opt->type >= GF_OPTION_TYPE_MAX) { +        if (opt->type > GF_OPTION_TYPE_MAX) {                  gf_log (xl->name, GF_LOG_ERROR,                          "unknown option type '%d'", opt->type);                  goto out; @@ -1120,18 +1120,18 @@ pc_or_size (char *in, double *out)  {          double  pc = 0;          int       ret = 0; -        uint64_t  size = 0; +        size_t  size = 0;          if (gf_string2percent (in, &pc) == 0) {                  if (pc > 100.0) { -                        ret = gf_string2bytesize (in, &size); +                        ret = gf_string2bytesize_size (in, &size);                          if (!ret)                                  *out = size;                  } else {                          *out = pc;                  }          } else { -                ret = gf_string2bytesize (in, &size); +                ret = gf_string2bytesize_size (in, &size);                  if (!ret)                          *out = size;          } @@ -1143,7 +1143,8 @@ 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(uint64_t, size, gf_string2bytesize); +DEFINE_INIT_OPT(size_t, size, gf_string2bytesize_size); +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);  DEFINE_INIT_OPT(gf_boolean_t, bool, gf_string2boolean); @@ -1158,7 +1159,8 @@ 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(uint64_t, size, gf_string2bytesize); +DEFINE_RECONF_OPT(size_t, size, gf_string2bytesize_size); +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);  DEFINE_RECONF_OPT(gf_boolean_t, bool, gf_string2boolean);  | 
