Print this page
NEX-14898 Null message (cfga_msg: NULL msgp) printed for sata devices with cfgadm
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Cynthia Eastham <cynthia.eastham@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.h
+++ new/usr/src/lib/cfgadm_plugins/sata/common/cfga_sata.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
24 25 * Use is subject to license terms.
25 26 */
26 27
27 28 #ifndef _CFGA_SATA_H
28 29 #define _CFGA_SATA_H
29 30
30 31 #pragma ident "%Z%%M% %I% %E% SMI"
31 32
32 33 #ifdef __cplusplus
33 34 extern "C" {
34 35 #endif
35 36
36 37 #include <stdlib.h>
37 38 #include <strings.h>
38 39 #include <fcntl.h>
39 40 #include <ctype.h>
40 41 #include <unistd.h>
41 42 #include <libintl.h>
42 43 #include <libdevice.h>
43 44 #include <sys/varargs.h>
44 45
45 46 #include <sys/sata/sata_cfgadm.h>
46 47
47 48 #include <libdevinfo.h>
48 49 #include <libdevice.h>
49 50 #include <librcm.h>
50 51 #include <synch.h>
|
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
51 52 #include <thread.h>
52 53 #include <assert.h>
53 54
54 55 #define CFGA_PLUGIN_LIB
55 56 #include <config_admin.h>
56 57
57 58 /*
58 59 * Debug stuff
59 60 */
60 61 #ifdef DEBUG
61 -#define DPRINTF printf
62 +#define DPRINTF (void) printf
62 63 #else
63 64 #define DPRINTF 0 &&
64 65 #endif /* DEBUG */
65 66
66 67 typedef enum {
67 68 CFGA_SATA_TERMINATE = 0,
68 69 CFGA_SATA_CONTINUE
69 70 } sata_cfga_recur_t;
70 71
71 72 /* for walking links */
72 73 typedef struct walk_link {
73 74 char *path;
74 75 char len;
75 76 char **linkpp;
76 77 } walk_link_t;
77 78
78 79 #define MATCH_MINOR_NAME 1
79 80
80 81 /* Misc text strings */
81 82 #define CFGA_DEV_DIR "/dev/cfg"
82 83 #define MINOR_SEP ":"
83 84 #define DYN_SEP "::"
84 85 #define PORT "port"
85 86 #define PORT_SEPARATOR "."
86 87 #define SATA "sata"
87 88 #define CFGA_DEVCTL_NODE ":devctl"
88 89 #define SATA_CFGADM_DEFAULT_AP_TYPE "unknown"
89 90 #define SLICE "s"
90 91 #define PARTITION "p"
91 92 #define PATH_SEP "/"
92 93
93 94 /* these set of defines are -lav listing */
94 95 #define SATA_UNDEF_STR "<undef>"
95 96 #define SATA_NO_CFG_STR "<no cfg str descr>"
96 97
97 98 /* -x commands */
98 99 #define SATA_RESET_ALL "sata_reset_all"
99 100 #define SATA_RESET_PORT "sata_reset_port"
100 101 #define SATA_RESET_DEVICE "sata_reset_device"
101 102 #define SATA_PORT_DEACTIVATE "sata_port_deactivate"
102 103 #define SATA_PORT_ACTIVATE "sata_port_activate"
103 104 #define SATA_PORT_SELF_TEST "sata_port_self_test"
104 105
105 106 /* -t command */
106 107 #define SATA_CNTRL_SELF_TEST "sata_cntrl_self_test"
107 108
108 109 /* for confirm operation */
109 110 #define SATA_CONFIRM_DEVICE "the device at: "
110 111 #define SATA_CONFIRM_DEVICE_SUSPEND \
111 112 "This operation will suspend activity on the SATA device\nContinue"
112 113 #define SATA_CONFIRM_DEVICE_ABORT \
113 114 "This operation will arbitrarily abort all commands " \
114 115 "on SATA device\nContinue"
115 116 #define SATA_CONFIRM_CONTROLLER "the controller: "
116 117 #define SATA_CONFIRM_CONTROLLER_ABORT \
117 118 "This operation will arbitrarirly abort all commands " \
118 119 "on the SATA controller\nContinue"
119 120 #define SATA_CONFIRM_PORT "the port: "
120 121 #define SATA_CONFIRM_PORT_DISABLE \
121 122 "This operation will disable activity on the SATA port\nContinue"
122 123 #define SATA_CONFIRM_PORT_ENABLE \
123 124 "This operation will enable activity on the SATA port\nContinue"
124 125
125 126 #define S_FREE(x) (((x) != NULL) ? \
126 127 (free(x), (x) = NULL) : (void *)0)
127 128
128 129 #define GET_DYN(a) (((a) != NULL) ? \
129 130 strstr((a), DYN_SEP) : (void *)0)
130 131
131 132 typedef struct sata_apid {
132 133 char *hba_phys;
133 134 char *dyncomp;
134 135 char *path;
135 136 uint_t flags;
136 137 } sata_apid_t;
137 138
138 139
139 140 /* Messages */
140 141
141 142 typedef struct msgcvt {
142 143 int intl; /* Flag: if 1, internationalize */
143 144 cfga_err_t cfga_err; /* Error code libcfgadm understands */
144 145 const char *msgstr;
145 146 } msgcvt_t;
146 147
147 148 #define NO_CVT 0
148 149 #define CVT 1
149 150
150 151 #define MSG_TBL_SZ(table) (sizeof ((table)) / sizeof (msgcvt_t))
151 152
152 153 typedef enum {
153 154 SATA_CFGA_ERR = -2,
154 155 SATA_CFGA_LIB_ERR,
155 156 SATA_CFGA_OK,
156 157 SATA_CFGA_BUSY,
157 158 SATA_CFGA_NO_REC
158 159 } sata_cfga_ret_t;
159 160
160 161 /* Messages */
161 162
162 163
163 164 /* Error message ids (and indices into sata_error_msgs) */
164 165 typedef enum {
165 166 CFGA_SATA_OK = 0,
166 167 CFGA_SATA_NACK,
167 168 CFGA_SATA_DEVICE_UNCONFIGURED,
168 169 CFGA_SATA_UNKNOWN,
169 170 CFGA_SATA_INTERNAL_ERROR,
170 171 CFGA_SATA_DATA_ERROR,
171 172 CFGA_SATA_OPTIONS,
172 173 CFGA_SATA_HWOPNOTSUPP,
173 174 CFGA_SATA_DYNAMIC_AP,
174 175 CFGA_SATA_AP,
175 176 CFGA_SATA_PORT,
176 177 CFGA_SATA_DEVCTL,
177 178 CFGA_SATA_DEV_CONFIGURE,
178 179 CFGA_SATA_DEV_UNCONFIGURE,
179 180 CFGA_SATA_DISCONNECTED,
180 181 CFGA_SATA_NOT_CONNECTED,
181 182 CFGA_SATA_NOT_CONFIGURED,
182 183 CFGA_SATA_ALREADY_CONNECTED,
183 184 CFGA_SATA_ALREADY_CONFIGURED,
184 185 CFGA_SATA_INVALID_DEVNAME,
185 186 CFGA_SATA_OPEN,
186 187 CFGA_SATA_IOCTL,
187 188 CFGA_SATA_BUSY,
188 189 CFGA_SATA_ALLOC_FAIL,
189 190 CFGA_SATA_OPNOTSUPP,
190 191 CFGA_SATA_DEVLINK,
191 192 CFGA_SATA_STATE,
192 193 CFGA_SATA_PRIV,
193 194 CFGA_SATA_NVLIST,
194 195 CFGA_SATA_ZEROLEN,
195 196
196 197 /* RCM Errors */
197 198 CFGA_SATA_RCM_HANDLE,
198 199 CFGA_SATA_RCM_ONLINE,
199 200 CFGA_SATA_RCM_OFFLINE,
200 201 CFGA_SATA_RCM_INFO
201 202
202 203 } cfga_sata_ret_t;
203 204
204 205 /*
205 206 * Given an error msg index, look up the associated string, and
206 207 * convert it to the current locale if required.
207 208 */
208 209 #define ERR_STR(msg_idx) \
209 210 (get_msg((msg_idx), sata_msgs, MSG_TBL_SZ(sata_msgs)))
210 211
211 212 /* Prototypes */
212 213
213 214 cfga_err_t sata_err_msg(char **, cfga_sata_ret_t, const char *, int);
214 215 cfga_sata_ret_t sata_rcm_offline(const char *, char **, char *, cfga_flags_t);
215 216 cfga_sata_ret_t sata_rcm_online(const char *, char **, char *, cfga_flags_t);
216 217 cfga_sata_ret_t sata_rcm_remove(const char *, char **, char *, cfga_flags_t);
217 218
218 219
219 220 #ifdef __cplusplus
220 221 }
221 222 #endif
222 223
223 224 #endif /* _CFGA_SATA_H */
|
↓ open down ↓ |
152 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX