4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
26 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
32 * MODULE: dat_strerror.c
34 * PURPOSE: Convert DAT_RETURN values to humman readable string
36 * $Id: dat_strerror.c,v 1.2 2003/08/06 14:40:29 jlentini Exp $
44 * Internal Function Declarations
51 OUT
const char **message
);
56 OUT
const char **message
);
61 * Internal Function Definitions
68 OUT
const char **message
)
70 switch (DAT_GET_TYPE(value
)) {
73 *message
= "DAT_SUCCESS";
78 *message
= "DAT_ABORT";
81 case DAT_CONN_QUAL_IN_USE
:
83 *message
= "DAT_CONN_QUAL_IN_USE";
86 case DAT_INSUFFICIENT_RESOURCES
:
88 *message
= "DAT_INSUFFICIENT_RESOURCES";
91 case DAT_INTERNAL_ERROR
:
93 *message
= "DAT_INTERNAL_ERROR";
96 case DAT_INVALID_HANDLE
:
98 *message
= "DAT_INVALID_HANDLE";
101 case DAT_INVALID_PARAMETER
:
103 *message
= "DAT_INVALID_PARAMETER";
104 return (DAT_SUCCESS
);
106 case DAT_INVALID_STATE
:
108 *message
= "DAT_INVALID_STATE";
109 return (DAT_SUCCESS
);
111 case DAT_LENGTH_ERROR
:
113 *message
= "DAT_LENGTH_ERROR";
114 return (DAT_SUCCESS
);
116 case DAT_MODEL_NOT_SUPPORTED
:
118 *message
= "DAT_MODEL_NOT_SUPPORTED";
119 return (DAT_SUCCESS
);
121 case DAT_NAME_NOT_FOUND
:
123 *message
= "DAT_NAME_NOT_FOUND";
124 return (DAT_SUCCESS
);
126 case DAT_PRIVILEGES_VIOLATION
:
128 *message
= "DAT_PRIVILEGES_VIOLATION";
129 return (DAT_SUCCESS
);
131 case DAT_PROTECTION_VIOLATION
:
133 *message
= "DAT_PROTECTION_VIOLATION";
134 return (DAT_SUCCESS
);
136 case DAT_QUEUE_EMPTY
:
138 *message
= "DAT_QUEUE_EMPTY";
139 return (DAT_SUCCESS
);
143 *message
= "DAT_QUEUE_FULL";
144 return (DAT_SUCCESS
);
146 case DAT_TIMEOUT_EXPIRED
:
148 *message
= "DAT_TIMEOUT_EXPIRED";
149 return (DAT_SUCCESS
);
151 case DAT_PROVIDER_ALREADY_REGISTERED
:
153 *message
= "DAT_PROVIDER_ALREADY_REGISTERED";
154 return (DAT_SUCCESS
);
156 case DAT_PROVIDER_IN_USE
:
158 *message
= "DAT_PROVIDER_IN_USE";
159 return (DAT_SUCCESS
);
161 case DAT_INVALID_ADDRESS
:
163 *message
= "DAT_INVALID_ADDRESS";
164 return (DAT_SUCCESS
);
166 case DAT_INTERRUPTED_CALL
:
168 *message
= "DAT_INTERRUPTED_CALL";
169 return (DAT_SUCCESS
);
171 case DAT_NOT_IMPLEMENTED
:
173 *message
= "DAT_NOT_IMPLEMENTED";
174 return (DAT_SUCCESS
);
178 return (DAT_INVALID_PARAMETER
);
187 OUT
const char **message
)
189 switch (DAT_GET_SUBTYPE(value
)) {
193 return (DAT_SUCCESS
);
195 case DAT_SUB_INTERRUPTED
:
197 *message
= "DAT_SUB_INTERRUPTED";
198 return (DAT_SUCCESS
);
200 case DAT_RESOURCE_MEMORY
:
202 *message
= "DAT_RESOURCE_MEMORY";
203 return (DAT_SUCCESS
);
205 case DAT_RESOURCE_DEVICE
:
207 *message
= "DAT_RESOURCE_DEVICE";
208 return (DAT_SUCCESS
);
210 case DAT_RESOURCE_TEP
:
212 *message
= "DAT_RESOURCE_TEP";
213 return (DAT_SUCCESS
);
215 case DAT_RESOURCE_TEVD
:
217 *message
= "DAT_RESOURCE_TEVD";
218 return (DAT_SUCCESS
);
220 case DAT_RESOURCE_PROTECTION_DOMAIN
:
222 *message
= "DAT_RESOURCE_PROTECTION_DOMAIN";
223 return (DAT_SUCCESS
);
225 case DAT_RESOURCE_MEMORY_REGION
:
227 *message
= "DAT_RESOURCE_MEMORY_REGION";
228 return (DAT_SUCCESS
);
230 case DAT_RESOURCE_ERROR_HANDLER
:
232 *message
= "DAT_RESOURCE_ERROR_HANDLER";
233 return (DAT_SUCCESS
);
235 case DAT_RESOURCE_CREDITS
:
237 *message
= "DAT_RESOURCE_CREDITS";
238 return (DAT_SUCCESS
);
240 case DAT_INVALID_HANDLE_IA
:
242 *message
= "DAT_INVALID_HANDLE_IA";
243 return (DAT_SUCCESS
);
245 case DAT_INVALID_HANDLE_EP
:
247 *message
= "DAT_INVALID_HANDLE_EP";
248 return (DAT_SUCCESS
);
250 case DAT_INVALID_HANDLE_LMR
:
252 *message
= "DAT_INVALID_HANDLE_LMR";
253 return (DAT_SUCCESS
);
255 case DAT_INVALID_HANDLE_RMR
:
257 *message
= "DAT_INVALID_HANDLE_RMR";
258 return (DAT_SUCCESS
);
260 case DAT_INVALID_HANDLE_PZ
:
262 *message
= "DAT_INVALID_HANDLE_PZ";
263 return (DAT_SUCCESS
);
265 case DAT_INVALID_HANDLE_PSP
:
267 *message
= "DAT_INVALID_HANDLE_PSP";
268 return (DAT_SUCCESS
);
270 case DAT_INVALID_HANDLE_RSP
:
272 *message
= "DAT_INVALID_HANDLE_RSP";
273 return (DAT_SUCCESS
);
275 case DAT_INVALID_HANDLE_CR
:
277 *message
= "DAT_INVALID_HANDLE_CR";
278 return (DAT_SUCCESS
);
280 case DAT_INVALID_HANDLE_CNO
:
282 *message
= "DAT_INVALID_HANDLE_CNO";
283 return (DAT_SUCCESS
);
285 case DAT_INVALID_HANDLE_EVD_CR
:
287 *message
= "DAT_INVALID_HANDLE_EVD_CR";
288 return (DAT_SUCCESS
);
290 case DAT_INVALID_HANDLE_EVD_REQUEST
:
292 *message
= "DAT_INVALID_HANDLE_EVD_REQUEST";
293 return (DAT_SUCCESS
);
295 case DAT_INVALID_HANDLE_EVD_RECV
:
297 *message
= "DAT_INVALID_HANDLE_EVD_RECV";
298 return (DAT_SUCCESS
);
300 case DAT_INVALID_HANDLE_EVD_CONN
:
302 *message
= "DAT_INVALID_HANDLE_EVD_CONN";
303 return (DAT_SUCCESS
);
305 case DAT_INVALID_HANDLE_EVD_ASYNC
:
307 *message
= "DAT_INVALID_HANDLE_EVD_ASYNC";
308 return (DAT_SUCCESS
);
310 case DAT_INVALID_ARG1
:
312 *message
= "DAT_INVALID_ARG1";
313 return (DAT_SUCCESS
);
315 case DAT_INVALID_ARG2
:
317 *message
= "DAT_INVALID_ARG2";
318 return (DAT_SUCCESS
);
320 case DAT_INVALID_ARG3
:
322 *message
= "DAT_INVALID_ARG3";
323 return (DAT_SUCCESS
);
325 case DAT_INVALID_ARG4
:
327 *message
= "DAT_INVALID_ARG4";
328 return (DAT_SUCCESS
);
330 case DAT_INVALID_ARG5
:
332 *message
= "DAT_INVALID_ARG5";
333 return (DAT_SUCCESS
);
335 case DAT_INVALID_ARG6
:
337 *message
= "DAT_INVALID_ARG6";
338 return (DAT_SUCCESS
);
340 case DAT_INVALID_ARG7
:
342 *message
= "DAT_INVALID_ARG7";
343 return (DAT_SUCCESS
);
345 case DAT_INVALID_ARG8
:
347 *message
= "DAT_INVALID_ARG8";
348 return (DAT_SUCCESS
);
350 case DAT_INVALID_ARG9
:
352 *message
= "DAT_INVALID_ARG9";
353 return (DAT_SUCCESS
);
355 case DAT_INVALID_ARG10
:
357 *message
= "DAT_INVALID_ARG10";
358 return (DAT_SUCCESS
);
360 case DAT_INVALID_STATE_EP_UNCONNECTED
:
362 *message
= "DAT_INVALID_STATE_EP_UNCONNECTED";
363 return (DAT_SUCCESS
);
365 case DAT_INVALID_STATE_EP_ACTCONNPENDING
:
367 *message
= "DAT_INVALID_STATE_EP_ACTCONNPENDING";
368 return (DAT_SUCCESS
);
370 case DAT_INVALID_STATE_EP_PASSCONNPENDING
:
372 *message
= "DAT_INVALID_STATE_EP_PASSCONNPENDING";
373 return (DAT_SUCCESS
);
375 case DAT_INVALID_STATE_EP_TENTCONNPENDING
:
377 *message
= "DAT_INVALID_STATE_EP_TENTCONNPENDING";
378 return (DAT_SUCCESS
);
380 case DAT_INVALID_STATE_EP_CONNECTED
:
382 *message
= "DAT_INVALID_STATE_EP_CONNECTED";
383 return (DAT_SUCCESS
);
385 case DAT_INVALID_STATE_EP_DISCONNECTED
:
387 *message
= "DAT_INVALID_STATE_EP_DISCONNECTED";
388 return (DAT_SUCCESS
);
390 case DAT_INVALID_STATE_EP_RESERVED
:
392 *message
= "DAT_INVALID_STATE_EP_RESERVED";
393 return (DAT_SUCCESS
);
395 case DAT_INVALID_STATE_EP_COMPLPENDING
:
397 *message
= "DAT_INVALID_STATE_EP_COMPLPENDING";
398 return (DAT_SUCCESS
);
400 case DAT_INVALID_STATE_EP_DISCPENDING
:
402 *message
= "DAT_INVALID_STATE_EP_DISCPENDING";
403 return (DAT_SUCCESS
);
405 case DAT_INVALID_STATE_EP_PROVIDERCONTROL
:
407 *message
= "DAT_INVALID_STATE_EP_PROVIDERCONTROL";
408 return (DAT_SUCCESS
);
410 case DAT_INVALID_STATE_EP_NOTREADY
:
412 *message
= "DAT_INVALID_STATE_EP_NOTREADY";
413 return (DAT_SUCCESS
);
415 case DAT_INVALID_STATE_CNO_IN_USE
:
417 *message
= "DAT_INVALID_STATE_CNO_IN_USE";
418 return (DAT_SUCCESS
);
420 case DAT_INVALID_STATE_CNO_DEAD
:
422 *message
= "DAT_INVALID_STATE_CNO_DEAD";
423 return (DAT_SUCCESS
);
425 case DAT_INVALID_STATE_EVD_OPEN
:
427 *message
= "DAT_INVALID_STATE_EVD_OPEN";
428 return (DAT_SUCCESS
);
430 case DAT_INVALID_STATE_EVD_ENABLED
:
432 *message
= "DAT_INVALID_STATE_EVD_ENABLED";
433 return (DAT_SUCCESS
);
435 case DAT_INVALID_STATE_EVD_DISABLED
:
437 *message
= "DAT_INVALID_STATE_EVD_DISABLED";
438 return (DAT_SUCCESS
);
440 case DAT_INVALID_STATE_EVD_WAITABLE
:
442 *message
= "DAT_INVALID_STATE_EVD_WAITABLE";
443 return (DAT_SUCCESS
);
445 case DAT_INVALID_STATE_EVD_UNWAITABLE
:
447 *message
= "DAT_INVALID_STATE_EVD_UNWAITABLE";
448 return (DAT_SUCCESS
);
450 case DAT_INVALID_STATE_EVD_IN_USE
:
452 *message
= "DAT_INVALID_STATE_EVD_IN_USE";
453 return (DAT_SUCCESS
);
455 case DAT_INVALID_STATE_EVD_CONFIG_NOTIFY
:
457 *message
= "DAT_INVALID_STATE_EVD_CONFIG_NOTIFY";
458 return (DAT_SUCCESS
);
460 case DAT_INVALID_STATE_EVD_CONFIG_SOLICITED
:
462 *message
= "DAT_INVALID_STATE_EVD_CONFIG_SOLICITED";
463 return (DAT_SUCCESS
);
465 case DAT_INVALID_STATE_EVD_CONFIG_THRESHOLD
:
467 *message
= "DAT_INVALID_STATE_EVD_CONFIG_THRESHOLD";
468 return (DAT_SUCCESS
);
470 case DAT_INVALID_STATE_EVD_WAITER
:
472 *message
= "DAT_INVALID_STATE_EVD_WAITER";
473 return (DAT_SUCCESS
);
475 case DAT_INVALID_STATE_EVD_ASYNC
:
477 *message
= "DAT_INVALID_STATE_EVD_ASYNC";
478 return (DAT_SUCCESS
);
480 case DAT_INVALID_STATE_IA_IN_USE
:
482 *message
= "DAT_INVALID_STATE_IA_IN_USE";
483 return (DAT_SUCCESS
);
485 case DAT_INVALID_STATE_LMR_IN_USE
:
487 *message
= "DAT_INVALID_STATE_LMR_IN_USE";
488 return (DAT_SUCCESS
);
490 case DAT_INVALID_STATE_LMR_FREE
:
492 *message
= "DAT_INVALID_STATE_LMR_FREE";
493 return (DAT_SUCCESS
);
495 case DAT_INVALID_STATE_PZ_IN_USE
:
497 *message
= "DAT_INVALID_STATE_PZ_IN_USE";
498 return (DAT_SUCCESS
);
500 case DAT_INVALID_STATE_PZ_FREE
:
502 *message
= "DAT_INVALID_STATE_PZ_FREE";
503 return (DAT_SUCCESS
);
505 case DAT_PRIVILEGES_READ
:
507 *message
= "DAT_PRIVILEGES_READ";
508 return (DAT_SUCCESS
);
510 case DAT_PRIVILEGES_WRITE
:
512 *message
= "DAT_PRIVILEGES_WRITE";
513 return (DAT_SUCCESS
);
515 case DAT_PRIVILEGES_RDMA_READ
:
517 *message
= "DAT_PRIVILEGES_RDMA_READ";
518 return (DAT_SUCCESS
);
520 case DAT_PRIVILEGES_RDMA_WRITE
:
522 *message
= "DAT_PRIVILEGES_RDMA_WRITE";
523 return (DAT_SUCCESS
);
525 case DAT_PROTECTION_READ
:
527 *message
= "DAT_PROTECTION_READ";
528 return (DAT_SUCCESS
);
530 case DAT_PROTECTION_WRITE
:
532 *message
= "DAT_PROTECTION_WRITE";
533 return (DAT_SUCCESS
);
535 case DAT_PROTECTION_RDMA_READ
:
537 *message
= "DAT_PROTECTION_RDMA_READ";
538 return (DAT_SUCCESS
);
540 case DAT_PROTECTION_RDMA_WRITE
:
542 *message
= "DAT_PROTECTION_RDMA_WRITE";
543 return (DAT_SUCCESS
);
545 case DAT_INVALID_ADDRESS_UNSUPPORTED
:
547 *message
= "DAT_INVALID_ADDRESS_UNSUPPORTED";
548 return (DAT_SUCCESS
);
550 case DAT_INVALID_ADDRESS_UNREACHABLE
:
552 *message
= "DAT_INVALID_ADDRESS_UNREACHABLE";
553 return (DAT_SUCCESS
);
555 case DAT_INVALID_ADDRESS_MALFORMED
:
557 *message
= "DAT_INVALID_ADDRESS_MALFORMED";
558 return (DAT_SUCCESS
);
560 case DAT_INVALID_RO_COOKIE
:
561 *message
= "DAT_INVALID_RO_COOKIE";
562 return (DAT_SUCCESS
);
565 return (DAT_INVALID_PARAMETER
);
573 * External Function Definitions
580 OUT
const char **major_message
,
581 OUT
const char **minor_message
)
584 * The DAT specification contains a note to implementers
585 * suggesting that the consumer's DAT_RETURN value be used
586 * as an index into a table of text strings. However,
587 * the DAT_RETURN values are not consecutive. Therefore this
588 * implementation does not follow the suggested implementation.
591 if (DAT_SUCCESS
!= dat_strerror_major(value
, major_message
)) {
592 return (DAT_INVALID_PARAMETER
);
593 } else if (DAT_SUCCESS
!= dat_strerror_minor(value
, minor_message
)) {
594 return (DAT_INVALID_PARAMETER
);
596 return (DAT_SUCCESS
);