xref: /onnv-gate/usr/src/lib/fm/libdiskstatus/common/ds_impl.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	_DS_IMPL_H
27*4198Seschrock #define	_DS_IMPL_H
28*4198Seschrock 
29*4198Seschrock #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*4198Seschrock 
31*4198Seschrock #include <dlfcn.h>
32*4198Seschrock #include <libnvpair.h>
33*4198Seschrock #include <sys/types.h>
34*4198Seschrock 
35*4198Seschrock #ifdef	__cplusplus
36*4198Seschrock extern "C" {
37*4198Seschrock #endif
38*4198Seschrock 
39*4198Seschrock struct disk_status;
40*4198Seschrock 
41*4198Seschrock typedef struct ds_transport {
42*4198Seschrock 	void		*(*dt_open)(struct disk_status *);
43*4198Seschrock 	void		(*dt_close)(void *);
44*4198Seschrock 	int		(*dt_scan)(void *);
45*4198Seschrock } ds_transport_t;
46*4198Seschrock 
47*4198Seschrock struct disk_status {
48*4198Seschrock 	char			*ds_path;	/* path to device */
49*4198Seschrock 	int			ds_fd;		/* device file descriptor */
50*4198Seschrock 	ds_transport_t		*ds_transport;	/* associated transport */
51*4198Seschrock 	void			*ds_data;	/* transport-specific data */
52*4198Seschrock 	int			ds_faults;	/* mask of current faults */
53*4198Seschrock 	nvlist_t		*ds_overtemp;	/* overtemp */
54*4198Seschrock 	nvlist_t		*ds_predfail;	/* predict fail */
55*4198Seschrock 	nvlist_t		*ds_testfail;	/* self test fail */
56*4198Seschrock 	int			ds_error;	/* last error */
57*4198Seschrock 	nvlist_t		*ds_state;	/* protocol state */
58*4198Seschrock };
59*4198Seschrock 
60*4198Seschrock #define	DS_FAULT_OVERTEMP	0x1
61*4198Seschrock #define	DS_FAULT_PREDFAIL	0x2
62*4198Seschrock #define	DS_FAULT_TESTFAIL	0x4
63*4198Seschrock 
64*4198Seschrock extern void dprintf(const char *, ...);
65*4198Seschrock extern void ddump(const char *, const void *, size_t);
66*4198Seschrock extern boolean_t ds_debug;
67*4198Seschrock 
68*4198Seschrock extern int ds_set_errno(struct disk_status *, int);
69*4198Seschrock 
70*4198Seschrock #ifdef	__cplusplus
71*4198Seschrock }
72*4198Seschrock #endif
73*4198Seschrock 
74*4198Seschrock #endif	/* _DS_IMPL_H */
75