"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/xlators/mgmt/glusterd/src/glusterd-utils.h" (16 Sep 2020, 28679 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 "glusterd-utils.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 _GLUSTERD_UTILS_H
   11 #define _GLUSTERD_UTILS_H
   12 
   13 #include <pthread.h>
   14 #include <glusterfs/compat-uuid.h>
   15 
   16 #include <glusterfs/glusterfs.h>
   17 #include <glusterfs/xlator.h>
   18 #include <glusterfs/logging.h>
   19 #include <glusterfs/call-stub.h>
   20 #include <glusterfs/byte-order.h>
   21 #include "glusterd.h"
   22 #include "rpc-clnt.h"
   23 #include "protocol-common.h"
   24 
   25 #include "glusterfs3-xdr.h"
   26 #include "glusterd-peer-utils.h"
   27 
   28 #define GLUSTERD_SOCK_DIR "/var/run/gluster"
   29 #define GLUSTERD_ASSIGN_BRICKID_TO_BRICKINFO(brickinfo, volinfo, brickid)      \
   30     do {                                                                       \
   31         sprintf(brickinfo->brick_id, "%s-client-%d", volinfo->volname,         \
   32                 brickid);                                                      \
   33     } while (0)
   34 
   35 #define GLUSTERD_ASSIGN_BRICKID_TO_TA_BRICKINFO(ta_brickinfo, volinfo,         \
   36                                                 brickid)                       \
   37     do {                                                                       \
   38         sprintf(ta_brickinfo->brick_id, "%s-ta-%d", volinfo->volname,          \
   39                 brickid);                                                      \
   40     } while (0)
   41 
   42 #define ALL_VOLUME_OPTION_CHECK(volname, get_opt, key, ret, op_errstr, label)  \
   43     do {                                                                       \
   44         gf_boolean_t _all = !strcmp("all", volname);                           \
   45         gf_boolean_t _key_all = !strcmp(key, "all");                           \
   46         gf_boolean_t _is_valid_opt = _gf_false;                                \
   47         int32_t i = 0;                                                         \
   48                                                                                \
   49         if (!get_opt &&                                                        \
   50             (_key_all || !strcmp(key, GLUSTERD_MAX_OP_VERSION_KEY))) {         \
   51             ret = -1;                                                          \
   52             *op_errstr = gf_strdup("Not a valid option to set");               \
   53             goto out;                                                          \
   54         }                                                                      \
   55         if (_key_all) {                                                        \
   56             _is_valid_opt = _gf_true;                                          \
   57         } else {                                                               \
   58             for (i = 0; valid_all_vol_opts[i].option; i++) {                   \
   59                 if (!strcmp(key, valid_all_vol_opts[i].option)) {              \
   60                     _is_valid_opt = _gf_true;                                  \
   61                     break;                                                     \
   62                 }                                                              \
   63             }                                                                  \
   64         }                                                                      \
   65         if (_all && !_is_valid_opt) {                                          \
   66             ret = -1;                                                          \
   67             *op_errstr = gf_strdup("Not a valid option for all volumes");      \
   68             goto label;                                                        \
   69         } else if (!_all && _is_valid_opt) {                                   \
   70             ret = -1;                                                          \
   71             *op_errstr = gf_strdup("Not a valid option for single volume");    \
   72             goto label;                                                        \
   73         }                                                                      \
   74     } while (0)
   75 
   76 struct glusterd_lock_ {
   77     uuid_t owner;
   78     time_t timestamp;
   79 };
   80 
   81 typedef struct glusterd_dict_ctx_ {
   82     dict_t *dict;
   83     int opt_count;
   84     char *key_name;
   85     char *val_name;
   86     char *prefix;
   87 } glusterd_dict_ctx_t;
   88 
   89 gf_boolean_t
   90 is_brick_mx_enabled(void);
   91 
   92 int
   93 glusterd_compare_lines(const void *a, const void *b);
   94 
   95 typedef int (*glusterd_condition_func)(glusterd_volinfo_t *volinfo,
   96                                        glusterd_brickinfo_t *brickinfo,
   97                                        void *ctx);
   98 typedef struct glusterd_lock_ glusterd_lock_t;
   99 
  100 int32_t
  101 glusterd_get_lock_owner(uuid_t *cur_owner);
  102 
  103 int32_t
  104 glusterd_lock(uuid_t new_owner);
  105 
  106 int32_t
  107 glusterd_unlock(uuid_t owner);
  108 
  109 int32_t
  110 glusterd_get_uuid(uuid_t *uuid);
  111 
  112 char *
  113 gd_get_shd_key(int type);
  114 
  115 int
  116 glusterd_submit_reply(rpcsvc_request_t *req, void *arg, struct iovec *payload,
  117                       int payloadcount, struct iobref *iobref,
  118                       xdrproc_t xdrproc);
  119 
  120 int
  121 glusterd_to_cli(rpcsvc_request_t *req, gf_cli_rsp *arg, struct iovec *payload,
  122                 int payloadcount, struct iobref *iobref, xdrproc_t xdrproc,
  123                 dict_t *dict);
  124 
  125 int
  126 glusterd_submit_request(struct rpc_clnt *rpc, void *req, call_frame_t *frame,
  127                         rpc_clnt_prog_t *prog, int procnum,
  128                         struct iobref *iobref, xlator_t *this,
  129                         fop_cbk_fn_t cbkfn, xdrproc_t xdrproc);
  130 int32_t
  131 glusterd_volinfo_new(glusterd_volinfo_t **volinfo);
  132 
  133 int32_t
  134 glusterd_volinfo_dup(glusterd_volinfo_t *volinfo,
  135                      glusterd_volinfo_t **dup_volinfo,
  136                      gf_boolean_t set_userauth);
  137 
  138 char *
  139 glusterd_auth_get_username(glusterd_volinfo_t *volinfo);
  140 
  141 char *
  142 glusterd_auth_get_password(glusterd_volinfo_t *volinfo);
  143 
  144 int32_t
  145 glusterd_auth_set_username(glusterd_volinfo_t *volinfo, char *username);
  146 
  147 int32_t
  148 glusterd_auth_set_password(glusterd_volinfo_t *volinfo, char *password);
  149 
  150 void
  151 glusterd_auth_cleanup(glusterd_volinfo_t *volinfo);
  152 
  153 int32_t
  154 glusterd_brickprocess_new(glusterd_brick_proc_t **brickprocess);
  155 
  156 int32_t
  157 glusterd_brickinfo_new(glusterd_brickinfo_t **brickinfo);
  158 
  159 int32_t
  160 glusterd_brickinfo_new_from_brick(char *brick, glusterd_brickinfo_t **brickinfo,
  161                                   gf_boolean_t construct_real_path,
  162                                   char **op_errstr);
  163 
  164 int32_t
  165 glusterd_volinfo_find(const char *volname, glusterd_volinfo_t **volinfo);
  166 
  167 gf_boolean_t
  168 glusterd_volume_exists(const char *volname);
  169 
  170 int
  171 glusterd_volinfo_find_by_volume_id(uuid_t volume_id,
  172                                    glusterd_volinfo_t **volinfo);
  173 
  174 int32_t
  175 glusterd_service_stop(const char *service, char *pidfile, int sig,
  176                       gf_boolean_t force_kill);
  177 
  178 int32_t
  179 glusterd_service_stop_nolock(const char *service, char *pidfile, int sig,
  180                              gf_boolean_t force_kill);
  181 
  182 int
  183 glusterd_get_next_available_brickid(glusterd_volinfo_t *volinfo);
  184 
  185 int32_t
  186 glusterd_resolve_brick(glusterd_brickinfo_t *brickinfo);
  187 
  188 int
  189 glusterd_brick_process_add_brick(glusterd_brickinfo_t *brickinfo,
  190                                  glusterd_brickinfo_t *parent_brickinfo);
  191 
  192 int
  193 glusterd_brick_process_remove_brick(glusterd_brickinfo_t *brickinfo,
  194                                     int *last_brick);
  195 
  196 int
  197 glusterd_brick_proc_for_port(int port, glusterd_brick_proc_t **brickprocess);
  198 
  199 int32_t
  200 glusterd_volume_start_glusterfs(glusterd_volinfo_t *volinfo,
  201                                 glusterd_brickinfo_t *brickinfo,
  202                                 gf_boolean_t wait);
  203 
  204 int32_t
  205 glusterd_volume_stop_glusterfs(glusterd_volinfo_t *volinfo,
  206                                glusterd_brickinfo_t *brickinfo,
  207                                gf_boolean_t del_brick);
  208 
  209 int
  210 send_attach_req(xlator_t *this, struct rpc_clnt *rpc, char *path,
  211                 glusterd_brickinfo_t *brick, glusterd_brickinfo_t *other_brick,
  212                 int op);
  213 
  214 glusterd_volinfo_t *
  215 glusterd_volinfo_ref(glusterd_volinfo_t *volinfo);
  216 
  217 glusterd_volinfo_t *
  218 glusterd_volinfo_unref(glusterd_volinfo_t *volinfo);
  219 
  220 int32_t
  221 glusterd_volinfo_delete(glusterd_volinfo_t *volinfo);
  222 
  223 int32_t
  224 glusterd_brickinfo_delete(glusterd_brickinfo_t *brickinfo);
  225 
  226 gf_boolean_t
  227 glusterd_is_cli_op_req(int32_t op);
  228 
  229 int32_t
  230 glusterd_volume_brickinfo_get_by_brick(char *brick, glusterd_volinfo_t *volinfo,
  231                                        glusterd_brickinfo_t **brickinfo,
  232                                        gf_boolean_t construct_real_path);
  233 
  234 int32_t
  235 glusterd_add_volumes_to_export_dict(dict_t *peer_data, char **buf,
  236                                     u_int *length);
  237 
  238 int32_t
  239 glusterd_compare_friend_data(dict_t *peer_data, int32_t *status,
  240                              char *hostname);
  241 
  242 int
  243 glusterd_compute_cksum(glusterd_volinfo_t *volinfo, gf_boolean_t is_quota_conf);
  244 
  245 void
  246 glusterd_set_socket_filepath(char *sock_filepath, char *sockpath, size_t len);
  247 
  248 struct rpc_clnt *
  249 glusterd_pending_node_get_rpc(glusterd_pending_node_t *pending_node);
  250 
  251 void
  252 glusterd_pending_node_put_rpc(glusterd_pending_node_t *pending_node);
  253 
  254 int
  255 glusterd_remote_hostname_get(rpcsvc_request_t *req, char *remote_host, int len);
  256 
  257 int32_t
  258 glusterd_import_friend_volumes_synctask(void *opaque);
  259 
  260 int32_t
  261 glusterd_import_friend_volumes(dict_t *peer_data);
  262 void
  263 glusterd_set_volume_status(glusterd_volinfo_t *volinfo,
  264                            glusterd_volume_status status);
  265 
  266 int32_t
  267 glusterd_volume_count_get(void);
  268 int32_t
  269 glusterd_add_volume_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict,
  270                             int32_t count, char *prefix);
  271 int
  272 glusterd_get_brickinfo(xlator_t *this, const char *brickname, int port,
  273                        glusterd_brickinfo_t **brickinfo);
  274 
  275 void
  276 glusterd_set_brick_status(glusterd_brickinfo_t *brickinfo,
  277                           gf_brick_status_t status);
  278 
  279 gf_boolean_t
  280 glusterd_is_brick_started(glusterd_brickinfo_t *brickinfo);
  281 
  282 int
  283 glusterd_friend_brick_belongs(glusterd_volinfo_t *volinfo,
  284                               glusterd_brickinfo_t *brickinfo, void *uuid);
  285 int
  286 glusterd_all_volume_cond_check(glusterd_condition_func func, int status,
  287                                void *ctx);
  288 int
  289 glusterd_brick_start(glusterd_volinfo_t *volinfo,
  290                      glusterd_brickinfo_t *brickinfo, gf_boolean_t wait,
  291                      gf_boolean_t only_connect);
  292 int
  293 glusterd_brick_stop(glusterd_volinfo_t *volinfo,
  294                     glusterd_brickinfo_t *brickinfo, gf_boolean_t del_brick);
  295 
  296 int
  297 glusterd_is_defrag_on(glusterd_volinfo_t *volinfo);
  298 
  299 int32_t
  300 glusterd_volinfo_bricks_delete(glusterd_volinfo_t *volinfo);
  301 
  302 int
  303 glusterd_new_brick_validate(char *brick, glusterd_brickinfo_t *brickinfo,
  304                             char *op_errstr, size_t len, char *op);
  305 int32_t
  306 glusterd_volume_brickinfos_delete(glusterd_volinfo_t *volinfo);
  307 
  308 int32_t
  309 glusterd_volume_brickinfo_get(uuid_t uuid, char *hostname, char *path,
  310                               glusterd_volinfo_t *volinfo,
  311                               glusterd_brickinfo_t **brickinfo);
  312 
  313 int
  314 glusterd_brickinfo_get(uuid_t uuid, char *hostname, char *path,
  315                        glusterd_brickinfo_t **brickinfo);
  316 
  317 int
  318 glusterd_rb_check_bricks(glusterd_volinfo_t *volinfo,
  319                          glusterd_brickinfo_t *src_brick,
  320                          glusterd_brickinfo_t *dst_brick);
  321 
  322 int
  323 glusterd_check_and_set_brick_xattr(char *host, char *path, uuid_t uuid,
  324                                    char **op_errstr, gf_boolean_t is_force);
  325 
  326 int
  327 glusterd_validate_and_create_brickpath(glusterd_brickinfo_t *brickinfo,
  328                                        uuid_t volume_id, char *volname,
  329                                        char **op_errstr, gf_boolean_t is_force,
  330                                        gf_boolean_t ignore_partition);
  331 int
  332 glusterd_sm_tr_log_transition_add(glusterd_sm_tr_log_t *log, int old_state,
  333                                   int new_state, int event);
  334 int
  335 glusterd_sm_tr_log_init(glusterd_sm_tr_log_t *log, char *(*state_name_get)(int),
  336                         char *(*event_name_get)(int), size_t size);
  337 void
  338 glusterd_sm_tr_log_delete(glusterd_sm_tr_log_t *log);
  339 
  340 int
  341 glusterd_sm_tr_log_add_to_dict(dict_t *dict,
  342                                glusterd_sm_tr_log_t *circular_log);
  343 int
  344 glusterd_remove_pending_entry(struct cds_list_head *list, void *elem);
  345 int
  346 glusterd_clear_pending_nodes(struct cds_list_head *list);
  347 int32_t
  348 glusterd_brick_connect(glusterd_volinfo_t *volinfo,
  349                        glusterd_brickinfo_t *brickinfo, char *socketpath);
  350 int32_t
  351 glusterd_brick_disconnect(glusterd_brickinfo_t *brickinfo);
  352 int32_t
  353 glusterd_delete_volume(glusterd_volinfo_t *volinfo);
  354 int32_t
  355 glusterd_delete_brick(glusterd_volinfo_t *volinfo,
  356                       glusterd_brickinfo_t *brickinfo);
  357 
  358 int32_t
  359 glusterd_delete_all_bricks(glusterd_volinfo_t *volinfo);
  360 
  361 int
  362 glusterd_spawn_daemons(void *opaque);
  363 
  364 int
  365 glusterd_restart_gsyncds(glusterd_conf_t *conf);
  366 
  367 int
  368 glusterd_start_gsync(glusterd_volinfo_t *master_vol, char *slave,
  369                      char *path_list, char *conf_path, char *glusterd_uuid_str,
  370                      char **op_errstr, gf_boolean_t is_pause);
  371 int
  372 glusterd_get_local_brickpaths(glusterd_volinfo_t *volinfo, char **pathlist);
  373 
  374 int32_t
  375 glusterd_recreate_bricks(glusterd_conf_t *conf);
  376 int32_t
  377 glusterd_handle_upgrade_downgrade(dict_t *options, glusterd_conf_t *conf,
  378                                   gf_boolean_t upgrade, gf_boolean_t downgrade);
  379 
  380 int
  381 glusterd_add_brick_detail_to_dict(glusterd_volinfo_t *volinfo,
  382                                   glusterd_brickinfo_t *brickinfo, dict_t *dict,
  383                                   int32_t count);
  384 
  385 int32_t
  386 glusterd_add_brick_to_dict(glusterd_volinfo_t *volinfo,
  387                            glusterd_brickinfo_t *brickinfo, dict_t *dict,
  388                            int32_t count);
  389 
  390 int32_t
  391 glusterd_get_all_volnames(dict_t *dict);
  392 
  393 gf_boolean_t
  394 glusterd_is_fuse_available();
  395 
  396 int
  397 glusterd_brick_statedump(glusterd_volinfo_t *volinfo,
  398                          glusterd_brickinfo_t *brickinfo, char *options,
  399                          int option_cnt, char **op_errstr);
  400 
  401 int
  402 glusterd_brick_terminate(glusterd_volinfo_t *volinfo,
  403                          glusterd_brickinfo_t *brickinfo, char *options,
  404                          int option_cnt, char **op_errstr);
  405 
  406 #ifdef BUILD_GNFS
  407 int
  408 glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr);
  409 #endif
  410 
  411 int
  412 glusterd_client_statedump(char *volname, char *options, int option_cnt,
  413                           char **op_errstr);
  414 
  415 int
  416 glusterd_quotad_statedump(char *options, int option_cnt, char **op_errstr);
  417 
  418 gf_boolean_t
  419 glusterd_is_volume_replicate(glusterd_volinfo_t *volinfo);
  420 
  421 gf_boolean_t
  422 glusterd_is_brick_decommissioned(glusterd_volinfo_t *volinfo, char *hostname,
  423                                  char *path);
  424 int
  425 glusterd_friend_contains_vol_bricks(glusterd_volinfo_t *volinfo,
  426                                     uuid_t friend_uuid);
  427 
  428 int
  429 glusterd_friend_contains_snap_bricks(glusterd_snap_t *snapinfo,
  430                                      uuid_t friend_uuid);
  431 int
  432 glusterd_friend_remove_cleanup_vols(uuid_t uuid);
  433 
  434 int
  435 glusterd_get_client_filepath(char *filepath, glusterd_volinfo_t *volinfo,
  436                              gf_transport_type type);
  437 int
  438 glusterd_get_trusted_client_filepath(char *filepath,
  439                                      glusterd_volinfo_t *volinfo,
  440                                      gf_transport_type type);
  441 int
  442 glusterd_restart_rebalance(glusterd_conf_t *conf);
  443 
  444 int
  445 glusterd_restart_rebalance_for_volume(glusterd_volinfo_t *volinfo);
  446 
  447 void
  448 glusterd_defrag_info_set(glusterd_volinfo_t *volinfo, dict_t *dict, int cmd,
  449                          int status, int op);
  450 
  451 int32_t
  452 glusterd_add_bricks_hname_path_to_dict(dict_t *dict,
  453                                        glusterd_volinfo_t *volinfo);
  454 
  455 int
  456 glusterd_add_node_to_dict(char *server, dict_t *dict, int count,
  457                           dict_t *vol_opts);
  458 
  459 int
  460 glusterd_calc_dist_leaf_count(int rcount, int scount);
  461 
  462 int
  463 glusterd_get_dist_leaf_count(glusterd_volinfo_t *volinfo);
  464 
  465 glusterd_brickinfo_t *
  466 glusterd_get_brickinfo_by_position(glusterd_volinfo_t *volinfo, uint32_t pos);
  467 
  468 gf_boolean_t
  469 glusterd_is_local_brick(xlator_t *this, glusterd_volinfo_t *volinfo,
  470                         glusterd_brickinfo_t *brickinfo);
  471 int
  472 glusterd_validate_volume_id(dict_t *op_dict, glusterd_volinfo_t *volinfo);
  473 
  474 int
  475 glusterd_defrag_volume_status_update(glusterd_volinfo_t *volinfo,
  476                                      dict_t *rsp_dict, int32_t cmd);
  477 
  478 int
  479 glusterd_check_files_identical(char *filename1, char *filename2,
  480                                gf_boolean_t *identical);
  481 
  482 int
  483 glusterd_check_topology_identical(const char *filename1, const char *filename2,
  484                                   gf_boolean_t *identical);
  485 
  486 void
  487 glusterd_volinfo_reset_defrag_stats(glusterd_volinfo_t *volinfo);
  488 int
  489 glusterd_volset_help(dict_t *dict, char **op_errstr);
  490 
  491 int32_t
  492 glusterd_sync_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict);
  493 int32_t
  494 glusterd_gsync_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict, char *op_errstr);
  495 int32_t
  496 glusterd_rb_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict);
  497 int
  498 glusterd_profile_volume_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict);
  499 int
  500 glusterd_volume_status_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp_dict);
  501 int
  502 glusterd_volume_rebalance_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict);
  503 int
  504 glusterd_volume_heal_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict);
  505 int
  506 glusterd_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict);
  507 int
  508 glusterd_sys_exec_output_rsp_dict(dict_t *aggr, dict_t *rsp_dict);
  509 int32_t
  510 glusterd_handle_node_rsp(dict_t *req_ctx, void *pending_entry, glusterd_op_t op,
  511                          dict_t *rsp_dict, dict_t *op_ctx, char **op_errstr,
  512                          gd_node_type type);
  513 int
  514 glusterd_max_opversion_use_rsp_dict(dict_t *dst, dict_t *src);
  515 
  516 int
  517 glusterd_volume_bitrot_scrub_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict);
  518 
  519 int
  520 glusterd_volume_heal_use_rsp_dict(dict_t *aggr, dict_t *rsp_dict);
  521 
  522 int32_t
  523 glusterd_check_if_quota_trans_enabled(glusterd_volinfo_t *volinfo);
  524 
  525 int
  526 glusterd_volume_quota_copy_to_op_ctx_dict(dict_t *aggr, dict_t *rsp);
  527 int
  528 _profile_volume_add_brick_rsp(dict_t *this, char *key, data_t *value,
  529                               void *data);
  530 int
  531 glusterd_profile_volume_brick_rsp(void *pending_entry, dict_t *rsp_dict,
  532                                   dict_t *op_ctx, char **op_errstr,
  533                                   gd_node_type type);
  534 
  535 int32_t
  536 glusterd_set_originator_uuid(dict_t *dict);
  537 
  538 /* Should be used only when an operation is in progress, as that is the only
  539  * time a lock_owner is set
  540  */
  541 gf_boolean_t
  542 is_origin_glusterd(dict_t *dict);
  543 
  544 int
  545 glusterd_get_next_global_opt_version_str(dict_t *opts, char **version_str);
  546 
  547 int
  548 glusterd_generate_and_set_task_id(dict_t *dict, char *key, const int keylen);
  549 
  550 int
  551 glusterd_validate_and_set_gfid(dict_t *op_ctx, dict_t *req_dict,
  552                                char **op_errstr);
  553 
  554 int
  555 glusterd_copy_uuid_to_dict(uuid_t uuid, dict_t *dict, char *key,
  556                            const int keylen);
  557 
  558 gf_boolean_t
  559 glusterd_is_same_address(char *name1, char *name2);
  560 
  561 void
  562 gd_update_volume_op_versions(glusterd_volinfo_t *volinfo);
  563 
  564 int
  565 op_version_check(xlator_t *this, int min_op_version, char *msg, int msglen);
  566 
  567 gf_boolean_t
  568 gd_is_remove_brick_committed(glusterd_volinfo_t *volinfo);
  569 
  570 int
  571 glusterd_remove_brick_validate_bricks(gf1_op_commands cmd, int32_t brick_count,
  572                                       dict_t *dict, glusterd_volinfo_t *volinfo,
  573                                       char **errstr, gf_cli_defrag_type);
  574 int
  575 glusterd_get_slave_details_confpath(glusterd_volinfo_t *volinfo, dict_t *dict,
  576                                     char **slave_url, char **slave_host,
  577                                     char **slave_vol, char **conf_path,
  578                                     char **op_errstr);
  579 
  580 int
  581 glusterd_get_slave_info(char *slave, char **slave_url, char **hostname,
  582                         char **slave_vol, char **op_errstr);
  583 
  584 int
  585 glusterd_get_statefile_name(glusterd_volinfo_t *volinfo, char *slave,
  586                             char *conf_path, char **statefile,
  587                             gf_boolean_t *is_template_in_use);
  588 
  589 int
  590 glusterd_gsync_read_frm_status(char *path, char *buf, size_t blen);
  591 
  592 int
  593 glusterd_create_status_file(char *master, char *slave, char *slave_url,
  594                             char *slave_vol, char *status);
  595 
  596 int
  597 glusterd_check_restart_gsync_session(glusterd_volinfo_t *volinfo, char *slave,
  598                                      dict_t *resp_dict, char *path_list,
  599                                      char *conf_path, gf_boolean_t is_force);
  600 
  601 int
  602 glusterd_check_gsync_running_local(char *master, char *slave, char *conf_path,
  603                                    gf_boolean_t *is_run);
  604 
  605 gf_boolean_t
  606 glusterd_is_status_tasks_op(glusterd_op_t op, dict_t *dict);
  607 
  608 gf_boolean_t
  609 gd_should_i_start_rebalance(glusterd_volinfo_t *volinfo);
  610 
  611 int
  612 glusterd_is_volume_quota_enabled(glusterd_volinfo_t *volinfo);
  613 
  614 int
  615 glusterd_is_volume_inode_quota_enabled(glusterd_volinfo_t *volinfo);
  616 
  617 int
  618 glusterd_is_bitrot_enabled(glusterd_volinfo_t *volinfo);
  619 
  620 gf_boolean_t
  621 glusterd_all_volumes_with_quota_stopped();
  622 
  623 void
  624 glusterd_clean_up_quota_store(glusterd_volinfo_t *volinfo);
  625 
  626 int
  627 glusterd_remove_auxiliary_mount(char *volname);
  628 
  629 gf_boolean_t
  630 glusterd_status_has_tasks(int cmd);
  631 
  632 int
  633 gd_stop_rebalance_process(glusterd_volinfo_t *volinfo);
  634 
  635 rpc_clnt_t *
  636 glusterd_rpc_clnt_unref(glusterd_conf_t *conf, rpc_clnt_t *rpc);
  637 
  638 int32_t
  639 glusterd_compare_volume_name(struct cds_list_head *, struct cds_list_head *);
  640 
  641 char *
  642 glusterd_get_brick_mount_device(char *brick_path);
  643 
  644 struct mntent *
  645 glusterd_get_mnt_entry_info(char *mnt_pt, char *buff, int buflen,
  646                             struct mntent *entry_ptr);
  647 
  648 int
  649 glusterd_get_brick_root(char *path, char **mount_point);
  650 
  651 int32_t
  652 glusterd_lvm_snapshot_remove(dict_t *rsp_dict, glusterd_volinfo_t *snap_vol);
  653 
  654 gf_boolean_t
  655 gd_vol_is_geo_rep_active(glusterd_volinfo_t *volinfo);
  656 
  657 int32_t
  658 glusterd_get_brick_mount_dir(char *brickpath, char *hostname, char *mount_dir);
  659 
  660 int32_t
  661 glusterd_aggr_brick_mount_dirs(dict_t *aggr, dict_t *rsp_dict);
  662 
  663 int32_t
  664 glusterd_take_lvm_snapshot(glusterd_brickinfo_t *brickinfo,
  665                            char *origin_brick_path);
  666 
  667 void
  668 glusterd_launch_synctask(synctask_fn_t fn, void *opaque);
  669 
  670 int
  671 glusterd_enable_default_options(glusterd_volinfo_t *volinfo, char *option);
  672 
  673 int
  674 glusterd_unlink_file(char *sock_file_path);
  675 
  676 int32_t
  677 glusterd_find_brick_mount_path(char *brick_path, char **brick_mount_path);
  678 
  679 /*
  680  * Function to retrieve list of snap volnames and their uuids
  681  */
  682 int
  683 glusterd_snapshot_get_volnames_uuids(dict_t *dict, char *volname,
  684                                      gf_getsnap_name_uuid_rsp *snap_info_rsp);
  685 
  686 int
  687 glusterd_update_mntopts(char *brick_path, glusterd_brickinfo_t *brickinfo);
  688 
  689 int
  690 glusterd_update_fs_label(glusterd_brickinfo_t *brickinfo);
  691 
  692 int
  693 glusterd_get_volopt_content(dict_t *dict, gf_boolean_t xml_out);
  694 
  695 int
  696 glusterd_get_global_max_op_version(rpcsvc_request_t *req, dict_t *ctx,
  697                                    int count);
  698 
  699 int
  700 glusterd_get_global_options_for_all_vols(rpcsvc_request_t *req, dict_t *dict,
  701                                          char **op_errstr);
  702 
  703 int
  704 glusterd_get_default_val_for_volopt(dict_t *dict, gf_boolean_t all_opts,
  705                                     char *key, char *orig_key,
  706                                     glusterd_volinfo_t *volinfo,
  707                                     char **err_str);
  708 
  709 int
  710 glusterd_check_client_op_version_support(char *volname, uint32_t op_version,
  711                                          char **op_errstr);
  712 
  713 gf_boolean_t
  714 glusterd_have_peers();
  715 
  716 gf_boolean_t
  717 glusterd_have_volumes();
  718 
  719 void
  720 glusterd_get_rebalance_volfile(glusterd_volinfo_t *volinfo, char *path,
  721                                int path_len);
  722 
  723 void
  724 glusterd_get_gfproxy_client_volfile(glusterd_volinfo_t *volinfo, char *path,
  725                                     int path_len);
  726 
  727 int32_t
  728 glusterd_brickinfo_dup(glusterd_brickinfo_t *brickinfo,
  729                        glusterd_brickinfo_t *dup_brickinfo);
  730 
  731 int
  732 glusterd_vol_add_quota_conf_to_dict(glusterd_volinfo_t *volinfo, dict_t *load,
  733                                     int vol_idx, char *prefix);
  734 
  735 int32_t
  736 glusterd_import_volinfo(dict_t *peer_data, int count,
  737                         glusterd_volinfo_t **volinfo, char *prefix);
  738 
  739 int
  740 glusterd_import_quota_conf(dict_t *peer_data, int vol_idx,
  741                            glusterd_volinfo_t *new_volinfo, char *prefix);
  742 
  743 gf_boolean_t
  744 glusterd_is_shd_compatible_volume(glusterd_volinfo_t *volinfo);
  745 
  746 gf_boolean_t
  747 glusterd_is_shd_compatible_type(int type);
  748 
  749 gf_boolean_t
  750 glusterd_are_all_volumes_stopped();
  751 
  752 gf_boolean_t
  753 glusterd_all_shd_compatible_volumes_stopped();
  754 
  755 void
  756 glusterd_nfs_pmap_deregister();
  757 
  758 gf_boolean_t
  759 glusterd_is_volume_started(glusterd_volinfo_t *volinfo);
  760 
  761 int
  762 glusterd_volume_get_type_str(glusterd_volinfo_t *volinfo, char **vol_type_str);
  763 
  764 int
  765 glusterd_volume_get_status_str(glusterd_volinfo_t *volinfo, char *status_str);
  766 
  767 void
  768 glusterd_brick_get_status_str(glusterd_brickinfo_t *brickinfo,
  769                               char *status_str);
  770 
  771 int
  772 glusterd_volume_get_transport_type_str(glusterd_volinfo_t *volinfo,
  773                                        char *transport_type_str);
  774 
  775 int
  776 glusterd_volume_get_quorum_status_str(glusterd_volinfo_t *volinfo,
  777                                       char *quorum_status_str);
  778 
  779 int
  780 glusterd_volume_get_rebalance_status_str(glusterd_volinfo_t *volinfo,
  781                                          char *rebal_status_str);
  782 
  783 void
  784 glusterd_list_add_order(struct cds_list_head *new, struct cds_list_head *head,
  785                         int (*compare)(struct cds_list_head *,
  786                                        struct cds_list_head *));
  787 
  788 struct rpc_clnt *
  789 glusterd_defrag_rpc_get(glusterd_defrag_info_t *defrag);
  790 
  791 struct rpc_clnt *
  792 glusterd_defrag_rpc_put(glusterd_defrag_info_t *defrag);
  793 
  794 int32_t
  795 glusterd_count_connected_peers(int32_t *count);
  796 
  797 int
  798 glusterd_volume_brick_for_each(glusterd_volinfo_t *volinfo, void *data,
  799                                int (*fn)(glusterd_volinfo_t *,
  800                                          glusterd_brickinfo_t *,
  801                                          dict_t *mod_dict, void *));
  802 
  803 int
  804 glusterd_get_dummy_client_filepath(char *filepath, glusterd_volinfo_t *volinfo,
  805                                    gf_transport_type type);
  806 
  807 int
  808 glusterd_handle_replicate_brick_ops(glusterd_volinfo_t *volinfo,
  809                                     glusterd_brickinfo_t *brickinfo,
  810                                     glusterd_op_t op);
  811 void
  812 assign_brick_groups(glusterd_volinfo_t *volinfo);
  813 
  814 glusterd_brickinfo_t *
  815 get_last_brick_of_brick_group(glusterd_volinfo_t *volinfo,
  816                               glusterd_brickinfo_t *brickinfo);
  817 int
  818 glusterd_get_rb_dst_brickinfo(glusterd_volinfo_t *volinfo,
  819                               glusterd_brickinfo_t **brickinfo);
  820 int
  821 rb_update_dstbrick_port(glusterd_brickinfo_t *dst_brickinfo, dict_t *rsp_dict,
  822                         dict_t *req_dict);
  823 int
  824 glusterd_op_perform_replace_brick(glusterd_volinfo_t *volinfo, char *old_brick,
  825                                   char *new_brick, dict_t *dict);
  826 int32_t
  827 glusterd_brick_unlink_socket_file(glusterd_volinfo_t *volinfo,
  828                                   glusterd_brickinfo_t *brickinfo);
  829 char *
  830 gd_rb_op_to_str(char *op);
  831 
  832 glusterd_op_t
  833 gd_cli_to_gd_op(char *cli_op);
  834 
  835 int
  836 glusterd_get_dst_brick_info(char **dst_brick, char *volname, char **op_errstr,
  837                             glusterd_brickinfo_t **dst_brickinfo, char **host,
  838                             dict_t *dict, char **dup_dstbrick);
  839 
  840 int
  841 glusterd_brick_op_prerequisites(dict_t *dict, char **op, glusterd_op_t *gd_op,
  842                                 char **volname, glusterd_volinfo_t **volinfo,
  843                                 char **src_brick,
  844                                 glusterd_brickinfo_t **src_brickinfo,
  845                                 char *pidfile, char **op_errstr,
  846                                 dict_t *rsp_dict);
  847 
  848 int
  849 glusterd_get_volinfo_from_brick(char *brick, glusterd_volinfo_t **volinfo);
  850 
  851 gf_boolean_t
  852 glusterd_is_profile_on(glusterd_volinfo_t *volinfo);
  853 
  854 char *
  855 search_brick_path_from_proc(pid_t brick_pid, char *brickpath);
  856 
  857 int32_t
  858 glusterd_add_shd_to_dict(glusterd_volinfo_t *volinfo, dict_t *dict,
  859                          int32_t count);
  860 #endif