[Gluster-devel] integer options in gluster volume set help

Emmanuel Dreyfus manu at netbsd.org
Fri Jul 24 04:35:38 UTC 2015


gluster volume set help shows option default values. I note that the
default_value field is a char * and where the option is integer, it seems the
practice is to duplicate the value as a string.

Why not use a macro? Indeed it is a bit tricky, but it removes the risk of
having obsolete values: Here is the definition:
#define GF_ITOA(s) _GF_ITOA(s)
#define _GF_ITOA(s) #s


And usage:
#define DEFAULT_VERIFY_DEPTH 1
(...)
       { .key   = {"ssl-cert-depth"},
         .type  = GF_OPTION_TYPE_INT, 
         .default_value = GF_ITOA(DEFAULT_VERIFY_DEPTH),
         .description = "Maximum certificate-chain depth.  If zero, the "
                          "peer's certificate itself must be in the local "
                          "certificate list.  Otherwise, there may be up to N "
                          "signing certificates between the peer's and the "
                          "local list.  Ignored if SSL is not enabled."
         },


Reference: https://gcc.gnu.org/onlinedocs/cpp/Stringification.html

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu at netbsd.org


More information about the Gluster-devel mailing list