ContainerTracer  0.1
hdparm.h
Go to the documentation of this file.
1 /* Some prototypes for extern functions. */
2 
3 #include <linux/types.h>
4 
5 #if !defined(__GNUC__) && !defined(__attribute__)
6 #define __attribute__(x)
7 compiler -
8  advice feature.*/
9 #endif
10 
11  /* identify() is the only extern function used across two source files. The
12  others, though, were declared in hdparm.c with global scope; since other
13  functions in that file have static (file) scope, I assume the difference is
14  intentional. */
15  extern void identify(__u16 *id_supplied);
16 
17 extern void usage_error(int out) __attribute__((noreturn));
18 extern int main(int argc, char **argv) __attribute__((noreturn));
19 extern void flush_buffer_cache(int fd);
20 extern int seek_to_zero(int fd);
21 extern int read_big_block(int fd, char *buf);
22 extern void time_cache(int fd);
23 extern void time_device(int fd);
24 extern void no_scsi(void);
25 extern void no_xt(void);
26 extern void process_dev(char *devname);
27 
29  unsigned char heads;
30  unsigned char sectors;
31  unsigned int cylinders;
32  unsigned long start;
33 };
34 
35 struct hd_geometry {
36  unsigned char heads;
37  unsigned char sectors;
38  unsigned short cylinders;
39  unsigned long start;
40 };
41 
42 enum { ATA_OP_CHECKPOWERMODE1 = 0xe5,
60  ATA_OP_SMART = 0xb0,
63 };
64 
65 enum { /* ioctl() numbers */
66  HDIO_DRIVE_CMD = 0x031f,
67  HDIO_DRIVE_RESET = 0x031c,
68  HDIO_DRIVE_TASK = 0x031e,
70  HDIO_GETGEO = 0x0301,
71  HDIO_GETGEO_BIG = 0x0330,
72  HDIO_GET_32BIT = 0x0309,
75  HDIO_GET_DMA = 0x030b,
79  HDIO_GET_NOWERR = 0x030a,
80  HDIO_GET_QDMA = 0x0305,
83  HDIO_SCAN_HWIF = 0x0328,
84  HDIO_SET_32BIT = 0x0324,
87  HDIO_SET_DMA = 0x0326,
90  HDIO_SET_NOWERR = 0x0325,
92  HDIO_SET_QDMA = 0x032e,
94  HDIO_SET_WCACHE = 0x032b,
97  CDROM__SPEED = 0x5322,
98 };
99 
100 /*
101  * Definitions and structures for use with SG_IO + ATA_16:
102  */
103 struct ata_lba_regs {
109 };
110 struct ata_tf {
116  struct ata_lba_regs lob;
117  struct ata_lba_regs hob;
118 };
119 
120 /*
121  * Definitions and structures for use with HDIO_DRIVE_TASKFILE:
122  */
123 
124 enum {
125  /*
126  * These (redundantly) specify the category of the request
127  */
128  TASKFILE_CMD_REQ_NODATA = 0, /* ide: IDE_DRIVE_TASK_NO_DATA */
129  TASKFILE_CMD_REQ_IN = 2, /* ide: IDE_DRIVE_TASK_IN */
130  TASKFILE_CMD_REQ_OUT = 3, /* ide: IDE_DRIVE_TASK_OUT */
131  /*
132  * These specify the method of transfer (pio, dma, multi, ..)
133  */
134  TASKFILE_XFER_METHOD_NONE = 0, /* ide: TASKFILE_IN */
135  TASKFILE_XFER_METHOD_PIO_IN = 1, /* ide: TASKFILE_IN */
136  TASKFILE_XFER_METHOD_PIO_OUT = 4, /* ide: TASKFILE_OUT */
137 };
138 
139 struct reg_flags {
140  unsigned data : 1;
141  unsigned feat : 1;
142  unsigned lbal : 1;
143  unsigned nsect : 1;
144  unsigned lbam : 1;
145  unsigned lbah : 1;
146  unsigned dev : 1;
147  unsigned command : 1;
148 };
149 
151  struct reg_flags lob;
152  struct reg_flags hob;
153 };
154 
164 };
165 
167  struct taskfile_regs lob;
168  struct taskfile_regs hob;
169  struct taskfile_flags out_flags;
170  struct taskfile_flags in_flags;
172  int cmd_req;
173  unsigned long out_bytes;
174  unsigned long in_bytes;
175  char data[0];
176 };
177 
178 void tf_init(struct ata_tf *tf, __u8 ata_op, __u64 lba, unsigned int nsect);
179 __u64 tf_to_lba(struct ata_tf *tf);
180 int sg16(int fd, int rw, struct ata_tf *tf, void *data, unsigned int data_bytes,
181  unsigned int timeout_secs);
182 int do_drive_cmd(int fd, unsigned char *args);
183 int do_taskfile_cmd(int fd, struct hdio_taskfile *r, unsigned int timeout_secs);
184 int dev_has_sgio(int fd);
Definition: hdparm.h:46
unsigned char heads
Definition: hdparm.h:36
Definition: hdparm.h:76
Definition: hdparm.h:94
__u64 tf_to_lba(struct ata_tf *tf)
Definition: sgio.c:88
Definition: hdparm.h:56
Definition: hdparm.h:96
unsigned lbah
Definition: hdparm.h:145
Definition: hdparm.h:45
__u8 error
Definition: hdparm.h:113
#define __attribute__(x)
Definition: hdparm.h:6
__u8 feat
Definition: hdparm.h:104
Definition: hdparm.h:61
Definition: hdparm.h:67
Definition: hdparm.h:71
__u8 command
Definition: hdparm.h:163
unsigned short cylinders
Definition: hdparm.h:38
__u8 lbal
Definition: hdparm.h:159
Definition: hdparm.h:48
__u8 dev
Definition: hdparm.h:111
Definition: hdparm.h:55
Definition: hdparm.h:28
unsigned data
Definition: hdparm.h:140
int xfer_method
Definition: hdparm.h:171
Definition: hdparm.h:103
Definition: hdparm.h:69
Definition: hdparm.h:57
__u8 lbam
Definition: hdparm.h:160
void no_scsi(void)
Definition: hdparm.h:47
Definition: hdparm.h:92
Definition: hdparm.h:130
unsigned feat
Definition: hdparm.h:141
Definition: hdparm.h:75
Definition: hdparm.h:93
__u8 is_lba48
Definition: hdparm.h:115
Definition: hdparm.h:74
unsigned long in_bytes
Definition: hdparm.h:174
Definition: hdparm.h:78
__u8 status
Definition: hdparm.h:114
Definition: hdparm.h:73
unsigned long start
Definition: hdparm.h:32
Definition: hdparm.h:50
Definition: hdparm.h:53
Definition: hdparm.h:42
Definition: hdparm.h:88
void no_xt(void)
Definition: hdparm.h:59
Definition: hdparm.h:150
Definition: hdparm.h:135
unsigned char sectors
Definition: hdparm.h:37
Definition: hdparm.h:60
__u8 feat
Definition: hdparm.h:157
unsigned char heads
Definition: hdparm.h:29
compiler advice feature *void identify(__u16 *id_supplied)
int dev_has_sgio(int fd)
int seek_to_zero(int fd)
Definition: hdparm.h:70
int cmd_req
Definition: hdparm.h:172
Definition: hdparm.h:72
unsigned dev
Definition: hdparm.h:146
Definition: hdparm.h:68
Definition: hdparm.h:139
void tf_init(struct ata_tf *tf, __u8 ata_op, __u64 lba, unsigned int nsect)
Definition: sgio.c:61
void time_device(int fd)
Definition: hdparm.h:77
Definition: hdparm.h:134
__u8 lbah
Definition: hdparm.h:161
Definition: hdparm.h:166
Definition: hdparm.h:110
__u8 lbam
Definition: hdparm.h:107
unsigned int cylinders
Definition: hdparm.h:31
unsigned long out_bytes
Definition: hdparm.h:173
void time_cache(int fd)
unsigned long long __u64
Definition: trace_replay.h:260
Definition: hdparm.h:128
__u8 command
Definition: hdparm.h:112
unsigned nsect
Definition: hdparm.h:143
Definition: hdparm.h:62
Definition: hdparm.h:44
unsigned command
Definition: hdparm.h:147
Definition: hdparm.h:91
Definition: hdparm.h:80
unsigned lbal
Definition: hdparm.h:142
Definition: hdparm.h:84
int do_taskfile_cmd(int fd, struct hdio_taskfile *r, unsigned int timeout_secs)
int read_big_block(int fd, char *buf)
Definition: hdparm.h:54
void process_dev(char *devname)
int sg16(int fd, int rw, struct ata_tf *tf, void *data, unsigned int data_bytes, unsigned int timeout_secs)
Definition: sgio.c:133
Definition: hdparm.h:35
Definition: hdparm.h:82
unsigned char __u8
Definition: trace_replay.h:255
Definition: hdparm.h:87
int main(int argc, char **argv) __attribute__((noreturn))
Definition: trace_replay.c:1296
__u8 lbal
Definition: hdparm.h:106
Definition: hdparm.h:81
__u8 data
Definition: hdparm.h:156
Definition: hdparm.h:49
Definition: hdparm.h:83
Definition: hdparm.h:43
Definition: hdparm.h:95
Definition: hdparm.h:79
int do_drive_cmd(int fd, unsigned char *args)
Definition: sgio.c:226
__u8 lbah
Definition: hdparm.h:108
Definition: hdparm.h:86
void usage_error(int out) __attribute__((noreturn))
unsigned long start
Definition: hdparm.h:39
unsigned short __u16
Definition: trace_replay.h:256
unsigned char sectors
Definition: hdparm.h:30
Definition: hdparm.h:136
Definition: hdparm.h:89
Definition: hdparm.h:85
void flush_buffer_cache(int fd)
Definition: disk_io.c:52
Definition: hdparm.h:51
__u8 nsect
Definition: hdparm.h:105
unsigned lbam
Definition: hdparm.h:144
Definition: hdparm.h:129
Definition: hdparm.h:155
Definition: hdparm.h:97
__u8 dev
Definition: hdparm.h:162
Definition: hdparm.h:66
Definition: hdparm.h:90
__u8 nsect
Definition: hdparm.h:158
Definition: hdparm.h:52
Definition: hdparm.h:58