"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/libglusterfs/src/glusterfs/statedump.h" (16 Sep 2020, 3434 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 "statedump.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2   Copyright (c) 2008-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 
   11 #ifndef STATEDUMP_H
   12 #define STATEDUMP_H
   13 
   14 #include <stdarg.h>
   15 #include "glusterfs/inode.h"
   16 #include "glusterfs/strfd.h"
   17 
   18 #define GF_DUMP_MAX_BUF_LEN 4096
   19 
   20 typedef struct gf_dump_xl_options_ {
   21     gf_boolean_t dump_priv;
   22     gf_boolean_t dump_inode;
   23     gf_boolean_t dump_fd;
   24     gf_boolean_t dump_inodectx;
   25     gf_boolean_t dump_fdctx;
   26     gf_boolean_t dump_history;
   27 } gf_dump_xl_options_t;
   28 
   29 typedef struct gf_dump_options_ {
   30     gf_boolean_t dump_mem;
   31     gf_boolean_t dump_iobuf;
   32     gf_boolean_t dump_callpool;
   33     gf_dump_xl_options_t xl_options;  // options for all xlators
   34     char *dump_path;
   35 } gf_dump_options_t;
   36 
   37 extern gf_dump_options_t dump_options;
   38 
   39 __attribute__((__format__(__printf__, 3, 4))) static inline void
   40 _gf_proc_dump_build_key(char *key, const char *prefix, const char *fmt, ...)
   41 {
   42     va_list ap;
   43     int32_t len;
   44 
   45     len = snprintf(key, GF_DUMP_MAX_BUF_LEN, "%s.", prefix);
   46     if (len >= 0) {
   47         va_start(ap, fmt);
   48         len = vsnprintf(key + len, GF_DUMP_MAX_BUF_LEN - len, fmt, ap);
   49         va_end(ap);
   50     }
   51     if (len < 0) {
   52         *key = 0;
   53     }
   54 }
   55 
   56 #define gf_proc_dump_build_key(key, key_prefix, fmt...)                        \
   57     {                                                                          \
   58         _gf_proc_dump_build_key(key, key_prefix, ##fmt);                       \
   59     }
   60 
   61 #define GF_PROC_DUMP_SET_OPTION(opt, val) opt = val
   62 
   63 #define GF_CHECK_DUMP_OPTION_ENABLED(option_dump, var, label)                  \
   64     do {                                                                       \
   65         if (option_dump == _gf_true) {                                         \
   66             var = _gf_false;                                                   \
   67             goto label;                                                        \
   68         }                                                                      \
   69     } while (0);
   70 
   71 void
   72 gf_proc_dump_init();
   73 
   74 void
   75 gf_proc_dump_fini(void);
   76 
   77 void
   78 gf_proc_dump_cleanup(void);
   79 
   80 void
   81 gf_proc_dump_info(int signum, glusterfs_ctx_t *ctx);
   82 
   83 int
   84 gf_proc_dump_add_section(char *key, ...)
   85     __attribute__((__format__(__printf__, 1, 2)));
   86 
   87 int
   88 gf_proc_dump_write(char *key, char *value, ...)
   89     __attribute__((__format__(__printf__, 2, 3)));
   90 
   91 void
   92 inode_table_dump(inode_table_t *itable, char *prefix);
   93 
   94 void
   95 inode_table_dump_to_dict(inode_table_t *itable, char *prefix, dict_t *dict);
   96 
   97 void
   98 fdtable_dump(fdtable_t *fdtable, char *prefix);
   99 
  100 void
  101 fdtable_dump_to_dict(fdtable_t *fdtable, char *prefix, dict_t *dict);
  102 
  103 void
  104 inode_dump(inode_t *inode, char *prefix);
  105 
  106 void
  107 gf_proc_dump_mem_info_to_dict(dict_t *dict);
  108 
  109 void
  110 gf_proc_dump_mempool_info_to_dict(glusterfs_ctx_t *ctx, dict_t *dict);
  111 
  112 void
  113 glusterd_init(int sig);
  114 
  115 void
  116 gf_proc_dump_xlator_private(xlator_t *this, strfd_t *strfd);
  117 
  118 void
  119 gf_proc_dump_mallinfo(strfd_t *strfd);
  120 
  121 void
  122 gf_proc_dump_xlator_history(xlator_t *this, strfd_t *strfd);
  123 
  124 void
  125 gf_proc_dump_xlator_meminfo(xlator_t *this, strfd_t *strfd);
  126 
  127 void
  128 gf_proc_dump_xlator_profile(xlator_t *this, strfd_t *strfd);
  129 
  130 #endif /* STATEDUMP_H */