usr/src/uts/common/io/comstar/lu/stmf_sbd/stmf_sbd.h
author Dan McDonald <danmcd@nexenta.com>
Fri, 04 Mar 2011 13:57:09 -0800
changeset 13297 4b9dc4ca8e9f
parent 12314 0ed71edeac88
permissions -rw-r--r--
701 UNMAP support for COMSTAR Reviewed by: Garrett D'Amore <[email protected]> Reviewed by: Eric Schrock <[email protected]> Reviewed by: George Wilson <[email protected]> Approved by: Garrett D'Amore <[email protected]>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
     1
/*
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
     2
 * CDDL HEADER START
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
     3
 *
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
     7
 *
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    11
 * and limitations under the License.
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    12
 *
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    18
 *
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    19
 * CDDL HEADER END
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    20
 */
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    21
/*
12314
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
    22
 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
13297
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
    23
 *
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
    24
 * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    25
 */
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    26
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    27
#ifndef	_STMF_SBD_H
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    28
#define	_STMF_SBD_H
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    29
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    30
#ifdef	__cplusplus
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    31
extern "C" {
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    32
#endif
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    33
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    34
typedef	stmf_status_t	sbd_status_t;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    35
extern char sbd_vendor_id[];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    36
extern char sbd_product_id[];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    37
extern char sbd_revision[];
11103
3b3f33a37cab 6894418 set interface for global logical unit property
John Forte <John.Forte@Sun.COM>
parents: 10725
diff changeset
    38
extern char *sbd_mgmt_url;
3b3f33a37cab 6894418 set interface for global logical unit property
John Forte <John.Forte@Sun.COM>
parents: 10725
diff changeset
    39
extern uint16_t sbd_mgmt_url_alloc_size;
3b3f33a37cab 6894418 set interface for global logical unit property
John Forte <John.Forte@Sun.COM>
parents: 10725
diff changeset
    40
extern krwlock_t sbd_global_prop_lock;
3b3f33a37cab 6894418 set interface for global logical unit property
John Forte <John.Forte@Sun.COM>
parents: 10725
diff changeset
    41
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    42
/*
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    43
 * Error codes
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    44
 */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    45
#define	SBD_SUCCESS		STMF_SUCCESS
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
    46
#define	SBD_FAILURE		STMF_LU_FAILURE
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    47
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    48
#define	SBD_ALREADY		(SBD_FAILURE | STMF_FSC(1))
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    49
#define	SBD_NOT_SUPPORTED	(SBD_FAILURE | STMF_FSC(2))
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    50
#define	SBD_META_CORRUPTED	(SBD_FAILURE | STMF_FSC(3))
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    51
#define	SBD_INVALID_ARG		(SBD_FAILURE | STMF_FSC(4))
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    52
#define	SBD_NOT_FOUND		(SBD_FAILURE | STMF_FSC(5))
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    53
#define	SBD_ALLOC_FAILURE	(SBD_FAILURE | STMF_FSC(6))
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    54
#define	SBD_FILEIO_FAILURE	(SBD_FAILURE | STMF_FSC(7))
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    55
#define	SBD_IO_PAST_EOF		(SBD_FAILURE | STMF_FSC(8))
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    56
#define	SBD_BUSY		(SBD_FAILURE | STMF_FSC(9))
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    57
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    58
#define	SHARED_META_DATA_SIZE	65536
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    59
#define	SBD_META_OFFSET		4096
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    60
#define	SBD_MIN_LU_SIZE		(1024 * 1024)
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    61
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    62
/*
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    63
 * sms endianess
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    64
 */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    65
#define	SMS_BIG_ENDIAN			0x00
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    66
#define	SMS_LITTLE_ENDIAN		0xFF
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    67
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    68
#ifdef	_BIG_ENDIAN
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    69
#define	SMS_DATA_ORDER	SMS_BIG_ENDIAN
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    70
#else
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    71
#define	SMS_DATA_ORDER	SMS_LITTLE_ENDIAN
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    72
#endif
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    73
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    74
#define	SBD_MAGIC	0x53554e5342444c55
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    75
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    76
#define	SBD_VER_MAJOR		1
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    77
#define	SBD_VER_MINOR		1
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    78
#define	SBD_VER_SUBMINOR	0
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    79
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    80
#if 0
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    81
typedef struct sbd_meta_start {
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    82
	uint64_t		sm_magic;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    83
	uint64_t		sm_meta_size;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    84
	uint64_t		sm_meta_size_used;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    85
	uint64_t		sm_rsvd1;	/* Defaults to zero */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    86
	uint64_t		sm_rsvd2;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    87
	uint16_t		sm_ver_major;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    88
	uint16_t		sm_ver_minor;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    89
	uint16_t		sm_ver_subminor;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    90
	uint8_t			sm_flags;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    91
	uint8_t			sm_chksum;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    92
} sbd_meta_start_t;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    93
#endif
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    94
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    95
typedef struct sm_section_hdr {
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    96
	uint64_t	sms_offset;	/* Offset of this section */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    97
	uint32_t	sms_size;	/* Includes the header and padding */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    98
	uint16_t	sms_id;		/* Section identifier */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
    99
	uint8_t		sms_data_order; /* 0x00 or 0xff */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   100
	uint8_t		sms_chksum;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   101
} sm_section_hdr_t;
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   102
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   103
/*
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   104
 * sbd meta section identifiers
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   105
 */
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   106
#define	SMS_ID_LU_INFO_1_0	0
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   107
#define	SMS_ID_LU_INFO_1_1	1
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   108
#define	SMS_ID_PGR_INFO		2
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   109
#define	SMS_ID_UNUSED		0x1000
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   110
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   111
typedef struct sbd_lu_info_1_0 {
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   112
	sm_section_hdr_t	sli_sms_header;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   113
	uint64_t		sli_total_store_size;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   114
	uint64_t		sli_total_meta_size;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   115
	uint64_t		sli_lu_data_offset;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   116
	uint64_t		sli_lu_data_size;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   117
	uint32_t		sli_flags;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   118
	uint16_t		sli_blocksize;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   119
	uint8_t			sli_data_order;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   120
	uint8_t			rsvd1;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   121
	uint8_t			sli_lu_devid[20];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   122
	uint32_t		rsvd2;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   123
} sbd_lu_info_1_0_t;
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   124
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   125
typedef struct sbd_lu_info_1_1 {
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   126
	sm_section_hdr_t	sli_sms_header;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   127
	uint32_t		sli_flags;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   128
	char			sli_rev[4];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   129
	char			sli_vid[8];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   130
	char			sli_pid[16];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   131
	uint64_t		sli_lu_size;	/* Read capacity size */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   132
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   133
	/*
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   134
	 * Essetially zfs volume name for zvols to verify that the
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   135
	 * metadata is coming in from the correct zvol and not from a
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   136
	 * clone. Has no meaning in any other case.
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   137
	 */
10114
023993413f11 6845064 SUNWstmfu package dependency on dynamically linked libs not captured
tim szeto <Tim.Szeto@Sun.COM>
parents: 10113
diff changeset
   138
	uint64_t		sli_meta_fname_offset;
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   139
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   140
	/*
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   141
	 * Data filename or the media filename when the metadata is in
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   142
	 * a separate file. Its not needed if the metadata is shared
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   143
	 * with data as the user supplied name is the data filename.
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   144
	 */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   145
	uint64_t		sli_data_fname_offset;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   146
	uint64_t		sli_serial_offset;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   147
	uint64_t		sli_alias_offset;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   148
	uint8_t			sli_data_blocksize_shift;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   149
	uint8_t			sli_data_order;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   150
	uint8_t			sli_serial_size;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   151
	uint8_t			sli_rsvd1;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   152
	uint8_t			sli_device_id[20];
10113
045148591643 6812611 Add Management Network Address VPD (85h) support to sbd
Nattuvetty Bhavyan <Nattuvetty.Bhavyan@Sun.COM>
parents: 9679
diff changeset
   153
	uint64_t		sli_mgmt_url_offset;
045148591643 6812611 Add Management Network Address VPD (85h) support to sbd
Nattuvetty Bhavyan <Nattuvetty.Bhavyan@Sun.COM>
parents: 9679
diff changeset
   154
	uint8_t			sli_rsvd2[248];
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   155
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   156
	/*
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   157
	 * In case there is no separate meta, sli_meta_fname_offset wont
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   158
	 * be valid. The same is true for zfs based metadata. The data_fname
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   159
	 * is the zvol.
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   160
	 */
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   161
	uint8_t			sli_buf[8];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   162
} sbd_lu_info_1_1_t;
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   163
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   164
/*
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   165
 * sli flags
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   166
 */
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   167
#define	SLI_SEPARATE_META			0x0001
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   168
#define	SLI_WRITE_PROTECTED			0x0002
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   169
#define	SLI_VID_VALID				0x0004
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   170
#define	SLI_PID_VALID				0x0008
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   171
#define	SLI_REV_VALID				0x0010
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   172
#define	SLI_META_FNAME_VALID			0x0020
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   173
#define	SLI_DATA_FNAME_VALID			0x0040
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   174
#define	SLI_SERIAL_VALID			0x0080
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   175
#define	SLI_ALIAS_VALID				0x0100
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   176
#define	SLI_WRITEBACK_CACHE_DISABLE		0x0200
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   177
#define	SLI_ZFS_META				0x0400
10113
045148591643 6812611 Add Management Network Address VPD (85h) support to sbd
Nattuvetty Bhavyan <Nattuvetty.Bhavyan@Sun.COM>
parents: 9679
diff changeset
   178
#define	SLI_MGMT_URL_VALID			0x0800
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   179
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   180
struct sbd_it_data;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   181
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   182
typedef struct sbd_lu {
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   183
	struct sbd_lu	*sl_next;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   184
	stmf_lu_t	*sl_lu;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   185
	uint32_t	sl_alloc_size;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   186
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   187
	/* Current LU state */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   188
	kmutex_t	sl_lock;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   189
	uint32_t	sl_flags;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   190
	uint8_t		sl_trans_op;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   191
	uint8_t		sl_state:7,
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   192
			sl_state_not_acked:1;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   193
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   194
	char		*sl_name;		/* refers to meta or data */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   195
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   196
	/* Metadata */
10526
a1c57e83a4db 6870528 writing comstar property larger than 1k disk pool size incorrectly modifies property data
tim szeto <Tim.Szeto@Sun.COM>
parents: 10114
diff changeset
   197
	kmutex_t	sl_metadata_lock;
10725
cd144ed668c5 PSARC/2009/465 COMSTAR ALUA active/standby support
John Forte <John.Forte@Sun.COM>
parents: 10526
diff changeset
   198
	krwlock_t	sl_access_state_lock;
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   199
	char		*sl_alias;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   200
	char		*sl_meta_filename;	/* If applicable */
10113
045148591643 6812611 Add Management Network Address VPD (85h) support to sbd
Nattuvetty Bhavyan <Nattuvetty.Bhavyan@Sun.COM>
parents: 9679
diff changeset
   201
	char		*sl_mgmt_url;
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   202
	vnode_t		*sl_meta_vp;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   203
	vtype_t		sl_meta_vtype;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   204
	uint8_t		sl_device_id[20];	/* 4(hdr) + 16(GUID) */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   205
	uint8_t		sl_meta_blocksize_shift; /* Left shift multiplier */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   206
	uint8_t		sl_data_blocksize_shift;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   207
	uint8_t		sl_data_fs_nbits;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   208
	uint8_t		sl_serial_no_size;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   209
	uint64_t	sl_total_meta_size;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   210
	uint64_t	sl_meta_size_used;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   211
	uint8_t		*sl_serial_no;		/* optional */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   212
	char		sl_vendor_id[8];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   213
	char		sl_product_id[16];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   214
	char		sl_revision[4];
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   215
	uint32_t	sl_data_fname_alloc_size; /* for an explicit alloc */
10113
045148591643 6812611 Add Management Network Address VPD (85h) support to sbd
Nattuvetty Bhavyan <Nattuvetty.Bhavyan@Sun.COM>
parents: 9679
diff changeset
   216
	uint16_t	sl_alias_alloc_size;
045148591643 6812611 Add Management Network Address VPD (85h) support to sbd
Nattuvetty Bhavyan <Nattuvetty.Bhavyan@Sun.COM>
parents: 9679
diff changeset
   217
	uint16_t	sl_mgmt_url_alloc_size;
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   218
	uint8_t		sl_serial_no_alloc_size;
10725
cd144ed668c5 PSARC/2009/465 COMSTAR ALUA active/standby support
John Forte <John.Forte@Sun.COM>
parents: 10526
diff changeset
   219
	uint8_t		sl_access_state;
9679
02840839dd81 6701531 When possible SBD should not write its metadata directly on the backing store
tim szeto <Tim.Szeto@Sun.COM>
parents: 9585
diff changeset
   220
	uint64_t	sl_meta_offset;
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   221
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   222
	/* zfs metadata */
9679
02840839dd81 6701531 When possible SBD should not write its metadata directly on the backing store
tim szeto <Tim.Szeto@Sun.COM>
parents: 9585
diff changeset
   223
	krwlock_t	sl_zfs_meta_lock;
02840839dd81 6701531 When possible SBD should not write its metadata directly on the backing store
tim szeto <Tim.Szeto@Sun.COM>
parents: 9585
diff changeset
   224
	char		*sl_zfs_meta;
12314
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
   225
	minor_t		sl_zvol_minor;		/* for direct zvol calls */
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
   226
	/* opaque handles for zvol direct calls */
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
   227
	void		*sl_zvol_minor_hdl;
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
   228
	void		*sl_zvol_objset_hdl;
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
   229
	void		*sl_zvol_zil_hdl;
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
   230
	void		*sl_zvol_rl_hdl;
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
   231
	void		*sl_zvol_bonus_hdl;
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   232
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   233
	/* Backing store */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   234
	char		*sl_data_filename;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   235
	vnode_t		*sl_data_vp;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   236
	vtype_t		sl_data_vtype;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   237
	uint64_t	sl_total_data_size;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   238
	uint64_t	sl_data_readable_size;	/* read() fails after this */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   239
	uint64_t	sl_data_offset;		/* After the metadata,if any */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   240
	uint64_t	sl_lu_size;		/* READ CAPACITY size */
12314
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
   241
	uint64_t	sl_blksize;		/* used for zvols */
0ed71edeac88 6909809 COMSTAR should avoid extra data copy to zvol-based backing store
James Moore <James.Moore@Sun.COM>
parents: 11773
diff changeset
   242
	uint64_t	sl_max_xfer_len;	/* used for zvols */
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   243
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   244
	struct sbd_it_data	*sl_it_list;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   245
	struct sbd_pgr		*sl_pgr;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   246
	uint64_t	sl_rs_owner_session_id;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   247
} sbd_lu_t;
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   248
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   249
/*
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   250
 * sl_flags
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   251
 */
13297
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   252
#define	SL_LINKED			    0x00000001
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   253
#define	SL_META_OPENED			    0x00000002
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   254
#define	SL_REGISTERED			    0x00000004
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   255
#define	SL_META_NEEDS_FLUSH		    0x00000008
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   256
#define	SL_DATA_NEEDS_FLUSH		    0x00000010
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   257
#define	SL_VID_VALID			    0x00000020
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   258
#define	SL_PID_VALID			    0x00000040
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   259
#define	SL_REV_VALID			    0x00000080
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   260
#define	SL_WRITE_PROTECTED		    0x00000100
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   261
#define	SL_MEDIA_LOADED			    0x00000200
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   262
#define	SL_LU_HAS_SCSI2_RESERVATION	    0x00000400
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   263
#define	SL_WRITEBACK_CACHE_DISABLE	    0x00000800
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   264
#define	SL_SAVED_WRITE_CACHE_DISABLE	    0x00001000
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   265
#define	SL_MEDIUM_REMOVAL_PREVENTED	    0x00002000
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   266
#define	SL_NO_DATA_DKIOFLUSH		    0x00004000
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   267
#define	SL_SHARED_META			    0x00008000
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   268
#define	SL_ZFS_META			    0x00010000
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   269
#define	SL_WRITEBACK_CACHE_SET_UNSUPPORTED  0x00020000
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   270
#define	SL_FLUSH_ON_DISABLED_WRITECACHE	    0x00040000
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   271
#define	SL_CALL_ZVOL			    0x00080000
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   272
#define	SL_UNMAP_ENABLED		    0x00100000
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   273
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   274
/*
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   275
 * sl_trans_op. LU is undergoing some transition and this field
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   276
 * tells what kind of transition that is.
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   277
 */
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   278
#define	SL_OP_NONE				0
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   279
#define	SL_OP_CREATE_REGISTER_LU		1
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   280
#define	SL_OP_IMPORT_LU				2
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   281
#define	SL_OP_DELETE_LU				3
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   282
#define	SL_OP_MODIFY_LU				4
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   283
#define	SL_OP_LU_PROPS				5
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   284
11773
189ba22b9863 6889694 COMSTAR kstat to track IO statistics at the ITL
tim szeto <Tim.Szeto@Sun.COM>
parents: 11103
diff changeset
   285
sbd_status_t sbd_data_read(sbd_lu_t *sl, scsi_task_t *task,
189ba22b9863 6889694 COMSTAR kstat to track IO statistics at the ITL
tim szeto <Tim.Szeto@Sun.COM>
parents: 11103
diff changeset
   286
    uint64_t offset, uint64_t size, uint8_t *buf);
189ba22b9863 6889694 COMSTAR kstat to track IO statistics at the ITL
tim szeto <Tim.Szeto@Sun.COM>
parents: 11103
diff changeset
   287
sbd_status_t sbd_data_write(sbd_lu_t *sl, scsi_task_t *task,
189ba22b9863 6889694 COMSTAR kstat to track IO statistics at the ITL
tim szeto <Tim.Szeto@Sun.COM>
parents: 11103
diff changeset
   288
    uint64_t offset, uint64_t size, uint8_t *buf);
9585
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   289
stmf_status_t sbd_task_alloc(struct scsi_task *task);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   290
void sbd_new_task(struct scsi_task *task, struct stmf_data_buf *initial_dbuf);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   291
void sbd_dbuf_xfer_done(struct scsi_task *task, struct stmf_data_buf *dbuf);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   292
void sbd_send_status_done(struct scsi_task *task);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   293
void sbd_task_free(struct scsi_task *task);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   294
stmf_status_t sbd_abort(struct stmf_lu *lu, int abort_cmd, void *arg,
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   295
    uint32_t flags);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   296
void sbd_ctl(struct stmf_lu *lu, int cmd, void *arg);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   297
stmf_status_t sbd_info(uint32_t cmd, stmf_lu_t *lu, void *arg, uint8_t *buf,
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   298
    uint32_t *bufsizep);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   299
sbd_status_t sbd_write_lu_info(sbd_lu_t *sl);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   300
sbd_status_t sbd_flush_data_cache(sbd_lu_t *sl, int fsync_done);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   301
sbd_status_t sbd_wcd_set(int wcd, sbd_lu_t *sl);
bf09620212ab 6795089 COMSTAR sbd lun provider should support PGR
tim szeto <Tim.Szeto@Sun.COM>
parents: 7836
diff changeset
   302
void sbd_wcd_get(int *wcd, sbd_lu_t *sl);
13297
4b9dc4ca8e9f 701 UNMAP support for COMSTAR
Dan McDonald <danmcd@nexenta.com>
parents: 12314
diff changeset
   303
int sbd_unmap(sbd_lu_t *, uint64_t, uint64_t);
7836
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   304
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   305
#ifdef	__cplusplus
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   306
}
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   307
#endif
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   308
4e95154b5b7a 6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff changeset
   309
#endif /* _STMF_SBD_H */