4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
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]
23 * Copyright 1994, 1999, 2000-2002 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/sysmacros.h>
35 #include <sys/lvm/mdvar.h>
40 const md_error_t mdnullerror
= {{MDEC_VOID
}, NULL
, NULL
, NULL
};
50 bzero((caddr_t
)ep
, sizeof (*ep
));
54 * steal (copy) an error code safely
64 (void) bzero((caddr_t
)from
, sizeof (*from
));
74 md_void_errno_t errnum
77 md_void_error_t
*ip
= &ep
->info
.md_error_info_t_u
.void_error
;
80 ep
->info
.errclass
= MDEC_VOID
;
95 md_sys_error_t
*ip
= &ep
->info
.md_error_info_t_u
.sys_error
;
98 ep
->info
.errclass
= MDEC_SYS
;
110 md_dev_errno_t errnum
,
114 md_dev_error_t
*ip
= &ep
->info
.md_error_info_t_u
.dev_error
;
117 ep
->info
.errclass
= MDEC_DEV
;
119 ip
->dev
= (md_dev64_t
)dev
;
130 md_md_errno_t errnum
,
134 md_md_error_t
*ip
= &ep
->info
.md_error_info_t_u
.md_error
;
137 ep
->info
.errclass
= MDEC_MD
;
150 md_comp_errno_t errnum
,
155 md_comp_error_t
*ip
= &ep
->info
.md_error_info_t_u
.comp_error
;
158 ep
->info
.errclass
= MDEC_COMP
;
160 ip
->comp
.mnum
= mnum
;
167 * hotspare pool error
172 md_hsp_errno_t errnum
,
176 md_hsp_error_t
*ip
= &ep
->info
.md_error_info_t_u
.hsp_error
;
179 ep
->info
.errclass
= MDEC_HSP
;
192 md_hs_errno_t errnum
,
197 md_hs_error_t
*ip
= &ep
->info
.md_error_info_t_u
.hs_error
;
200 ep
->info
.errclass
= MDEC_HS
;
214 md_mddb_errno_t errnum
,
219 md_mddb_error_t
*ip
= &ep
->info
.md_error_info_t_u
.mddb_error
;
222 ep
->info
.errclass
= MDEC_MDDB
;
238 md_mddb_errno_t errnum
;
242 errnum
= MDE_DB_INVALID
;
245 errnum
= MDE_DB_EXISTS
;
248 errnum
= MDE_DB_MASTER
;
250 case MDDB_E_TOOSMALL
:
251 errnum
= MDE_DB_TOOSMALL
;
253 case MDDB_E_NORECORD
:
254 errnum
= MDE_DB_NORECORD
;
257 errnum
= MDE_DB_NOSPACE
;
260 errnum
= MDE_DB_NOTNOW
;
263 errnum
= MDE_DB_NODB
;
265 case MDDB_E_NOTOWNER
:
266 errnum
= MDE_DB_NOTOWNER
;
269 errnum
= MDE_DB_STALE
;
272 errnum
= MDE_DB_TOOFEW
;
275 errnum
= MDE_DB_TAGDATA
;
278 errnum
= MDE_DB_ACCOK
;
280 case MDDB_E_NTAGDATA
:
281 errnum
= MDE_DB_NTAGDATA
;
283 case MDDB_E_ACCNOTOK
:
284 errnum
= MDE_DB_ACCNOTOK
;
286 case MDDB_E_NOLOCBLK
:
287 errnum
= MDE_DB_NOLOCBLK
;
289 case MDDB_E_NOLOCNMS
:
290 errnum
= MDE_DB_NOLOCNMS
;
292 case MDDB_E_NODIRBLK
:
293 errnum
= MDE_DB_NODIRBLK
;
295 case MDDB_E_NOTAGREC
:
296 errnum
= MDE_DB_NOTAGREC
;
299 errnum
= MDE_DB_NOTAG
;
303 errnum
= (md_mddb_errno_t
)status
;
306 return (mdmddberror(ep
, errnum
, mnum
, setno
));