xref: /titanic_41/usr/src/uts/common/sys/stmf_sbd_ioctl.h (revision d5ace9454616652a717c9831d949dffa319381f9)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_STMF_SBD_IOCTL_H
27 #define	_STMF_SBD_IOCTL_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #define	MEMDISK_MIN_SIZE	(1024 * 1024)
34 #define	MEMDISK_MAX_SIZE	(1024 * 1024 * 1024)
35 
36 /*
37  * ioctl cmds
38  */
39 #define	SBD_IOCTL_CMD		(((uint32_t)'S') << 24)
40 
41 #define	SBD_REGISTER_LU		(SBD_IOCTL_CMD | 0x01)
42 #define	SBD_GET_LU_ATTR		(SBD_IOCTL_CMD | 0x02)
43 #define	SBD_GET_LU_LIST		(SBD_IOCTL_CMD | 0x03)
44 #define	SBD_DEREGISTER_LU	(SBD_IOCTL_CMD | 0x04)
45 #define	SBD_MODIFY_LU		(SBD_IOCTL_CMD | 0x05)
46 
47 typedef enum rlc_flags {
48 	RLC_LU_TYPE_MEMDISK = 0x01,
49 	RLC_LU_TYPE_FILEDISK = 0x02,
50 	RLC_CREATE_LU = 0x04,		/* Initialize metadata */
51 	RLC_REGISTER_LU = 0x10,
52 	RLC_DEREGISTER_LU = 0x20,
53 	RLC_FORCE_OP = 0x40
54 } rlc_flags_t;
55 
56 typedef enum rlc_ret {
57 	RLC_RET_META_CREATION_FAILED = 0x01,
58 	RLC_RET_LU_NOT_INITIALIZED,
59 	RLC_RET_FILE_ALREADY_REGISTERED,
60 	RLC_RET_GUID_ALREADY_REGISTERED,
61 	RLC_RET_REGISTER_SST_FAILED,
62 	RLC_RET_DEREGISTER_SST_FAILED,
63 	RLC_RET_FILE_LOOKUP_FAILED,
64 	RLC_RET_WRONG_FILE_TYPE,
65 	RLC_RET_FILE_OPEN_FAILED,
66 	RLC_RET_FILE_GETATTR_FAILED,
67 	RLC_RET_FILE_SIZE_ERROR,
68 	RLC_RET_FILE_ALIGN_ERROR,
69 	RLC_RET_SIZE_OUT_OF_RANGE,
70 	RLC_RET_SIZE_NOT_SUPPORTED_BY_FS,
71 
72 	RLC_RET_MAX_VAL
73 } rlc_ret_t;
74 
75 typedef struct register_lu_cmd {
76 	uint32_t	total_struct_size;
77 	rlc_flags_t	flags;
78 	uint64_t	lu_size;	/* For memdisk only */
79 	rlc_ret_t	return_code;
80 	uint32_t	filesize_nbits;
81 	stmf_status_t	op_ret;
82 	uint64_t	lu_handle;
83 	uint8_t		guid[16];	/* For reporting back duplicate GUID */
84 	char		name[8];
85 } register_lu_cmd_t;
86 
87 typedef struct deregister_lu_cmd {
88 	uint32_t	total_struct_size;
89 	rlc_flags_t	flags;
90 	rlc_ret_t	return_code;
91 	uint32_t	rsvd;
92 	uint8_t		guid[16];
93 } deregister_lu_cmd_t;
94 
95 typedef struct modify_lu_cmd {
96 	uint32_t	total_struct_size;
97 	rlc_flags_t	flags;
98 	uint64_t	lu_size;
99 	rlc_ret_t	return_code;
100 	uint32_t	filesize_nbits;
101 	stmf_status_t	op_ret;
102 	uint8_t		guid[16];
103 	char		name[8];
104 } modify_lu_cmd_t;
105 
106 typedef struct sbd_lu_attr {
107 	uint32_t	total_struct_size;
108 	rlc_flags_t	flags;	/* to find out the type */
109 	int		max_name_length;
110 	uint32_t	rsvd;
111 	uint64_t	lu_handle;
112 	uint64_t	total_size;
113 	uint64_t	data_size;
114 	uint8_t		guid[16];
115 	char		name[8];
116 } sbd_lu_attr_t;
117 
118 typedef struct sbd_lu_list {
119 	uint32_t	total_struct_size;
120 	uint32_t	count_in;
121 	uint32_t	count_out;
122 	uint32_t	rsvd;
123 	uint64_t	handles[1];
124 } sbd_lu_list_t;
125 
126 #ifdef	__cplusplus
127 }
128 #endif
129 
130 #endif /* _STMF_SBD_IOCTL_H */
131