xref: /titanic_50/usr/src/lib/fm/libdiskstatus/common/ds_impl.h (revision 24db46411fd54f70c35b94bb952eb7ba040e43b4)
1*24db4641Seschrock /*
2*24db4641Seschrock  * CDDL HEADER START
3*24db4641Seschrock  *
4*24db4641Seschrock  * The contents of this file are subject to the terms of the
5*24db4641Seschrock  * Common Development and Distribution License (the "License").
6*24db4641Seschrock  * You may not use this file except in compliance with the License.
7*24db4641Seschrock  *
8*24db4641Seschrock  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*24db4641Seschrock  * or http://www.opensolaris.org/os/licensing.
10*24db4641Seschrock  * See the License for the specific language governing permissions
11*24db4641Seschrock  * and limitations under the License.
12*24db4641Seschrock  *
13*24db4641Seschrock  * When distributing Covered Code, include this CDDL HEADER in each
14*24db4641Seschrock  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*24db4641Seschrock  * If applicable, add the following below this CDDL HEADER, with the
16*24db4641Seschrock  * fields enclosed by brackets "[]" replaced with your own identifying
17*24db4641Seschrock  * information: Portions Copyright [yyyy] [name of copyright owner]
18*24db4641Seschrock  *
19*24db4641Seschrock  * CDDL HEADER END
20*24db4641Seschrock  */
21*24db4641Seschrock /*
22*24db4641Seschrock  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*24db4641Seschrock  * Use is subject to license terms.
24*24db4641Seschrock  */
25*24db4641Seschrock 
26*24db4641Seschrock #ifndef	_DS_IMPL_H
27*24db4641Seschrock #define	_DS_IMPL_H
28*24db4641Seschrock 
29*24db4641Seschrock #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*24db4641Seschrock 
31*24db4641Seschrock #include <dlfcn.h>
32*24db4641Seschrock #include <libnvpair.h>
33*24db4641Seschrock #include <sys/types.h>
34*24db4641Seschrock 
35*24db4641Seschrock #ifdef	__cplusplus
36*24db4641Seschrock extern "C" {
37*24db4641Seschrock #endif
38*24db4641Seschrock 
39*24db4641Seschrock struct disk_status;
40*24db4641Seschrock 
41*24db4641Seschrock typedef struct ds_transport {
42*24db4641Seschrock 	void		*(*dt_open)(struct disk_status *);
43*24db4641Seschrock 	void		(*dt_close)(void *);
44*24db4641Seschrock 	int		(*dt_scan)(void *);
45*24db4641Seschrock } ds_transport_t;
46*24db4641Seschrock 
47*24db4641Seschrock struct disk_status {
48*24db4641Seschrock 	char			*ds_path;	/* path to device */
49*24db4641Seschrock 	int			ds_fd;		/* device file descriptor */
50*24db4641Seschrock 	ds_transport_t		*ds_transport;	/* associated transport */
51*24db4641Seschrock 	void			*ds_data;	/* transport-specific data */
52*24db4641Seschrock 	int			ds_faults;	/* mask of current faults */
53*24db4641Seschrock 	nvlist_t		*ds_overtemp;	/* overtemp */
54*24db4641Seschrock 	nvlist_t		*ds_predfail;	/* predict fail */
55*24db4641Seschrock 	nvlist_t		*ds_testfail;	/* self test fail */
56*24db4641Seschrock 	int			ds_error;	/* last error */
57*24db4641Seschrock 	nvlist_t		*ds_state;	/* protocol state */
58*24db4641Seschrock };
59*24db4641Seschrock 
60*24db4641Seschrock #define	DS_FAULT_OVERTEMP	0x1
61*24db4641Seschrock #define	DS_FAULT_PREDFAIL	0x2
62*24db4641Seschrock #define	DS_FAULT_TESTFAIL	0x4
63*24db4641Seschrock 
64*24db4641Seschrock extern void dprintf(const char *, ...);
65*24db4641Seschrock extern void ddump(const char *, const void *, size_t);
66*24db4641Seschrock extern boolean_t ds_debug;
67*24db4641Seschrock 
68*24db4641Seschrock extern int ds_set_errno(struct disk_status *, int);
69*24db4641Seschrock 
70*24db4641Seschrock #ifdef	__cplusplus
71*24db4641Seschrock }
72*24db4641Seschrock #endif
73*24db4641Seschrock 
74*24db4641Seschrock #endif	/* _DS_IMPL_H */
75