xref: /onnv-gate/usr/src/lib/fm/libdiskstatus/common/libdiskstatus.h (revision 4198:6bdfb19526db)
1*4198Seschrock /*
2*4198Seschrock  * CDDL HEADER START
3*4198Seschrock  *
4*4198Seschrock  * The contents of this file are subject to the terms of the
5*4198Seschrock  * Common Development and Distribution License (the "License").
6*4198Seschrock  * You may not use this file except in compliance with the License.
7*4198Seschrock  *
8*4198Seschrock  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*4198Seschrock  * or http://www.opensolaris.org/os/licensing.
10*4198Seschrock  * See the License for the specific language governing permissions
11*4198Seschrock  * and limitations under the License.
12*4198Seschrock  *
13*4198Seschrock  * When distributing Covered Code, include this CDDL HEADER in each
14*4198Seschrock  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*4198Seschrock  * If applicable, add the following below this CDDL HEADER, with the
16*4198Seschrock  * fields enclosed by brackets "[]" replaced with your own identifying
17*4198Seschrock  * information: Portions Copyright [yyyy] [name of copyright owner]
18*4198Seschrock  *
19*4198Seschrock  * CDDL HEADER END
20*4198Seschrock  */
21*4198Seschrock /*
22*4198Seschrock  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*4198Seschrock  * Use is subject to license terms.
24*4198Seschrock  */
25*4198Seschrock 
26*4198Seschrock #ifndef	_LIBDISKSTATUS_H
27*4198Seschrock #define	_LIBDISKSTATUS_H
28*4198Seschrock 
29*4198Seschrock #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*4198Seschrock 
31*4198Seschrock #include <libnvpair.h>
32*4198Seschrock #include <sys/types.h>
33*4198Seschrock 
34*4198Seschrock #ifdef	__cplusplus
35*4198Seschrock extern "C" {
36*4198Seschrock #endif
37*4198Seschrock 
38*4198Seschrock typedef struct disk_status disk_status_t;
39*4198Seschrock 
40*4198Seschrock /*
41*4198Seschrock  * Error definitions
42*4198Seschrock  */
43*4198Seschrock #define	EDS_BASE	2000
44*4198Seschrock 
45*4198Seschrock enum {
46*4198Seschrock 	EDS_NOMEM = EDS_BASE,		/* memory allocation failure */
47*4198Seschrock 	EDS_CANT_OPEN,			/* failed to open device */
48*4198Seschrock 	EDS_NO_TRANSPORT,		/* no supported transport */
49*4198Seschrock 	EDS_NOT_SUPPORTED,		/* status information not supported */
50*4198Seschrock 	EDS_NOT_SIMULATOR,		/* not a valid simulator file */
51*4198Seschrock 	EDS_IO				/* I/O error */
52*4198Seschrock };
53*4198Seschrock 
54*4198Seschrock /*
55*4198Seschrock  * Basic library functions
56*4198Seschrock  */
57*4198Seschrock extern disk_status_t *disk_status_open(const char *, int *);
58*4198Seschrock extern void disk_status_close(disk_status_t *);
59*4198Seschrock extern const char *disk_status_errmsg(int);
60*4198Seschrock extern void disk_status_set_debug(boolean_t);
61*4198Seschrock extern int disk_status_errno(disk_status_t *);
62*4198Seschrock 
63*4198Seschrock /*
64*4198Seschrock  * Miscellaneous functions.
65*4198Seschrock  */
66*4198Seschrock extern const char *disk_status_path(disk_status_t *);
67*4198Seschrock 
68*4198Seschrock /*
69*4198Seschrock  * Main entry point.
70*4198Seschrock  */
71*4198Seschrock extern nvlist_t *disk_status_get(disk_status_t *);
72*4198Seschrock 
73*4198Seschrock /*
74*4198Seschrock  * Utility function to simulate predictive failure (device-specific).
75*4198Seschrock  */
76*4198Seschrock extern int disk_status_test_predfail(disk_status_t *);
77*4198Seschrock 
78*4198Seschrock #ifdef	__cplusplus
79*4198Seschrock }
80*4198Seschrock #endif
81*4198Seschrock 
82*4198Seschrock #endif	/* _LIBDISKSTATUS_H */
83