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