"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/cli/src/cli-cmd.h" (16 Sep 2020, 4327 Bytes) of package /linux/misc/glusterfs-8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "cli-cmd.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2    Copyright (c) 2006-2012 Red Hat, Inc. <http://www.redhat.com>
    3    This file is part of GlusterFS.
    4 
    5    This file is licensed to you under your choice of the GNU Lesser
    6    General Public License, version 3 or any later version (LGPLv3 or
    7    later), or the GNU General Public License, version 2 (GPLv2), in all
    8    cases as published by the Free Software Foundation.
    9 */
   10 #ifndef __CLI_CMD_H__
   11 #define __CLI_CMD_H__
   12 
   13 #include <netdb.h>
   14 
   15 #include "cli.h"
   16 #include <glusterfs/list.h>
   17 
   18 #define GLUSTER_SHARED_STORAGE "gluster_shared_storage"
   19 
   20 #define CLI_LOCAL_INIT(local, words, frame, dictionary)                        \
   21     do {                                                                       \
   22         local = cli_local_get();                                               \
   23                                                                                \
   24         if (local) {                                                           \
   25             local->words = words;                                              \
   26             if (dictionary)                                                    \
   27                 local->dict = dictionary;                                      \
   28             if (frame)                                                         \
   29                 frame->local = local;                                          \
   30         }                                                                      \
   31     } while (0)
   32 
   33 #define CLI_STACK_DESTROY(_frame)                                              \
   34     do {                                                                       \
   35         if (_frame) {                                                          \
   36             if (_frame->local) {                                               \
   37                 gf_log("cli", GF_LOG_DEBUG,                                    \
   38                        "frame->local "                                         \
   39                        "is not NULL (%p)",                                     \
   40                        _frame->local);                                         \
   41                 cli_local_wipe(_frame->local);                                 \
   42                 _frame->local = NULL;                                          \
   43             }                                                                  \
   44             STACK_DESTROY(_frame->root);                                       \
   45         }                                                                      \
   46     } while (0);
   47 
   48 typedef enum { GF_ANSWER_YES = 1, GF_ANSWER_NO = 2 } gf_answer_t;
   49 
   50 struct cli_cmd {
   51     const char *pattern;
   52     cli_cmd_cbk_t *cbk;
   53     const char *desc;
   54     cli_cmd_reg_cbk_t *reg_cbk; /* callback to check in runtime if the   *
   55                                  * command should be enabled or disabled */
   56     gf_boolean_t disable;
   57 };
   58 
   59 struct cli_cmd_volume_get_ctx_ {
   60     char *volname;
   61     int flags;
   62 };
   63 
   64 typedef struct cli_profile_info_ {
   65     uint64_t fop_hits;
   66     double min_latency;
   67     double max_latency;
   68     double avg_latency;
   69     char *fop_name;
   70     double percentage_avg_latency;
   71 } cli_profile_info_t;
   72 
   73 typedef struct cli_cmd_volume_get_ctx_ cli_cmd_volume_get_ctx_t;
   74 
   75 int
   76 cli_cmd_volume_register(struct cli_state *state);
   77 
   78 int
   79 cli_cmd_probe_register(struct cli_state *state);
   80 
   81 int
   82 cli_cmd_system_register(struct cli_state *state);
   83 
   84 int
   85 cli_cmd_snapshot_register(struct cli_state *state);
   86 
   87 int
   88 cli_cmd_global_register(struct cli_state *state);
   89 
   90 int
   91 cli_cmd_misc_register(struct cli_state *state);
   92 
   93 struct cli_cmd_word *
   94 cli_cmd_nextword(struct cli_cmd_word *word, const char *text);
   95 void
   96 cli_cmd_tokens_destroy(char **tokens);
   97 
   98 int
   99 cli_cmd_await_response(unsigned time);
  100 
  101 int
  102 cli_cmd_broadcast_response(int32_t status);
  103 
  104 int
  105 cli_cmd_lock();
  106 
  107 int
  108 cli_cmd_unlock();
  109 
  110 int
  111 cli_cmd_submit(struct rpc_clnt *rpc, void *req, call_frame_t *frame,
  112                rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref,
  113                xlator_t *this, fop_cbk_fn_t cbkfn, xdrproc_t xdrproc);
  114 
  115 int
  116 cli_cmd_pattern_cmp(void *a, void *b);
  117 
  118 void
  119 cli_cmd_sort(struct cli_cmd *cmd, int count);
  120 
  121 gf_answer_t
  122 cli_cmd_get_confirmation(struct cli_state *state, const char *question);
  123 int
  124 cli_cmd_sent_status_get(int *status);
  125 
  126 gf_boolean_t
  127 _limits_set_on_volume(char *volname, int type);
  128 
  129 #endif /* __CLI_CMD_H__ */