#49 Incorrect definition of struct hdio_taskfile

closed-fixed
nobody
None
5
2012-09-28
2011-09-17
Andrey Ivanov
No

The following code:

printf("sizeof(ide_task_request_t) = %d\n", sizeof(ide_task_request_t));
printf("io_ports = %d\n", offsetof(ide_task_request_t, io_ports));
printf("hob_ports = %d\n", offsetof(ide_task_request_t, hob_ports));
printf("out_flags = %d\n", offsetof(ide_task_request_t, out_flags));
printf("in_flags = %d\n", offsetof(ide_task_request_t, in_flags));
printf("data_phase = %d\n", offsetof(ide_task_request_t, data_phase));
printf("req_cmd = %d\n", offsetof(ide_task_request_t, req_cmd));
printf("out_size = %d\n", offsetof(ide_task_request_t, out_size));
printf("in_size = %d\n", offsetof(ide_task_request_t, in_size));

printf("sizeof(struct hdio_taskfile) = %d\n", sizeof(struct hdio_taskfile));
printf("lob = %d\n", offsetof(struct hdio_taskfile, lob));
printf("hob = %d\n", offsetof(struct hdio_taskfile, hob));
printf("oflags = %d\n", offsetof(struct hdio_taskfile, oflags));
printf("iflags = %d\n", offsetof(struct hdio_taskfile, iflags));
printf("dphase = %d\n", offsetof(struct hdio_taskfile, dphase));
printf("cmd_req = %d\n", offsetof(struct hdio_taskfile, cmd_req));
printf("obytes = %d\n", offsetof(struct hdio_taskfile, obytes));
printf("ibytes = %d\n", offsetof(struct hdio_taskfile, ibytes));

produces the following result:

sizeof(ide_task_request_t) = 40
io_ports = 0
hob_ports = 8
out_flags = 16
in_flags = 20
data_phase = 24
req_cmd = 28
out_size = 32
in_size = 36
sizeof(struct hdio_taskfile) = 48
lob = 0
hob = 8
oflags = 16
iflags = 24
dphase = 32
cmd_req = 36
obytes = 40
ibytes = 44

ide_task_request_t and struct hdio_taskfile have different sizes/ It is because fileds of out_flags anf in_flags struct hdio_taskfile have incorrect sizes.
ioctl(HDIO_DRIVE_TASKFILE) doesn't work because of this bug.

Related

Bugs: #59

Discussion

  • Mark Lord
    Mark Lord
    2012-09-28

    • status: open --> closed-fixed
     
  • Mark Lord
    Mark Lord
    2012-09-28

    Ugh. Fixed (again). I hope.