2 * Copyright (c) 2013, 2014 Spectra Logic Corporation
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions, and the following disclaimer,
10 * without modification.
11 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12 * substantially similar to the "NO WARRANTY" disclaimer below
13 * ("Disclaimer") and any redistribution must be conditioned upon
14 * including a substantially similar Disclaimer requirement for further
15 * binary redistribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGES.
30 * Authors: Ken Merry (Spectra Logic Corporation)
49 STAILQ_ENTRY(mt_status_nv) links;
52 struct mt_status_entry {
55 uint64_t value_unsigned;
60 mt_variable_type var_type;
61 struct mt_status_entry *parent;
62 STAILQ_HEAD(, mt_status_nv) nv_list;
63 STAILQ_HEAD(, mt_status_entry) child_entries;
64 STAILQ_ENTRY(mt_status_entry) links;
67 struct mt_status_data {
69 struct sbuf *cur_sb[32];
70 struct mt_status_entry *cur_entry[32];
73 STAILQ_HEAD(, mt_status_entry) entries;
79 MT_PF_FULL_PATH = 0x02,
80 MT_PF_INCLUDE_ROOT = 0x04
83 struct mt_print_params {
89 void mt_start_element(void *user_data, const char *name, const char **attr);
90 void mt_end_element(void *user_data, const char *name);
91 void mt_char_handler(void *user_data, const XML_Char *str, int len);
92 void mt_status_tree_sbuf(struct sbuf *sb, struct mt_status_entry *entry,
93 int indent, void (*sbuf_func)(struct sbuf *sb,
94 struct mt_status_entry *entry, void *arg), void *arg);
95 void mt_status_tree_print(struct mt_status_entry *entry, int indent,
96 void (*print_func)(struct mt_status_entry *entry,
97 void *arg), void *arg);
98 struct mt_status_entry *mt_entry_find(struct mt_status_entry *entry,
100 struct mt_status_entry *mt_status_entry_find(struct mt_status_data *status_data,
102 void mt_status_entry_free(struct mt_status_entry *entry);
103 void mt_status_free(struct mt_status_data *status_data);
104 void mt_entry_sbuf(struct sbuf *sb, struct mt_status_entry *entry, char *fmt);
105 void mt_param_parent_print(struct mt_status_entry *entry,
106 struct mt_print_params *print_params);
107 void mt_param_parent_sbuf(struct sbuf *sb, struct mt_status_entry *entry,
108 struct mt_print_params *print_params);
109 void mt_param_entry_sbuf(struct sbuf *sb, struct mt_status_entry *entry,
111 void mt_param_entry_print(struct mt_status_entry *entry, void *arg);
112 int mt_protect_print(struct mt_status_data *status_data, int verbose);
113 int mt_param_list(struct mt_status_data *status_data, char *param_name,
115 const char *mt_density_name(int density_num);
116 int mt_density_bp(int density_num, int bpi);
117 int mt_density_num(const char *density_name);
118 int mt_get_xml_str(int mtfd, unsigned long cmd, char **xml_str);
119 int mt_get_status(char *xml_str, struct mt_status_data *status_data);
122 #endif /* _MTLIB_H */