diff options
Diffstat (limited to 'libglusterfs/src/options.h')
| -rw-r--r-- | libglusterfs/src/options.h | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/libglusterfs/src/options.h b/libglusterfs/src/options.h index 8c0ff2499..e2a25baa9 100644 --- a/libglusterfs/src/options.h +++ b/libglusterfs/src/options.h @@ -41,22 +41,32 @@ typedef enum { GF_OPTION_TYPE_MAX, } volume_option_type_t; +typedef enum { + GF_OPT_VALIDATE_BOTH = 0, + GF_OPT_VALIDATE_MIN, + GF_OPT_VALIDATE_MAX, +} opt_validate_type_t; #define ZR_VOLUME_MAX_NUM_KEY 4 #define ZR_OPTION_MAX_ARRAY_SIZE 64 /* Each translator should define this structure */ typedef struct volume_options { - char *key[ZR_VOLUME_MAX_NUM_KEY]; + char *key[ZR_VOLUME_MAX_NUM_KEY]; /* different key, same meaning */ - volume_option_type_t type; - int64_t min; /* 0 means no range */ - int64_t max; /* 0 means no range */ - char *value[ZR_OPTION_MAX_ARRAY_SIZE]; + volume_option_type_t type; + double min; /* 0 means no range */ + double max; /* 0 means no range */ + char *value[ZR_OPTION_MAX_ARRAY_SIZE]; /* If specified, will check for one of the value from this array */ - char *default_value; - char *description; /* about the key */ + char *default_value; + char *description; /* about the key */ + /* Required for int options where only the min value + * is given and is 0. This will cause validation not to + * happen + */ + opt_validate_type_t validate; } volume_option_t; @@ -83,6 +93,9 @@ int xlator_options_validate (xlator_t *xl, dict_t *options, char **errstr); volume_option_t * xlator_volume_option_get (xlator_t *xl, const char *key); +volume_option_t * +xlator_volume_option_get_list (volume_opt_list_t *vol_list, const char *key); + #define DECLARE_INIT_OPT(type_t, type) \ int \ @@ -95,11 +108,12 @@ DECLARE_INIT_OPT(int64_t, int64); DECLARE_INIT_OPT(uint32_t, uint32); DECLARE_INIT_OPT(int32_t, int32); DECLARE_INIT_OPT(uint64_t, size); -DECLARE_INIT_OPT(uint32_t, percent); -DECLARE_INIT_OPT(uint64_t, percent_or_size); +DECLARE_INIT_OPT(double, percent); +DECLARE_INIT_OPT(double, percent_or_size); DECLARE_INIT_OPT(gf_boolean_t, bool); DECLARE_INIT_OPT(xlator_t *, xlator); DECLARE_INIT_OPT(char *, path); +DECLARE_INIT_OPT(double, double); #define DEFINE_INIT_OPT(type_t, type, conv) \ @@ -174,11 +188,12 @@ DECLARE_RECONF_OPT(int64_t, int64); DECLARE_RECONF_OPT(uint32_t, uint32); DECLARE_RECONF_OPT(int32_t, int32); DECLARE_RECONF_OPT(uint64_t, size); -DECLARE_RECONF_OPT(uint32_t, percent); -DECLARE_RECONF_OPT(uint64_t, percent_or_size); +DECLARE_RECONF_OPT(double, percent); +DECLARE_RECONF_OPT(double, percent_or_size); DECLARE_RECONF_OPT(gf_boolean_t, bool); DECLARE_RECONF_OPT(xlator_t *, xlator); DECLARE_RECONF_OPT(char *, path); +DECLARE_RECONF_OPT(double, double); #define DEFINE_RECONF_OPT(type_t, type, conv) \ |
