xref: /titanic_41/usr/src/head/devid.h (revision 299d957d28501350bcae7fa4333ff183c062c427)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_DEVID_H
28 #define	_DEVID_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifndef	_KERNEL
33 #include <sys/types.h>
34 #endif	/* _KERNEL */
35 
36 #include <sys/sunddi.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 typedef struct devid_nmlist {
43 	char 	*devname;
44 	dev_t	dev;
45 } devid_nmlist_t;
46 
47 extern int	devid_get(int fd, ddi_devid_t *retdevid);
48 extern void	devid_free(ddi_devid_t devid);
49 extern int	devid_get_minor_name(int fd, char **retminor_name);
50 extern size_t	devid_sizeof(ddi_devid_t devid);
51 extern int	devid_compare(ddi_devid_t devid1, ddi_devid_t devid2);
52 extern int	devid_deviceid_to_nmlist(char *search_path, ddi_devid_t devid,
53 		    char *minor_name, devid_nmlist_t **retlist);
54 extern void	devid_free_nmlist(devid_nmlist_t *list);
55 extern int	devid_valid(ddi_devid_t devid);
56 extern char	*devid_str_encode(ddi_devid_t devid, char *minor_name);
57 extern int	devid_str_decode(char *devidstr,
58 		    ddi_devid_t *retdevid, char **retminor_name);
59 extern void	devid_str_free(char *devidstr);
60 extern int	devid_scsi_encode(int version, char *driver_name,
61 		    uchar_t *inq, size_t inq_len, uchar_t *inq80,
62 		    size_t inq80_len, uchar_t *inq83, size_t inq83_len,
63 		    ddi_devid_t *ret_devid);
64 extern char	*devid_to_guid(ddi_devid_t devid);
65 extern void	devid_free_guid(char *guid);
66 extern int	devid_str_to_wwn(const char *string, uint64_t *wwn);
67 
68 #ifdef	__cplusplus
69 }
70 #endif
71 
72 #endif	/* _DEVID_H */
73