summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Expand)AuthorAgeFilesLines
* merges r21059 from trunk into ruby_1_9_1.yugui2008-12-261-0/+3
* merges r20933 from trunk into ruby_1_9_1.yugui2008-12-251-0/+1
* merges r20909 and r20910 from trunk into ruby_1_9_1.yugui2008-12-252-6/+5
* merges r20870 from trunk into ruby_1_9_1.yugui2008-12-191-0/+1
* * include/ruby/st.h (size_t): needs stddef.h or stdlib.h.nobu2008-12-111-0/+13
* merges r20531 from trunk into ruby_1_9_1.yugui2008-12-051-0/+1
* merges r20224 from trunk into ruby_1_9_1yugui2008-11-181-0/+12
* merges r20223 from trunk into ruby_1_9_1.yugui2008-11-181-0/+1
* merges r20145 from trunk into ruby_1_9_1.yugui2008-11-111-0/+1
* merges r20144 from trunk into ruby_1_9_1.yugui2008-11-111-0/+2
* merges r20102 from trunk into ruby_1_9_1.yugui2008-11-041-1/+1
* merges r20101 from trunk into ruby_1_9_1.yugui2008-11-041-29/+33
* * string.c (rb_external_str_new_with_enc): no implicit strlen call.matz2008-10-221-0/+2
* * include/ruby/vm.h: write a comment.ko12008-10-211-4/+9
* * ext/zlib/zlib.c: remove obsolete prototype macros.matz2008-10-211-0/+1
* * io.c, include/ruby/intern.h (rb_io_ascii8bit_binmode): externed.shugo2008-10-211-0/+1
* * include/ruby/ruby.h (ExportStringValue): new macro to convertmatz2008-10-202-1/+8
* * string.c (rb_locale_str_new): new function to convert stringmatz2008-10-201-0/+1
* * string.c (rb_external_str_new): a new function to convert frommatz2008-10-182-0/+3
* * io.c (rb_getc, rb_io_fread, rb_io_fwrite, rb_read_pending):mame2008-10-161-5/+0
* * io.c (Init_IO): $FILENAME and $* must be read-only. [ruby-dev:36698]nobu2008-10-141-0/+20
* * include/ruby.h: updated macros for headers. [ruby-core:19275]nobu2008-10-101-2/+1
* * include/ruby/ruby.h: embeds the elements of an array into itsyugui2008-10-091-8/+25
* * encoding.c (rb_default_internal_encoding): merged a patch frommatz2008-10-071-0/+3
* * dln.c: Ruby no longer supports VMS.yugui2008-10-042-10/+1
* * dln.c: Ruby no longer supports Windows CE.yugui2008-10-042-9/+2
* * dln.c: Ruby no longer supports MacOS 9 or before.yugui2008-10-041-2/+0
* * dln.c: Ruby no longer supports MS-DOS.yugui2008-10-042-2/+2
* * x68/_dtos18.c: removed. Ruby no longer supports human68k.yugui2008-10-041-6/+2
* * sprintf.c (rb_str_format): add %<name>s style named argumentmatz2008-09-301-0/+1
* * include/ruby/encoding.h (rb_str_encode): renamed fromakr2008-09-261-2/+2
* * include/ruby/ruby.h (rb_mPrecision): removed.yugui2008-09-261-1/+0
* * error.c (Init_Exception): introduce EncodingError which is amatz2008-09-261-0/+1
* * transcode.c, include/ruby/encoding.c (rb_transcode_convertible):usa2008-09-261-0/+1
* * include/ruby{io,sig}.h: moved to include/ruby/backward.nobu2008-09-263-1/+6
* * include/rubysig.h: old macros for backward compatibility.nobu2008-09-261-1/+33
* comment changed.akr2008-09-241-2/+2
* * include/ruby/node.h, node.h: move node.h from include path.ko12008-09-231-516/+0
* * thread.c, include/ruby/intern.h (rb_thread_interrupted): added.ko12008-09-231-0/+1
* * ruby.h: fix comment and rename macro HAVE_RUBY_MVM_H toko12008-09-231-2/+2
* * include/ruby/node.h, vm_core.h: move definition ofko12008-09-231-0/+2
* * common.mk: clean upko12008-09-232-9/+1
* * include/ruby/encoding.h (enum): ISO C forbids comma at end ofshyouhei2008-09-221-1/+1
* * complex.c: an instance method image has been removed andtadf2008-09-201-1/+1
* * dln.c: newer BeOS support. a patch from Pete Goodevematz2008-09-191-1/+1
* * grapheme cluster implementation reverted. [ruby-dev:36375]akr2008-09-182-7/+5
* * transcode.c: add "Error" suffix for Encoding exception classes.matz2008-09-181-0/+1
* * string.c (rb_str_casecmp): don't use rb_enc_codepoint.akr2008-09-171-3/+3
* * include/ruby/oniguruma.h (OnigEncodingTypeST): add precise_retakr2008-09-162-2/+4
* * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()ko12008-09-151-1/+1
ass="hl ppc">#include <stdlib.h> #include <stdint.h> #include <pthread.h> #ifndef _CONFIG_H #define _CONFIG_H #include "config.h" #endif #include "cli.h" #include "cli-cmd.h" #include "cli-mem-types.h" extern struct rpc_clnt *global_rpc; extern rpc_clnt_prog_t *cli_rpc_prog; void cli_cmd_volume_start_usage () { cli_out ("Usage: volume start <volname>"); } int cli_cmd_volume_info_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; proc = &cli_rpc_prog->proctable[GF1_CLI_GET_VOLUME]; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; if (proc->fn) { ret = proc->fn (frame, THIS, NULL); } out: if (ret) cli_out ("Getting Volume information failed!"); return ret; } int cli_cmd_volume_create_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; dict_t *options = NULL; proc = &cli_rpc_prog->proctable[GF1_CLI_CREATE_VOLUME]; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; ret = cli_cmd_volume_create_parse (words, wordcount, &options); if (ret) goto out; if (proc->fn) { ret = proc->fn (frame, THIS, options); } out: if (ret) { char *volname = (char *) words[2]; cli_out ("Creating Volume %s failed",volname ); } if (options) dict_destroy (options); return ret; } int cli_cmd_volume_delete_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; char *volname = NULL; proc = &cli_rpc_prog->proctable[GF1_CLI_DELETE_VOLUME]; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; //TODO: Build validation here volname = (char *)words[2]; GF_ASSERT (volname); if (proc->fn) { ret = proc->fn (frame, THIS, volname); } out: if (ret) cli_out ("Deleting Volume %s failed", volname); return ret; } int cli_cmd_volume_start_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; char *volname = NULL; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; //TODO: Build validation here if (wordcount < 3) { cli_cmd_volume_start_usage (); goto out; } volname = (char *)words[2]; GF_ASSERT (volname); proc = &cli_rpc_prog->proctable[GF1_CLI_START_VOLUME]; if (proc->fn) { ret = proc->fn (frame, THIS, volname); } out: if (!proc && ret && volname) cli_out ("Starting Volume %s failed", volname); return ret; } int cli_cmd_volume_stop_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; char *volname = NULL; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; //TODO: Build validation here volname = (char *)words[2]; GF_ASSERT (volname); proc = &cli_rpc_prog->proctable[GF1_CLI_STOP_VOLUME]; if (proc->fn) { ret = proc->fn (frame, THIS, volname); } out: if (!proc && ret) cli_out ("Stopping Volume %s failed", volname); return ret; } int cli_cmd_volume_rename_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; dict_t *dict = NULL; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; dict = dict_new (); if (!dict) goto out; GF_ASSERT (words[2]); GF_ASSERT (words[3]); //TODO: Build validation here ret = dict_set_str (dict, "old-volname", (char *)words[2]); if (ret) goto out; ret = dict_set_str (dict, "new-volname", (char *)words[3]); if (ret) goto out; proc = &cli_rpc_prog->proctable[GF1_CLI_RENAME_VOLUME]; if (proc->fn) { ret = proc->fn (frame, THIS, dict); } out: if (!proc && ret) { char *volname = (char *) words[2]; if (dict) dict_destroy (dict); cli_out ("Renaming Volume %s failed", volname ); } return ret; } void cli_cmd_volume_defrag_usage () { cli_out ("Usage: volume rebalance <volname> <start|stop|status>"); } int cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; dict_t *dict = NULL; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; dict = dict_new (); if (!dict) goto out; GF_ASSERT (words[2]); if (!(words[3])) { cli_cmd_volume_defrag_usage(); goto out; } //TODO: Build validation here ret = dict_set_str (dict, "volname", (char *)words[2]); if (ret) goto out; ret = dict_set_str (dict, "command", (char *)words[3]); if (ret) goto out; proc = &cli_rpc_prog->proctable[GF1_CLI_DEFRAG_VOLUME]; if (proc->fn) { ret = proc->fn (frame, THIS, dict); } out: if (!proc && ret) { if (dict) dict_destroy (dict); cli_out ("Defrag of Volume %s failed", (char *)words[2]); } return 0; } int cli_cmd_volume_set_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { cli_cmd_broadcast_response (0); return 0; } int cli_cmd_volume_add_brick_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; dict_t *options = NULL; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; ret = cli_cmd_volume_add_brick_parse (words, wordcount, &options); if (ret) goto out; proc = &cli_rpc_prog->proctable[GF1_CLI_ADD_BRICK]; if (proc->fn) { ret = proc->fn (frame, THIS, options); } out: if (!proc && ret) { char *volname = (char *) words[2]; cli_out ("Adding brick to Volume %s failed",volname ); } return ret; } int cli_cmd_volume_remove_brick_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; dict_t *options = NULL; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; ret = cli_cmd_volume_remove_brick_parse (words, wordcount, &options); if (ret) goto out; proc = &cli_rpc_prog->proctable[GF1_CLI_REMOVE_BRICK]; if (proc->fn) { ret = proc->fn (frame, THIS, options); } out: if (!proc && ret) { char *volname = (char *) words[2]; cli_out ("Removing brick from Volume %s failed",volname ); } return ret; } int cli_cmd_volume_replace_brick_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; dict_t *options = NULL; proc = &cli_rpc_prog->proctable[GF1_CLI_REPLACE_BRICK]; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) goto out; ret = cli_cmd_volume_replace_brick_parse (words, wordcount, &options); if (ret) goto out; if (proc->fn) { ret = proc->fn (frame, THIS, options); } out: if (ret) { char *volname = (char *) words[2]; cli_out ("Replacing brick from Volume %s failed",volname ); } return ret; } int cli_cmd_volume_set_transport_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { cli_cmd_broadcast_response (0); return 0; } struct cli_cmd volume_cmds[] = { { "volume info [all|<VOLNAME>]", cli_cmd_volume_info_cbk, "list information of all volumes"}, { "volume create <NEW-VOLNAME> [stripe <COUNT>] [replicate <COUNT>] <NEW-BRICK> ...", cli_cmd_volume_create_cbk, "create a new volume of specified type with mentioned bricks"}, { "volume delete <VOLNAME>", cli_cmd_volume_delete_cbk, "delete volume specified by <VOLNAME>"}, { "volume start <VOLNAME>", cli_cmd_volume_start_cbk, "start volume specified by <VOLNAME>"}, { "volume stop <VOLNAME>", cli_cmd_volume_stop_cbk, "stop volume specified by <VOLNAME>"}, { "volume rename <VOLNAME> <NEW-VOLNAME>", cli_cmd_volume_rename_cbk, "rename volume <VOLNAME> to <NEW-VOLNAME>"}, { "volume add-brick <VOLNAME> [(replica <COUNT>)|(stripe <COUNT>)] <NEW-BRICK> ...", cli_cmd_volume_add_brick_cbk, "add brick to volume <VOLNAME>"}, { "volume remove-brick <VOLNAME> [(replica <COUNT>)|(stripe <COUNT>)] <BRICK> ...", cli_cmd_volume_remove_brick_cbk, "remove brick from volume <VOLNAME>"}, { "volume rebalance <VOLNAME> start", cli_cmd_volume_defrag_cbk, "start rebalance of volume <VOLNAME>"}, { "volume rebalance <VOLNAME> stop", cli_cmd_volume_defrag_cbk, "stop rebalance of volume <VOLNAME>"}, { "volume rebalance <VOLNAME> status", cli_cmd_volume_defrag_cbk, "rebalance status of volume <VOLNAME>"}, { "volume replace-brick <VOLNAME> (<BRICK> <NEW-BRICK>)|pause|abort|start|status", cli_cmd_volume_replace_brick_cbk, "replace-brick operations"}, { "volume set-transport <VOLNAME> <TRANSPORT-TYPE> [<TRANSPORT-TYPE>] ...", cli_cmd_volume_set_transport_cbk, "set transport type for volume <VOLNAME>"}, { "volume set <VOLNAME> <KEY> <VALUE>", cli_cmd_volume_set_cbk, "set options for volume <VOLNAME>"}, { NULL, NULL, NULL } }; int cli_cmd_volume_register (struct cli_state *state) { int ret = 0; struct cli_cmd *cmd = NULL; for (cmd = volume_cmds; cmd->pattern; cmd++) { ret = cli_cmd_register (&state->tree, cmd->pattern, cmd->cbk, cmd->desc); if (ret) goto out; } out: return ret; }