xref: /titanic_44/usr/src/uts/common/sys/emul64.h (revision bc913c4cbc9594e8ca0a031ba908f496ef40bbca)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_SCSI_ADAPTERS_EMUL64_H
28 #define	_SYS_SCSI_ADAPTERS_EMUL64_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * This file defines the commands and structures for three emul64 ioctls,
34  * that may be useful in speeding up tests involving large devices.  The
35  * ioctls are documented at
36  * http://lvm.central.sun.com/projects/lagavulin/emul64_design.html#ioctl.
37  * Briefly, there are three ioctls:
38  *
39  *	EMUL64_WRITE_OFF - ignore all write operations to a specified block
40  *		range.
41  *	EMUL64_WRITE_ON - enable writes to a specified block range.
42  *	EMUL64_ZERO_RANGE - zero all blocks in the specified range.
43  *
44  * The emul64_range structure is used to specify a block range for these
45  * ioctls.
46  */
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 #include <sys/inttypes.h>
53 #include <sys/types.h>
54 
55 /*
56  * emul64 ioctl commands:
57  */
58 
59 #define	EMUL64IOC	('e' << 8)
60 
61 #define	EMUL64_WRITE_OFF	(EMUL64IOC|37)
62 #define	EMUL64_WRITE_ON		(EMUL64IOC|38)
63 #define	EMUL64_ZERO_RANGE	(EMUL64IOC|39)
64 
65 struct emul64_range {
66 	diskaddr_t	emul64_sb;	/* starting block # of range */
67 	uint64_t	emul64_blkcnt;	/* # of blocks in range */
68 };
69 
70 typedef struct emul64_range emul64_range_t;
71 
72 /*
73  * Structure to use when specifying an ioctl for a range of blocks on a
74  * specific target.
75  */
76 struct emul64_tgt_range {
77 	emul64_range_t	emul64_blkrange; /* blocks affected by ioctl */
78 	ushort_t	emul64_target;	/* target number of disk */
79 	ushort_t	emul64_lun;	/* lun of disk */
80 };
81 
82 typedef struct emul64_tgt_range emul64_tgt_range_t;
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* _SYS_SCSI_ADAPTERS_EMUL64_H */
89