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 * Copyright IBM Corp. 2001,2007
11 /*****************************************************************************
12 * SECTION: Definitions needed for DASD-API (see dasd.h) *
13 *****************************************************************************/
15 #define DASD_IOCTL_LETTER 'D'
17 #define DASD_PARTN_BITS 2
20 * struct dasd_information_t
21 * represents any data about the device, which is visible to userspace.
22 * including foramt and featueres.
24 typedef struct dasd_information_t
{
25 unsigned int devno
; /* S/390 devno */
26 unsigned int real_devno
; /* for aliases */
27 unsigned int schid
; /* S/390 subchannel identifier */
28 unsigned int cu_type
: 16; /* from SenseID */
29 unsigned int cu_model
: 8; /* from SenseID */
30 unsigned int dev_type
: 16; /* from SenseID */
31 unsigned int dev_model
: 8; /* from SenseID */
32 unsigned int open_count
;
33 unsigned int req_queue_len
;
34 unsigned int chanq_len
; /* length of chanq */
35 char type
[4]; /* from discipline.name, 'none' for */
37 unsigned int status
; /* current device level */
38 unsigned int label_block
; /* where to find the VOLSER */
39 unsigned int FBA_layout
; /* fixed block size (like AIXVOL) */
40 unsigned int characteristics_size
;
41 unsigned int confdata_size
;
42 char characteristics
[64]; /* from read_device_characteristics */
43 char configuration_data
[256]; /* from read_configuration_data */
46 /* Get information on a dasd device (enhanced) */
47 #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
50 /*****************************************************************************
51 * SECTION: Further IOCTL Definitions (see fs.h and hdreq.h) *
52 *****************************************************************************/
53 #define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
54 #define BLKRRPART _IO(0x12,95) /* re-read partition table */
55 #define BLKSSZGET _IO(0x12,104)/* get block device sector size */
56 #define BLKGETSIZE64 _IOR(0x12,114,size_t) /* device size in bytes (u64 *arg)*/
58 /* get device geometry */
59 #define HDIO_GETGEO 0x0301
61 /*****************************************************************************
62 * SECTION: FDASD internal types *
63 *****************************************************************************/
65 #define DEFAULT_FDASD_CONF "/etc/fdasd.conf" /* default config file */
67 #define PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
68 #define USABLE_PARTITIONS ((1 << DASD_PARTN_BITS) - 1)
70 #define FDASD_ERROR "fdasd error: "
71 #define DEVICE "device"
75 #define ALTERNATE_CYLINDERS_USED 0x10
77 static struct option fdasd_long_options
[] = {
78 { "version", no_argument
, NULL
, 'v'},
79 { "auto", no_argument
, NULL
, 'a'},
80 { "silent", no_argument
, NULL
, 's'},
81 { "verbose", no_argument
, NULL
, 'r'},
82 { "label", required_argument
, NULL
, 'l'},
83 { "config", required_argument
, NULL
, 'c'},
84 { "help", no_argument
, NULL
, 'h'},
85 { "table", no_argument
, NULL
, 'p'},
86 { "volser", no_argument
, NULL
, 'i'},
87 { "keep_volser", no_argument
, NULL
, 'k'},
91 /* Command line option abbreviations */
92 static const char option_string
[] = "vasrl:c:hpik";
94 struct fdasd_options
{
100 struct fdasd_options options
= {
106 typedef struct partition_info
{
108 unsigned long start_trk
;
109 unsigned long end_trk
;
110 unsigned long len_trk
;
111 unsigned long fspace_trk
;
113 struct partition_info
*next
;
114 struct partition_info
*prev
;
118 typedef struct config_data
{
124 typedef struct fdasd_anchor
{
137 int partno
[USABLE_PARTITIONS
];
139 unsigned int used_partitions
;
140 unsigned long label_pos
;
141 unsigned int blksize
;
142 unsigned long fspace_trk
;
146 format9_label_t
*f9
; /* template for all f9 labels */
147 partition_info_t
*first
;
148 partition_info_t
*last
;
149 volume_label_t
*vlabel
;
150 config_data_t confdata
[USABLE_PARTITIONS
];
151 u_int32_t hw_cylinders
;
152 u_int32_t formatted_cylinders
;
155 enum offset
{lower
, upper
};
171 device_verification_failed
,
175 #define ERROR_STRING_SIZE 1024
176 #define INPUT_BUF_SIZE 1024