libparted 3.6
Loading...
Searching...
No Matches
fdasd.in.h
Go to the documentation of this file.
1/*
2 * File...........: s390-tools/fdasd/fdasd.h
3 * Author(s)......: Volker Sameske <sameske@de.ibm.com>
4 * Horst Hummel <Horst.Hummel@de.ibm.com>
5 * Bugreports.to..: <Linux390@de.ibm.com>
6 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2001-2002
7 *
8 * History of changes (starts March 2001)
9 * version 1.01 - menu entry 's' to show mapping devnode - DS name
10 * 1.02 - DS names count now from 0001 instead from 0000
11 * 1.03 - volser checks: 'AA AAA' to 'AAAAA '
12 * - removed dependency to kernel headers.
13 * 1.04 - added -p option
14 * 1.05 - new API policy, set it back to 0
15 */
16#ifndef FDASD_H
17#define FDASD_H
18
19#include <parted/vtoc.h>
20
21/*****************************************************************************
22 * SECTION: Definitions needed for DASD-API (see dasd.h) *
23 *****************************************************************************/
24
25#define DASD_IOCTL_LETTER 'D'
26
27#define DASD_PARTN_BITS 2
28
29#define PARTITION_LINUX_SWAP 0x82
30#define PARTITION_LINUX 0x83
31#define PARTITION_LINUX_LVM 0x8e
32#define PARTITION_LINUX_RAID 0xfd
34#define PART_TYPE_NATIVE "NATIVE"
35#define PART_TYPE_SWAP "SWAP "
36#define PART_TYPE_RAID "RAID "
37#define PART_TYPE_LVM "LVM "
38
39#ifdef DEBUG_DASD
40#define PDEBUG fprintf(stderr, "%s:%d:%s\n", \
41 __FILE__, \
42 __LINE__, \
43 __PRETTY_FUNCTION__);
44#else
45#define PDEBUG
46#endif
47
48/*
49 * struct dasd_information_t
50 * represents any data about the device, which is visible to userspace.
51 * including foramt and featueres.
52 */
53typedef struct dasd_information_t {
54 unsigned int devno; /* S/390 devno */
55 unsigned int real_devno; /* for aliases */
56 unsigned int schid; /* S/390 subchannel identifier */
57 unsigned int cu_type : 16; /* from SenseID */
58 unsigned int cu_model : 8; /* from SenseID */
59 unsigned int dev_type : 16; /* from SenseID */
60 unsigned int dev_model : 8; /* from SenseID */
61 unsigned int open_count;
62 unsigned int req_queue_len;
63 unsigned int chanq_len; /* length of chanq */
64 char type[4]; /* from discipline.name, 'none' for */
65 /* unknown */
66 unsigned int status; /* current device level */
67 unsigned int label_block; /* where to find the VOLSER */
68 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
69 unsigned int characteristics_size;
70 unsigned int confdata_size;
71 char characteristics[64]; /* from read_device_characteristics */
72 char configuration_data[256]; /* from read_configuration_data */
74
76 unsigned short cu_type;
77 struct {
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;
86 struct {
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;
98 unsigned char cfw:1;
99 unsigned char reserved6:2;
100 unsigned char cache:1;
101 unsigned char dual_copy:1;
102 unsigned char dfw: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;
114 union {
115 struct {
116 unsigned char f1;
117 unsigned short f2;
118 unsigned short f3;
119 } __attribute__ ((packed)) f_0x01;
120 struct {
121 unsigned char f1;
122 unsigned char f2;
123 unsigned char f3;
124 unsigned char f4;
125 unsigned char f5;
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));
148
149/*
150 * struct format_data_t
151 * represents all data necessary to format a dasd
152 */
153typedef struct format_data_t {
154 int start_unit; /* from track */
155 int stop_unit; /* to track */
156 int blksize; /* sectorsize */
157 int intensity;
159
160/*
161 * values to be used for format_data_t.intensity
162 * 0/8: normal format
163 * 1/9: also write record zero
164 * 3/11: also write home address
165 * 4/12: invalidate track
166 */
167#define DASD_FMT_INT_FMT_R0 1 /* write record zero */
168#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
169#define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
170#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
171
172
173/* Disable the volume (for Linux) */
174#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
175/* Enable the volume (for Linux) */
176#define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)
177
178/* retrieve API version number */
179#define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int)
180/* Get information on a dasd device (enhanced) */
181#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
182
183
184/*****************************************************************************
185 * SECTION: Further IOCTL Definitions (see fs.h) *
186 *****************************************************************************/
187#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
188/* re-read partition table */
189#define BLKRRPART _IO(0x12,95)
190/* get block device sector size */
191#define BLKSSZGET _IO(0x12,104)
192/* device size in bytes (u64 *arg)*/
193#define BLKGETSIZE64 _IOR(0x12,114,size_t)
194/* get device geometry */
195#define HDIO_GETGEO 0x0301
196
197/*****************************************************************************
198 * SECTION: FDASD internal types *
199 *****************************************************************************/
200#define PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
201#define USABLE_PARTITIONS ((1 << DASD_PARTN_BITS) - 1)
202
203#define DASD_MIN_API_VERSION 0
204
205#define DEFAULT_FDASD_CONF "/etc/fdasd.conf" /* default config file */
206
207#define FDASD_VERSION "1.32.0"
208#define DEVICE "device"
209#define DISC "disc"
210#define PART "part"
211
212#define ALTERNATE_CYLINDERS_USED 0x10
213
214typedef struct partition_info {
215 u_int8_t used;
216 unsigned long start_trk;
217 unsigned long end_trk;
218 unsigned long len_trk;
219 unsigned long fspace_trk;
221 struct partition_info *next;
222 struct partition_info *prev;
223 u_int8_t type;
225
226typedef struct config_data {
227 unsigned long start;
228 unsigned long stop;
230
231typedef struct fdasd_anchor {
232 int vlabel_changed;
233 int vtoc_changed;
234 int auto_partition;
235 int print_table;
236 int big_disk;
237 int silent;
238 int verbose;
239 int devno;
240 int option_reuse;
241 int option_recreate;
243 u_int16_t dev_type;
244 unsigned int used_partitions;
245 unsigned long label_pos;
246 unsigned int blksize;
247 unsigned long fspace_trk;
251 format9_label_t *f9; /* template for all f9 labels */
256 u_int32_t hw_cylinders;
257 u_int32_t formatted_cylinders;
258 struct fdasd_hd_geometry geo;
259 unsigned int label_block;
260 unsigned int FBA_layout;
261 bool is_file;
263
265
283
284void fdasd_cleanup (fdasd_anchor_t *anchor);
286int fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int fd);
287void fdasd_check_api_version (fdasd_anchor_t *anc, int fd);
288int fdasd_check_volume (fdasd_anchor_t *anc, int fd);
289int fdasd_write_labels (fdasd_anchor_t *anc, int fd);
292 unsigned int start, unsigned int stop);
293int fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) ;
294void fdasd_check_volser(char *volser, int devno);
295int fdasd_get_volser(fdasd_anchor_t *anc, char *volser, int fd);
296void fdasd_change_volser(fdasd_anchor_t *anc, char *str);
298
299#endif /* FDASD_H */
typedef __attribute__
Definition: vtoc.h:80
uint32_t start
Definition: dos.c:4
offset
Definition: fdasd.h:264
fdasd_failure
Definition: fdasd.h:266
#define USABLE_PARTITIONS
Definition: fdasd.in.h:201
int fdasd_get_volser(fdasd_anchor_t *anc, char *volser, int fd)
Definition: fdasd.c:1349
void fdasd_check_api_version(fdasd_anchor_t *anc, int fd)
Definition: fdasd.c:899
void fdasd_initialize_anchor(fdasd_anchor_t *anc)
Definition: fdasd.c:202
void fdasd_change_volser(fdasd_anchor_t *anc, char *str)
Definition: fdasd.c:1361
void fdasd_cleanup(fdasd_anchor_t *anchor)
Definition: fdasd.c:105
void fdasd_check_volser(char *volser, int devno)
Definition: fdasd.c:1323
@ upper
Definition: fdasd.in.h:264
@ lower
Definition: fdasd.in.h:264
int fdasd_write_labels(fdasd_anchor_t *anc, int fd)
Definition: fdasd.c:414
struct partition_info partition_info_t
int fdasd_prepare_labels(fdasd_anchor_t *anc, int fd)
Definition: fdasd.c:430
@ device_verification_failed
Definition: fdasd.in.h:280
@ wrong_disk_format
Definition: fdasd.in.h:274
@ read_only_disk
Definition: fdasd.in.h:270
@ dsname_corrupted
Definition: fdasd.in.h:278
@ config_syntax_error
Definition: fdasd.in.h:276
@ api_version_mismatch
Definition: fdasd.in.h:272
@ unable_to_seek_disk
Definition: fdasd.in.h:268
@ vlabel_corrupted
Definition: fdasd.in.h:277
@ wrong_disk_type
Definition: fdasd.in.h:273
@ unable_to_ioctl
Definition: fdasd.in.h:271
@ disk_in_use
Definition: fdasd.in.h:275
@ malloc_failed
Definition: fdasd.in.h:279
@ volser_not_found
Definition: fdasd.in.h:281
@ unable_to_read_disk
Definition: fdasd.in.h:269
@ unable_to_open_disk
Definition: fdasd.in.h:267
struct fdasd_anchor fdasd_anchor_t
partition_info_t * fdasd_add_partition(fdasd_anchor_t *anc, unsigned int start, unsigned int stop)
Definition: fdasd.c:1269
void fdasd_recreate_vtoc(fdasd_anchor_t *anc)
Definition: fdasd.c:512
int fdasd_check_volume(fdasd_anchor_t *anc, int fd)
Definition: fdasd.c:836
void fdasd_reuse_vtoc(fdasd_anchor_t *anc)
Definition: fdasd.c:1375
struct config_data config_data_t
int fdasd_get_geometry(const PedDevice *dev, fdasd_anchor_t *anc, int fd)
Definition: fdasd.c:988
A block device - for example, /dev/hda, not /dev/hda3.
Definition: device.h:74
Definition: fdasd.h:226
unsigned long start
Definition: fdasd.h:227
unsigned long stop
Definition: fdasd.h:228
Definition: fdasd.h:75
unsigned char dual_copy
Definition: fdasd.h:101
unsigned short f2
Definition: fdasd.h:117
unsigned char defect_wr
Definition: fdasd.h:93
unsigned short no_dia_trk
Definition: fdasd.h:131
unsigned char reserved4
Definition: fdasd.h:95
unsigned short first_sup_trk
Definition: fdasd.h:132
unsigned short dev_type
Definition: fdasd.h:84
unsigned char director
Definition: fdasd.h:136
unsigned char rd_trk_set
Definition: fdasd.h:137
unsigned char RD_IN_LR
Definition: fdasd.h:90
unsigned char dev_class
Definition: fdasd.h:106
unsigned char RWANY_in_LR
Definition: fdasd.h:140
unsigned char OBR_ID
Definition: fdasd.h:135
unsigned char model
Definition: fdasd.h:82
unsigned char factor7
Definition: fdasd.h:142
unsigned char byte_per_track[3]
Definition: fdasd.h:111
unsigned char cache
Definition: fdasd.h:100
unsigned char RT_in_LR
Definition: fdasd.h:88
unsigned char unit_type
Definition: fdasd.h:107
unsigned char reset_alleg
Definition: fdasd.h:103
unsigned char factor8
Definition: fdasd.h:143
unsigned char reserved2
Definition: fdasd.h:91
unsigned int long_no_cyl
Definition: fdasd.h:146
unsigned char MDR_ID
Definition: fdasd.h:134
unsigned char sense_down
Definition: fdasd.h:104
unsigned char cache_info
Definition: fdasd.h:81
unsigned short first_dia_trk
Definition: fdasd.h:130
unsigned char reserved5
Definition: fdasd.h:97
unsigned char reserved
Definition: fdasd.h:80
unsigned char mult_burst
Definition: fdasd.h:87
unsigned char formula
Definition: fdasd.h:113
unsigned char striping
Definition: fdasd.h:96
unsigned short trk_per_cyl
Definition: fdasd.h:109
unsigned char factor6
Definition: fdasd.h:141
unsigned char reserved1
Definition: fdasd.h:89
unsigned char f4
Definition: fdasd.h:124
unsigned short cu_type
Definition: fdasd.h:76
unsigned char cfw
Definition: fdasd.h:98
unsigned short first_alt_trk
Definition: fdasd.h:128
unsigned short f3
Definition: fdasd.h:118
unsigned char support
Definition: fdasd.h:78
unsigned short no_alt_trk
Definition: fdasd.h:129
unsigned char XRC_supported
Definition: fdasd.h:94
unsigned char f1
Definition: fdasd.h:116
unsigned char sec_per_trk
Definition: fdasd.h:110
unsigned char async
Definition: fdasd.h:79
unsigned char reserved3
Definition: fdasd.h:92
unsigned char dev_model
Definition: fdasd.h:85
unsigned char reserved6
Definition: fdasd.h:99
unsigned short no_cyl
Definition: fdasd.h:108
struct dasd_eckd_characteristics::@0 __attribute__((packed)) cu_model
unsigned char f5
Definition: fdasd.h:125
unsigned char dfw
Definition: fdasd.h:102
unsigned short home_bytes
Definition: fdasd.h:112
unsigned short max_rec_zero
Definition: fdasd.h:138
unsigned short no_sup_trk
Definition: fdasd.h:133
Definition: fdasd.h:53
unsigned int req_queue_len
Definition: fdasd.h:62
unsigned int chanq_len
Definition: fdasd.h:63
unsigned int cu_type
Definition: fdasd.h:57
char configuration_data[256]
Definition: fdasd.h:72
unsigned int schid
Definition: fdasd.h:56
unsigned int devno
Definition: fdasd.h:54
unsigned int cu_model
Definition: fdasd.h:58
unsigned int dev_type
Definition: fdasd.h:59
unsigned int label_block
Definition: fdasd.h:67
unsigned int dev_model
Definition: fdasd.h:60
unsigned int confdata_size
Definition: fdasd.h:70
char type[4]
Definition: fdasd.h:64
unsigned int characteristics_size
Definition: fdasd.h:69
unsigned int real_devno
Definition: fdasd.h:55
char characteristics[64]
Definition: fdasd.h:71
unsigned int open_count
Definition: fdasd.h:61
unsigned int FBA_layout
Definition: fdasd.h:68
unsigned int status
Definition: fdasd.h:66
Definition: fdasd.h:231
unsigned int FBA_layout
Definition: fdasd.h:260
unsigned long label_pos
Definition: fdasd.h:245
bool is_file
Definition: fdasd.h:261
int devno
Definition: fdasd.h:239
int verbose
Definition: fdasd.h:238
int partno[USABLE_PARTITIONS]
Definition: fdasd.h:242
format4_label_t * f4
Definition: fdasd.h:248
u_int16_t dev_type
Definition: fdasd.h:243
int big_disk
Definition: fdasd.h:236
partition_info_t * last
Definition: fdasd.h:253
struct fdasd_hd_geometry geo
Definition: fdasd.h:258
volume_label_t * vlabel
Definition: fdasd.h:254
u_int32_t formatted_cylinders
Definition: fdasd.h:257
format5_label_t * f5
Definition: fdasd.h:249
int silent
Definition: fdasd.h:237
int print_table
Definition: fdasd.h:235
unsigned int used_partitions
Definition: fdasd.h:244
int option_reuse
Definition: fdasd.h:240
int vtoc_changed
Definition: fdasd.h:233
unsigned int label_block
Definition: fdasd.h:259
u_int32_t hw_cylinders
Definition: fdasd.h:256
int vlabel_changed
Definition: fdasd.h:232
config_data_t confdata[USABLE_PARTITIONS]
Definition: fdasd.h:255
format7_label_t * f7
Definition: fdasd.h:250
int auto_partition
Definition: fdasd.h:234
format9_label_t * f9
Definition: fdasd.h:251
partition_info_t * first
Definition: fdasd.h:252
unsigned int blksize
Definition: fdasd.h:246
int option_recreate
Definition: fdasd.h:241
unsigned long fspace_trk
Definition: fdasd.h:247
Definition: vtoc.h:51
Definition: fdasd.h:153
int intensity
Definition: fdasd.h:157
int blksize
Definition: fdasd.h:156
int start_unit
Definition: fdasd.h:154
int stop_unit
Definition: fdasd.h:155
Definition: fdasd.h:214
struct partition_info * next
Definition: fdasd.h:221
unsigned long fspace_trk
Definition: fdasd.h:219
u_int8_t type
Definition: fdasd.h:223
format1_label_t * f1
Definition: fdasd.h:220
u_int8_t used
Definition: fdasd.h:215
struct partition_info * prev
Definition: fdasd.h:222
unsigned long start_trk
Definition: fdasd.h:216
unsigned long end_trk
Definition: fdasd.h:217
unsigned long len_trk
Definition: fdasd.h:218
struct volume_label volume_label_t
Definition: vtoc.h:63
struct format7_label format7_label_t
Definition: vtoc.h:72
struct format4_label format4_label_t
Definition: vtoc.h:68
struct format1_label format1_label_t
Definition: vtoc.h:67
struct format9_label format9_label_t
Definition: vtoc.h:73
struct format5_label format5_label_t
Definition: vtoc.h:70