5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
29 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
32 #pragma ident\t\"@(#)mkerrno.sh\t1.2\t08/07/31\tSMI\"
35 #include <scsi/libsmp.h>
38 \tchar *name;\t\t/* error name */
39 \tchar *msg;\t\t/* error message */
42 pattern
='^ \(ESMP_[A-Z0-9_]*\),*'
49 ( sed -n "s/$pattern/$replace/p" |
sed -n "s/$open/$openrepl/p" |
50 sed -n "s/$close/$closerepl/p" ) ||
exit 1
55 static int _smp_nerrno = sizeof (_smp_errstr) /\n\
56 sizeof (_smp_errstr[0]);\n\
59 smp_strerror(smp_errno_t err)
61 return (err < 0 || err >= _smp_nerrno ? \"unknown error\" :
62 _smp_errstr[err].msg);
66 smp_errname(smp_errno_t err)
68 return (err < 0 || err >= _smp_nerrno ? NULL :
69 _smp_errstr[err].name);
73 smp_errcode(const char *name)
77 for (err = 0; err < _smp_nerrno; err++) {
78 if (strcmp(name, _smp_errstr[err].name) == 0)
82 return (ESMP_UNKNOWN);