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)
47 STAILQ_ENTRY(mt_status_nv) links;
50 struct mt_status_entry {
53 uint64_t value_unsigned;
58 mt_variable_type var_type;
59 struct mt_status_entry *parent;
60 STAILQ_HEAD(, mt_status_nv) nv_list;
61 STAILQ_HEAD(, mt_status_entry) child_entries;
62 STAILQ_ENTRY(mt_status_entry) links;
65 struct mt_status_data {
67 struct sbuf *cur_sb[32];
68 struct mt_status_entry *cur_entry[32];
71 STAILQ_HEAD(, mt_status_entry) entries;
77 MT_PF_FULL_PATH = 0x02,
78 MT_PF_INCLUDE_ROOT = 0x04
81 struct mt_print_params {
87 void mt_start_element(void *user_data, const char *name, const char **attr);
88 void mt_end_element(void *user_data, const char *name);
89 void mt_char_handler(void *user_data, const XML_Char *str, int len);
90 void mt_status_tree_sbuf(struct sbuf *sb, struct mt_status_entry *entry,
91 int indent, void (*sbuf_func)(struct sbuf *sb,
92 struct mt_status_entry *entry, void *arg), void *arg);
93 void mt_status_tree_print(struct mt_status_entry *entry, int indent,
94 void (*print_func)(struct mt_status_entry *entry,
95 void *arg), void *arg);
96 struct mt_status_entry *mt_entry_find(struct mt_status_entry *entry,
98 struct mt_status_entry *mt_status_entry_find(struct mt_status_data *status_data,
100 void mt_status_entry_free(struct mt_status_entry *entry);
101 void mt_status_free(struct mt_status_data *status_data);
102 void mt_entry_sbuf(struct sbuf *sb, struct mt_status_entry *entry, char *fmt);
103 void mt_param_parent_print(struct mt_status_entry *entry,
104 struct mt_print_params *print_params);
105 void mt_param_parent_sbuf(struct sbuf *sb, struct mt_status_entry *entry,
106 struct mt_print_params *print_params);
107 void mt_param_entry_sbuf(struct sbuf *sb, struct mt_status_entry *entry,
109 void mt_param_entry_print(struct mt_status_entry *entry, void *arg);
110 int mt_protect_print(struct mt_status_data *status_data, int verbose);
111 int mt_param_list(struct mt_status_data *status_data, char *param_name,
113 const char *mt_density_name(int density_num);
114 int mt_density_bp(int density_num, int bpi);
115 int mt_density_num(const char *density_name);
116 int mt_get_xml_str(int mtfd, unsigned long cmd, char **xml_str);
117 int mt_get_status(char *xml_str, struct mt_status_data *status_data);
120 #endif /* _MTLIB_H */