libmultipath: remove unused "stdout helpers"
[multipath-tools/.git] / libmultipath / print.h
1 #define PRINT_PATH_LONG      "%w %i %d %D %p %t %T %s %o"
2 #define PRINT_PATH_INDENT    "%i %d %D %t %T %o"
3 #define PRINT_PATH_CHECKER   "%i %d %D %p %t %T %o %C"
4 #define PRINT_MAP_STATUS     "%n %F %Q %N %t %r"
5 #define PRINT_MAP_STATS      "%n %0 %1 %2 %3 %4"
6 #define PRINT_MAP_NAMES      "%n %d %w"
7 #define PRINT_MAP_PROPS      "size=%S features='%f' hwhandler='%h' wp=%r"
8 #define PRINT_PG_INDENT      "policy='%s' prio=%p status=%t"
9
10 #define PRINT_JSON_MULTIPLIER     5
11 #define PRINT_JSON_MAJOR_VERSION  0
12 #define PRINT_JSON_MINOR_VERSION  1
13 #define PRINT_JSON_START_VERSION  "   \"major_version\": %d,\n" \
14                                   "   \"minor_version\": %d,\n"
15 #define PRINT_JSON_START_ELEM     "{\n"
16 #define PRINT_JSON_START_MAP      "   \"map\":"
17 #define PRINT_JSON_START_MAPS     "\"maps\": ["
18 #define PRINT_JSON_START_PATHS    "\"paths\": ["
19 #define PRINT_JSON_START_GROUPS   "\"path_groups\": ["
20 #define PRINT_JSON_END_ELEM       "},"
21 #define PRINT_JSON_END_LAST_ELEM  "}"
22 #define PRINT_JSON_END_LAST       "}\n"
23 #define PRINT_JSON_END_ARRAY      "]\n"
24 #define PRINT_JSON_INDENT    "   "
25 #define PRINT_JSON_MAP       "{\n" \
26                              "      \"name\" : \"%n\",\n" \
27                              "      \"uuid\" : \"%w\",\n" \
28                              "      \"sysfs\" : \"%d\",\n" \
29                              "      \"failback\" : \"%F\",\n" \
30                              "      \"queueing\" : \"%Q\",\n" \
31                              "      \"paths\" : %N,\n" \
32                              "      \"write_prot\" : \"%r\",\n" \
33                              "      \"dm_st\" : \"%t\",\n" \
34                              "      \"features\" : \"%f\",\n" \
35                              "      \"hwhandler\" : \"%h\",\n" \
36                              "      \"action\" : \"%A\",\n" \
37                              "      \"path_faults\" : %0,\n" \
38                              "      \"vend\" : \"%v\",\n" \
39                              "      \"prod\" : \"%p\",\n" \
40                              "      \"rev\" : \"%e\",\n" \
41                              "      \"switch_grp\" : %1,\n" \
42                              "      \"map_loads\" : %2,\n" \
43                              "      \"total_q_time\" : %3,\n" \
44                              "      \"q_timeouts\" : %4,"
45
46 #define PRINT_JSON_GROUP     "{\n" \
47                              "         \"selector\" : \"%s\",\n" \
48                              "         \"pri\" : %p,\n" \
49                              "         \"dm_st\" : \"%t\","
50
51 #define PRINT_JSON_GROUP_NUM "         \"group\" : %d,\n"
52
53 #define PRINT_JSON_PATH      "{\n" \
54                              "            \"dev\" : \"%d\",\n"\
55                              "            \"dev_t\" : \"%D\",\n" \
56                              "            \"dm_st\" : \"%t\",\n" \
57                              "            \"dev_st\" : \"%o\",\n" \
58                              "            \"chk_st\" : \"%T\",\n" \
59                              "            \"checker\" : \"%c\",\n" \
60                              "            \"pri\" : %p,\n" \
61                              "            \"host_wwnn\" : \"%N\",\n" \
62                              "            \"target_wwnn\" : \"%n\",\n" \
63                              "            \"host_wwpn\" : \"%R\",\n" \
64                              "            \"target_wwpn\" : \"%r\",\n" \
65                              "            \"host_adapter\" : \"%a\""
66
67 #define MAX_LINE_LEN  80
68 #define MAX_LINES     64
69 #define MAX_FIELD_LEN 128
70 #define PROGRESS_LEN  10
71
72 struct path_data {
73         char wildcard;
74         char * header;
75         int width;
76         int (*snprint)(char * buff, size_t len, struct path * pp);
77 };
78
79 struct multipath_data {
80         char wildcard;
81         char * header;
82         int width;
83         int (*snprint)(char * buff, size_t len, struct multipath * mpp);
84 };
85
86 struct pathgroup_data {
87         char wildcard;
88         char * header;
89         int width;
90         int (*snprint)(char * buff, size_t len, struct pathgroup * pgp);
91 };
92
93 void get_path_layout (vector pathvec, int header);
94 void get_multipath_layout (vector mpvec, int header);
95 int snprint_path_header (char *, int, char *);
96 int snprint_multipath_header (char *, int, char *);
97 int snprint_path (char *, int, char *, struct path *, int);
98 int snprint_multipath (char *, int, char *, struct multipath *, int);
99 int snprint_multipath_topology (char *, int, struct multipath * mpp,
100                                 int verbosity);
101 int snprint_multipath_topology_json (char * buff, int len,
102                                 struct vectors * vecs);
103 int snprint_multipath_map_json (char * buff, int len,
104                                 struct multipath * mpp, int last);
105 int snprint_defaults (struct config *, char *, int);
106 int snprint_blacklist (struct config *, char *, int);
107 int snprint_blacklist_except (struct config *, char *, int);
108 int snprint_blacklist_report (struct config *, char *, int);
109 int snprint_wildcards (char *, int);
110 int snprint_status (char *, int, struct vectors *);
111 int snprint_devices (struct config *, char *, int, struct vectors *);
112 int snprint_hwtable (struct config *, char *, int, vector);
113 int snprint_mptable (struct config *, char *, int, vector);
114 int snprint_overrides (struct config *, char *, int, struct hwentry *);
115 int snprint_path_serial (char *, size_t, struct path *);
116 int snprint_host_wwnn (char *, size_t, struct path *);
117 int snprint_host_wwpn (char *, size_t, struct path *);
118 int snprint_tgt_wwnn (char *, size_t, struct path *);
119 int snprint_tgt_wwpn (char *, size_t, struct path *);
120
121 void print_multipath_topology (struct multipath * mpp, int verbosity);
122 void print_all_paths (vector pathvec, int banner);
123 void print_all_paths_custo (vector pathvec, int banner, char *fmt);