xref: /netbsd-src/external/cddl/osnet/include/devid.h (revision 3391c5f1a70ce27e420f2a156bbc42cf0c6ff1dd)
1 /*	$NetBSD: devid.h,v 1.4 2017/01/10 19:20:35 christos Exp $	*/
2 
3 /*
4  * CDDL HEADER START
5  *
6  * The contents of this file are subject to the terms of the
7  * Common Development and Distribution License, Version 1.0 only
8  * (the "License").  You may not use this file except in compliance
9  * with the License.
10  *
11  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
12  * or http://www.opensolaris.org/os/licensing.
13  * See the License for the specific language governing permissions
14  * and limitations under the License.
15  *
16  * When distributing Covered Code, include this CDDL HEADER in each
17  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18  * If applicable, add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your own identifying
20  * information: Portions Copyright [yyyy] [name of copyright owner]
21  *
22  * CDDL HEADER END
23  */
24 /*
25  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms.
27  */
28 
29 #ifndef _OPENSOLARIS_DEVID_H_
30 #define _OPENSOLARIS_DEVID_H_
31 
32 #include <sys/param.h>
33 #include <sys/disk.h>
34 #include <stdlib.h>
35 
36 #define	DISK_IDENT_SIZE	128
37 
38 typedef struct ddi_devid {
39 	char devid[DISK_IDENT_SIZE];
40 } ddi_devid_t;
41 
42 typedef struct devid_nmlist {
43 	char devname[MAXPATHLEN];
44 	dev_t dev;
45 } devid_nmlist_t;
46 
47 int devid_str_decode(char *devidstr, ddi_devid_t *retdevid,
48     char **retminor_name);
49 int devid_deviceid_to_nmlist(const char *search_path, ddi_devid_t devid,
50     const char *minor_name, devid_nmlist_t **retlist);
51 void devid_str_free(char *str);
52 void devid_free(ddi_devid_t devid);
53 void devid_free_nmlist(devid_nmlist_t *list);
54 int devid_get(int fd, ddi_devid_t *retdevid);
55 int devid_get_minor_name(int fd, char **retminor_name);
56 char *devid_str_encode(ddi_devid_t devid, char *minor_name);
57 
58 #endif	/* !_OPENSOLARIS_DEVID_H_ */
59