summaryrefslogtreecommitdiff
path: root/src/common/ceph_argparse.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/ceph_argparse.h')
-rw-r--r--src/common/ceph_argparse.h48
1 files changed, 6 insertions, 42 deletions
diff --git a/src/common/ceph_argparse.h b/src/common/ceph_argparse.h
index b2f4a3c651d..50168be4125 100644
--- a/src/common/ceph_argparse.h
+++ b/src/common/ceph_argparse.h
@@ -31,45 +31,6 @@
#include "common/entity_name.h"
#include "msg/msg_types.h"
-/////////////////////// Macros ///////////////////////
-#define FOR_EACH_ARG(args) \
- __isarg = 1 < args.size(); \
- for (unsigned i=0; i<args.size(); i++, __isarg = i+1 < args.size())
-
-#define DEFINE_CONF_VARS(usage_func) \
- unsigned int val_pos __attribute__((unused)); \
- void (*args_usage)() __attribute__((unused)) = usage_func; \
- bool __isarg __attribute__((unused))
-
-#define CEPH_ARGPARSE_NEXT_VAL (val_pos ? &args[i][val_pos] : args[++i])
-
-#define CEPH_ARGPARSE_VAL args[i]
-
-#define CEPH_ARGPARSE_SET_ARG_VAL(dest, type) \
- do { \
- __isarg = i+1 < args.size(); \
- if (__isarg && !val_pos && \
- args[i+1][0] == '-' && args[i+1][1] != '\0') \
- __isarg = false; \
- if (type == OPT_BOOL) { \
- if (val_pos) { \
- ceph_argparse_cmdline_val(dest, type, CEPH_ARGPARSE_NEXT_VAL); \
- } else \
- ceph_argparse_cmdline_val(dest, type, "true"); \
- } else if (__isarg || val_pos) { \
- ceph_argparse_cmdline_val(dest, type, CEPH_ARGPARSE_NEXT_VAL); \
- } else if (args_usage) \
- args_usage(); \
- } while (0)
-
-#define CEPH_ARGPARSE_EQ(str_cmd, char_cmd) \
- ceph_argparse_cmd_equals(args[i], str_cmd, char_cmd, &val_pos)
-
-extern bool ceph_argparse_cmdline_val(void *field, int type,
- const char *val);
-extern bool ceph_argparse_cmd_equals(const char *cmd, const char *opt,
- char char_opt, unsigned int *val_pos);
-
/////////////////////// Types ///////////////////////
class CephInitParameters
{
@@ -83,11 +44,8 @@ public:
/////////////////////// Functions ///////////////////////
extern void env_to_vec(std::vector<const char*>& args);
-extern void env_to_deq(std::deque<const char*>& args);
extern void argv_to_vec(int argc, const char **argv,
std::vector<const char*>& args);
-extern void argv_to_deq(int argc, const char **argv,
- std::deque<const char*>& args);
extern void vec_to_argv(std::vector<const char*>& args,
int& argc, const char **&argv);
@@ -104,6 +62,12 @@ bool ceph_argparse_binary_flag(std::vector<const char*> &args,
extern CephInitParameters ceph_argparse_early_args
(std::vector<const char*>& args, uint32_t module_type, int flags,
std::string *conf_file_list);
+extern bool ceph_argparse_withint(std::vector<const char*> &args,
+ std::vector<const char*>::iterator &i, int *ret,
+ std::ostringstream *oss, ...);
+extern bool ceph_argparse_withlonglong(std::vector<const char*> &args,
+ std::vector<const char*>::iterator &i, long long *ret,
+ std::ostringstream *oss, ...);
extern void generic_server_usage();
extern void generic_client_usage();