xref: /illumos-gate/usr/src/lib/libdevid/libdevid.h (revision 96c4a178)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5ed141cfcSsrivijitha dugganapalli  * Common Development and Distribution License (the "License").
6ed141cfcSsrivijitha dugganapalli  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22ed141cfcSsrivijitha dugganapalli  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_LIBDEVID_H
277c478bd9Sstevel@tonic-gate #define	_LIBDEVID_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <errno.h>
307c478bd9Sstevel@tonic-gate #include <sys/param.h>
317c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
327c478bd9Sstevel@tonic-gate #include <sys/ddi_impldefs.h>
337c478bd9Sstevel@tonic-gate #include <sys/dkio.h>
347c478bd9Sstevel@tonic-gate #include <devid.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * libdevid SUN private interfaces or structures.
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate extern int	devid_str_compare(char *devid1_str, char *devid2_str);
447c478bd9Sstevel@tonic-gate 
45ed141cfcSsrivijitha dugganapalli extern int	devid_scsi_encode(int version, char *driver_name, uchar_t *inq,
46ed141cfcSsrivijitha dugganapalli 		    size_t inq_len, uchar_t *inq80, size_t inq80_len,
47ed141cfcSsrivijitha dugganapalli 		    uchar_t *inq83, size_t inq83_len, ddi_devid_t *devid);
48ed141cfcSsrivijitha dugganapalli 
49*96c4a178SChris Horne extern int	devid_smp_encode(int version, char *driver_name,
50*96c4a178SChris Horne 		    char *wwnstr, uchar_t *srmir_buf, size_t srmir_len,
51*96c4a178SChris Horne 		    ddi_devid_t *devid);
52*96c4a178SChris Horne 
53ed141cfcSsrivijitha dugganapalli extern char	*devid_to_guid(ddi_devid_t devid);
54ed141cfcSsrivijitha dugganapalli extern void	devid_free_guid(char *guid);
55ed141cfcSsrivijitha dugganapalli 
56ed141cfcSsrivijitha dugganapalli extern int	scsi_wwnstr_to_wwn(const char *wwnstr, uint64_t *wwnp);
57ed141cfcSsrivijitha dugganapalli extern char	*scsi_wwn_to_wwnstr(uint64_t wwn,
58ed141cfcSsrivijitha dugganapalli 		    int unit_address_form, char *wwnstr);
59ed141cfcSsrivijitha dugganapalli extern void	scsi_wwnstr_hexcase(char *wwnstr, int lower_case);
604c06356bSdh extern const char	*scsi_wwnstr_skip_ua_prefix(const char *wwnstr);
61ed141cfcSsrivijitha dugganapalli extern void	scsi_free_wwnstr(char *wwnstr);
62ed141cfcSsrivijitha dugganapalli 
63ed141cfcSsrivijitha dugganapalli #ifdef	SCSI_ADDR_PROP_LUN64
64ed141cfcSsrivijitha dugganapalli extern scsi_lun64_t	scsi_lun_to_lun64(scsi_lun_t lun);
65ed141cfcSsrivijitha dugganapalli extern scsi_lun_t	scsi_lun64_to_lun(scsi_lun64_t lun64);
66ed141cfcSsrivijitha dugganapalli #endif	/* SCSI_ADDR_PROP_LUN64 */
67ed141cfcSsrivijitha dugganapalli 
68*96c4a178SChris Horne extern int	scsi_ascii_inquiry_len(char *field, size_t length);
69*96c4a178SChris Horne 
707c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
717c478bd9Sstevel@tonic-gate }
727c478bd9Sstevel@tonic-gate #endif
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #endif	/* _LIBDEVID_H */
75