xref: /titanic_50/usr/src/head/devid.h (revision 1ae0874509b6811fdde1dfd46f0d93fd09867a3f)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 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 
67 #ifdef	__cplusplus
68 }
69 #endif
70 
71 #endif	/* _DEVID_H */
72