2 * File...........: s390-tools/dasdview/dasdview.h
3 * Author(s)......: Horst Hummel <horst.hummel@de.ibm.com>
4 * Copyright IBM Corp. 2002, 2006.
12 /********************************************************************************
13 * SECTION: Definitions needed for DASD-API (see dasd.h)
14 *******************************************************************************/
16 #define DASD_IOCTL_LETTER 'D'
19 * struct dasd_information_t
20 * represents any data about the device, which is visible to userspace.
21 * including foramt and features.
23 typedef struct dasd_information_t
{
24 unsigned int devno
; /* S/390 devno */
25 unsigned int real_devno
; /* for aliases */
26 unsigned int schid
; /* S/390 subchannel identifier */
27 unsigned int cu_type
: 16; /* from SenseID */
28 unsigned int cu_model
: 8; /* from SenseID */
29 unsigned int dev_type
: 16; /* from SenseID */
30 unsigned int dev_model
: 8; /* from SenseID */
31 unsigned int open_count
;
32 unsigned int req_queue_len
;
33 unsigned int chanq_len
; /* length of chanq */
34 char type
[4]; /* from discipline.name, 'none' for unknown */
35 unsigned int status
; /* current device level */
36 unsigned int label_block
; /* where to find the VOLSER */
37 unsigned int FBA_layout
; /* fixed block size (like AIXVOL) */
38 unsigned int characteristics_size
;
39 unsigned int confdata_size
;
40 char characteristics
[64]; /* from read_device_characteristics */
41 char configuration_data
[256]; /* from read_configuration_data */
44 typedef struct dasd_information2_t
{
45 unsigned int devno
; /* S/390 devno */
46 unsigned int real_devno
; /* for aliases */
47 unsigned int schid
; /* S/390 subchannel identifier */
48 unsigned int cu_type
: 16; /* from SenseID */
49 unsigned int cu_model
: 8; /* from SenseID */
50 unsigned int dev_type
: 16; /* from SenseID */
51 unsigned int dev_model
: 8; /* from SenseID */
52 unsigned int open_count
;
53 unsigned int req_queue_len
;
54 unsigned int chanq_len
; /* length of chanq */
55 char type
[4]; /* from discipline.name, 'none' for unknown */
56 unsigned int status
; /* current device level */
57 unsigned int label_block
; /* where to find the VOLSER */
58 unsigned int FBA_layout
; /* fixed block size (like AIXVOL) */
59 unsigned int characteristics_size
;
60 unsigned int confdata_size
;
61 unsigned char characteristics
[64];/*from read_device_characteristics */
62 unsigned char configuration_data
[256];/*from read_configuration_data */
63 unsigned int format
; /* format info like formatted/cdl/ldl/... */
64 unsigned int features
; /* dasd features like 'ro',... */
65 unsigned int reserved0
; /* reserved for further use ,... */
66 unsigned int reserved1
; /* reserved for further use ,... */
67 unsigned int reserved2
; /* reserved for further use ,... */
68 unsigned int reserved3
; /* reserved for further use ,... */
69 unsigned int reserved4
; /* reserved for further use ,... */
70 unsigned int reserved5
; /* reserved for further use ,... */
71 unsigned int reserved6
; /* reserved for further use ,... */
72 unsigned int reserved7
; /* reserved for further use ,... */
73 } dasd_information2_t
;
75 struct dasd_eckd_characteristics
{
76 unsigned short cu_type
;
78 unsigned char support
:2;
79 unsigned char async
:1;
80 unsigned char reserved
:1;
81 unsigned char cache_info
:1;
82 unsigned char model
:3;
83 } __attribute__ ((packed
)) cu_model
;
84 unsigned short dev_type
;
85 unsigned char dev_model
;
87 unsigned char mult_burst
:1;
88 unsigned char RT_in_LR
:1;
89 unsigned char reserved1
:1;
90 unsigned char RD_IN_LR
:1;
91 unsigned char reserved2
:4;
92 unsigned char reserved3
:8;
93 unsigned char defect_wr
:1;
94 unsigned char XRC_supported
:1;
95 unsigned char reserved4
:1;
96 unsigned char striping
:1;
97 unsigned char reserved5
:4;
99 unsigned char reserved6
:2;
100 unsigned char cache
:1;
101 unsigned char dual_copy
:1;
103 unsigned char reset_alleg
:1;
104 unsigned char sense_down
:1;
105 } __attribute__ ((packed
)) facilities
;
106 unsigned char dev_class
;
107 unsigned char unit_type
;
108 unsigned short no_cyl
;
109 unsigned short trk_per_cyl
;
110 unsigned char sec_per_trk
;
111 unsigned char byte_per_track
[3];
112 unsigned short home_bytes
;
113 unsigned char formula
;
119 } __attribute__ ((packed
)) f_0x01
;
126 } __attribute__ ((packed
)) f_0x02
;
127 } __attribute__ ((packed
)) factors
;
128 unsigned short first_alt_trk
;
129 unsigned short no_alt_trk
;
130 unsigned short first_dia_trk
;
131 unsigned short no_dia_trk
;
132 unsigned short first_sup_trk
;
133 unsigned short no_sup_trk
;
134 unsigned char MDR_ID
;
135 unsigned char OBR_ID
;
136 unsigned char director
;
137 unsigned char rd_trk_set
;
138 unsigned short max_rec_zero
;
139 unsigned char reserved1
;
140 unsigned char RWANY_in_LR
;
141 unsigned char factor6
;
142 unsigned char factor7
;
143 unsigned char factor8
;
144 unsigned char reserved2
[3];
145 unsigned char reserved3
[6];
146 unsigned int long_no_cyl
;
147 } __attribute__ ((packed
));
150 * values to be used for dasd_information2_t.format
151 * 0x00: NOT formatted
152 * 0x01: Linux disc layout
153 * 0x02: Common disc layout
155 #define DASD_FORMAT_NONE 0
156 #define DASD_FORMAT_LDL 1
157 #define DASD_FORMAT_CDL 2
160 * values to be used for dasd_information2_t.features
161 * 0x00: default features
162 * 0x01: readonly (ro)
163 * 0x02: use diag discipline (diag)
165 #define DASD_FEATURE_DEFAULT 0
166 #define DASD_FEATURE_READONLY 1
167 #define DASD_FEATURE_USEDIAG 2
169 /* Get information on a dasd device (enhanced) */
170 #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
171 #define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
173 /********************************************************************************
174 * SECTION: Further IOCTL Definitions (see fs.h and hdreq.h)
175 *******************************************************************************/
176 /* get block device sector size */
177 #define BLKSSZGET _IO(0x12,104)
178 /* return device size in bytes (u64 *arg) */
179 #define BLKGETSIZE64 _IOR(0x12,114,size_t)
181 /* get device geometry */
182 #define HDIO_GETGEO 0x0301
184 /********************************************************************************
185 * SECTION: DASDVIEW internal types
186 *******************************************************************************/
188 #define LINE_LENGTH 80
189 #define DASDVIEW_ERROR "dasdview:"
190 #define DEFAULT_BEGIN 0
191 #define DEFAULT_SIZE 128
192 #define NO_PART_LABELS 8 /* for partition related labels (f1,f8 and f9) */
193 #define SEEK_STEP 4194304LL
194 #define DUMP_STRING_SIZE 1024LL
196 #define PARSE_PARAM_INTO(x, param, base, str) \
197 { x=(int)strtol(param, &endptr, base); \
199 {sprintf(error_str, "Invalid parameter format.\n"); \
200 dasdview_error(usage_error);}}
203 #define ERROR_STRING_SIZE 1024
204 char error_str
[ERROR_STRING_SIZE
];
206 enum dasdview_failure
{
216 typedef struct dasdview_info
218 char device
[PATH_MAX
];
219 dasd_information2_t dasd_info
;
220 int dasd_info_version
;
223 struct hd_geometry geo
;
224 u_int32_t hw_cylinders
;
226 unsigned long long begin
;
227 unsigned long long size
;
231 int action_specified
;
236 int characteristic_specified
;
252 format1_label_t f1
[NO_PART_LABELS
];
256 format1_label_t f8
[NO_PART_LABELS
];
257 format9_label_t f9
[NO_PART_LABELS
];
267 #define dasdview_getopt_string "t:n:f:b:s:vhixjl12c"
269 /* struct options for getopt */
270 static struct option dasdview_getopt_long_options
[]=
272 { "devno", 1, 0, 'n'},
273 { "devnode", 1, 0, 'f'},
274 { "version", 0, 0, 'v'},
275 { "begin", 1, 0, 'b'},
276 { "size", 1, 0, 's'},
277 { "help", 0, 0, 'h'},
278 { "info", 0, 0, 'i'},
279 { "extended", 0, 0, 'x'},
280 { "volser", 0, 0, 'j'},
281 { "vtoc", 1, 0, 't'},
282 { "label", 0, 0, 'l'},
283 { "characteristic", 0, 0, 'c'},
288 #endif /* DASDVIEW_H */