[sheepdog] [PATCH 1/3] collie: rename SUBCMD_FLAG_NEED_THIRD_ARG
Liu Yuan
namei.unix at gmail.com
Thu Apr 4 14:52:28 CEST 2013
From: Liu Yuan <tailai.ly at taobao.com>
THIRD is very misleading and this is a prepare patch.
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
collie/cluster.c | 2 +-
collie/collie.c | 2 +-
collie/collie.h | 2 +-
collie/debug.c | 2 +-
collie/node.c | 8 ++++----
collie/vdi.c | 34 +++++++++++++++++-----------------
6 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/collie/cluster.c b/collie/cluster.c
index 2eadc32..b38091b 100644
--- a/collie/cluster.c
+++ b/collie/cluster.c
@@ -461,7 +461,7 @@ static struct subcommand cluster_cmd[] = {
NULL, 0, cluster_snapshot, cluster_options},
{"recover", NULL, "afph",
"See 'collie cluster recover' for more information\n",
- cluster_recover_cmd, SUBCMD_FLAG_NEED_THIRD_ARG,
+ cluster_recover_cmd, SUBCMD_FLAG_NEED_ARG,
cluster_recover, cluster_options},
{NULL,},
};
diff --git a/collie/collie.c b/collie/collie.c
index 19085b4..ced376a 100644
--- a/collie/collie.c
+++ b/collie/collie.c
@@ -391,7 +391,7 @@ int main(int argc, char **argv)
}
}
- if (flags & SUBCMD_FLAG_NEED_THIRD_ARG && argc == optind)
+ if (flags & SUBCMD_FLAG_NEED_ARG && argc == optind)
subcommand_usage(argv[1], argv[2], EXIT_USAGE);
return command_fn(argc, argv);
diff --git a/collie/collie.h b/collie/collie.h
index d8c65d4..f71c573 100644
--- a/collie/collie.h
+++ b/collie/collie.h
@@ -23,7 +23,7 @@
#include "option.h"
#define SUBCMD_FLAG_NEED_NODELIST (1 << 0)
-#define SUBCMD_FLAG_NEED_THIRD_ARG (1 << 1)
+#define SUBCMD_FLAG_NEED_ARG (1 << 1)
#define UINT64_DECIMAL_SIZE 21
diff --git a/collie/debug.c b/collie/debug.c
index f3a245f..bbbf3a6 100644
--- a/collie/debug.c
+++ b/collie/debug.c
@@ -221,7 +221,7 @@ static int debug_trace(int argc, char **argv)
static struct subcommand debug_cmd[] = {
{"trace", NULL, "aph", "trace the node",
- trace_cmd, SUBCMD_FLAG_NEED_THIRD_ARG, debug_trace},
+ trace_cmd, SUBCMD_FLAG_NEED_ARG, debug_trace},
{NULL,},
};
diff --git a/collie/node.c b/collie/node.c
index 0fa13cf..524c0e9 100644
--- a/collie/node.c
+++ b/collie/node.c
@@ -331,7 +331,7 @@ static struct subcommand node_md_cmd[] = {
{"info", NULL, NULL, "show multi-disk information",
NULL, 0, md_info},
{"plug", NULL, NULL, "plug more disk(s) into node",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG, md_plug},
+ NULL, SUBCMD_FLAG_NEED_ARG, md_plug},
{"unplug", NULL, NULL, "unplug disk(s) from node",
NULL, 0, md_unplug},
{NULL},
@@ -372,7 +372,7 @@ static struct sd_option node_options[] = {
static struct subcommand node_cmd[] = {
{"kill", "<node id>", "aprh", "kill node", NULL,
- SUBCMD_FLAG_NEED_THIRD_ARG | SUBCMD_FLAG_NEED_NODELIST, node_kill},
+ SUBCMD_FLAG_NEED_ARG | SUBCMD_FLAG_NEED_NODELIST, node_kill},
{"list", NULL, "aprh", "list nodes", NULL,
SUBCMD_FLAG_NEED_NODELIST, node_list},
{"info", NULL, "aprh", "show information about each node", NULL,
@@ -380,9 +380,9 @@ static struct subcommand node_cmd[] = {
{"recovery", NULL, "aprh", "show nodes in recovery", NULL,
SUBCMD_FLAG_NEED_NODELIST, node_recovery},
{"cache", "<cache size>", "aprh", "specify max cache size", NULL,
- SUBCMD_FLAG_NEED_THIRD_ARG, node_cache},
+ SUBCMD_FLAG_NEED_ARG, node_cache},
{"md", NULL, "apAh", "See 'collie node md' for more information",
- node_md_cmd, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_THIRD_ARG,
+ node_md_cmd, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_ARG,
node_md, node_options},
{NULL,},
};
diff --git a/collie/vdi.c b/collie/vdi.c
index c18f9a9..ec4833b 100644
--- a/collie/vdi.c
+++ b/collie/vdi.c
@@ -1941,22 +1941,22 @@ static int vdi_cache(int argc, char **argv)
static struct subcommand vdi_cmd[] = {
{"check", "<vdiname>", "saph", "check and repair image's consistency",
- NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_ARG,
vdi_check, vdi_options},
{"create", "<vdiname> <size>", "Pcaph", "create an image",
- NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_ARG,
vdi_create, vdi_options},
{"snapshot", "<vdiname>", "saph", "create a snapshot",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_snapshot, vdi_options},
{"clone", "<src vdi> <dst vdi>", "sPcaph", "clone an image",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_clone, vdi_options},
{"delete", "<vdiname>", "saph", "delete an image",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_delete, vdi_options},
{"rollback", "<vdiname>", "saph", "rollback to a snapshot",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_rollback, vdi_options},
{"list", "[vdiname]", "aprh", "list images",
NULL, 0, vdi_list, vdi_options},
@@ -1965,37 +1965,37 @@ static struct subcommand vdi_cmd[] = {
{"graph", NULL, "aph", "show images in Graphviz dot format",
NULL, 0, vdi_graph, vdi_options},
{"object", "<vdiname>", "isaph", "show object information in the image",
- NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_ARG,
vdi_object, vdi_options},
{"track", "<vdiname>", "isaph", "show the object epoch trace in the image",
- NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_ARG,
vdi_track, vdi_options},
{"setattr", "<vdiname> <key> [value]", "dxaph", "set a VDI attribute",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_setattr, vdi_options},
{"getattr", "<vdiname> <key>", "aph", "get a VDI attribute",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_getattr, vdi_options},
{"resize", "<vdiname> <new size>", "aph", "resize an image",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_resize, vdi_options},
{"read", "<vdiname> [<offset> [<len>]]", "saph", "read data from an image",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_read, vdi_options},
{"write", "<vdiname> [<offset> [<len>]]", "apwh", "write data to an image",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_write, vdi_options},
{"flush", "<vdiname>", "aph", "flush data to cluster",
- NULL, SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_ARG,
vdi_flush, vdi_options},
{"backup", "<vdiname> <backup>", "sFaph", "create an incremental backup between two snapshots",
- NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_ARG,
vdi_backup, vdi_options},
{"restore", "<vdiname> <backup>", "saph", "restore snapshot images from a backup",
- NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_THIRD_ARG,
+ NULL, SUBCMD_FLAG_NEED_NODELIST|SUBCMD_FLAG_NEED_ARG,
vdi_restore, vdi_options},
{"cache", NULL, "saph", "Run 'collie vdi cache' for more information\n",
- vdi_cache_cmd, SUBCMD_FLAG_NEED_THIRD_ARG,
+ vdi_cache_cmd, SUBCMD_FLAG_NEED_ARG,
vdi_cache, vdi_options},
{NULL,},
};
--
1.7.9.5
More information about the sheepdog
mailing list