xref: /titanic_44/usr/src/head/devid.h (revision 8de5c4f463386063e184a851437d58080c6c626c)
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 2009 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 #ifndef	_KERNEL
31 #include <sys/types.h>
32 #endif	/* _KERNEL */
33 
34 #include <sys/sunddi.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 typedef struct devid_nmlist {
41 	char 	*devname;
42 	dev_t	dev;
43 } devid_nmlist_t;
44 
45 extern int	devid_get(int fd, ddi_devid_t *retdevid);
46 extern void	devid_free(ddi_devid_t devid);
47 extern int	devid_get_minor_name(int fd, char **retminor_name);
48 extern size_t	devid_sizeof(ddi_devid_t devid);
49 extern int	devid_compare(ddi_devid_t devid1, ddi_devid_t devid2);
50 extern int	devid_deviceid_to_nmlist(char *search_path, ddi_devid_t devid,
51 		    char *minor_name, devid_nmlist_t **retlist);
52 extern void	devid_free_nmlist(devid_nmlist_t *list);
53 extern int	devid_valid(ddi_devid_t devid);
54 extern char	*devid_str_encode(ddi_devid_t devid, char *minor_name);
55 extern int	devid_str_decode(char *devidstr,
56 		    ddi_devid_t *retdevid, char **retminor_name);
57 extern void	devid_str_free(char *devidstr);
58 
59 #ifdef	__cplusplus
60 }
61 #endif
62 
63 #endif	/* _DEVID_H */
64