xref: /titanic_41/usr/src/lib/libdevid/libdevid.h (revision 07d06da50d310a325b457d6330165aebab1e0064)
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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_LIBDEVID_H
27 #define	_LIBDEVID_H
28 
29 #include <errno.h>
30 #include <sys/param.h>
31 #include <sys/sunddi.h>
32 #include <sys/ddi_impldefs.h>
33 #include <sys/dkio.h>
34 #include <devid.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * libdevid SUN private interfaces or structures.
42  */
43 extern int	devid_str_compare(char *devid1_str, char *devid2_str);
44 
45 extern int	devid_scsi_encode(int version, char *driver_name, uchar_t *inq,
46 		    size_t inq_len, uchar_t *inq80, size_t inq80_len,
47 		    uchar_t *inq83, size_t inq83_len, ddi_devid_t *devid);
48 
49 extern int	devid_smp_encode(int version, char *driver_name,
50 		    char *wwnstr, uchar_t *srmir_buf, size_t srmir_len,
51 		    ddi_devid_t *devid);
52 
53 extern char	*devid_to_guid(ddi_devid_t devid);
54 extern void	devid_free_guid(char *guid);
55 
56 extern int	scsi_wwnstr_to_wwn(const char *wwnstr, uint64_t *wwnp);
57 extern char	*scsi_wwn_to_wwnstr(uint64_t wwn,
58 		    int unit_address_form, char *wwnstr);
59 extern void	scsi_wwnstr_hexcase(char *wwnstr, int lower_case);
60 extern const char	*scsi_wwnstr_skip_ua_prefix(const char *wwnstr);
61 extern void	scsi_free_wwnstr(char *wwnstr);
62 
63 #ifdef	SCSI_ADDR_PROP_LUN64
64 extern scsi_lun64_t	scsi_lun_to_lun64(scsi_lun_t lun);
65 extern scsi_lun_t	scsi_lun64_to_lun(scsi_lun64_t lun64);
66 #endif	/* SCSI_ADDR_PROP_LUN64 */
67 
68 extern int	scsi_ascii_inquiry_len(char *field, size_t length);
69 
70 #ifdef	__cplusplus
71 }
72 #endif
73 
74 #endif	/* _LIBDEVID_H */
75