Use FD_RAW_CMD_SIZE, FD_RAW_REPLY_SIZE defines instead of magic numbers for cmd & reply buffers of struct floppy_raw_cmd. Remove local to floppy.c MAX_REPLIES define, as it is now FD_RAW_REPLY_SIZE. FD_RAW_CMD_FULLSIZE added as we allow command to also fill reply_count and reply fields.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -360,10 +360,20 @@ struct floppy_raw_cmd { · 359 unmodified lines | ||
| 360 | 360 | int buffer_length; /* length of allocated buffer */ |
| 361 | 361 | |
| 362 | 362 | unsigned char rate; |
| 363 | + | |
| 364 | +#define FD_RAW_CMD_SIZE 16 | |
| 365 | +#define FD_RAW_REPLY_SIZE 16 | |
| 366 | +#define FD_RAW_CMD_FULLSIZE (FD_RAW_CMD_SIZE + 1 + FD_RAW_REPLY_SIZE) | |
| 367 | + | |
| 368 | + /* The command may take up the space initially intended for the reply | |
| 369 | + * and the reply count. Needed for long 82078 commands such as RESTORE, | |
| 370 | + * which takes 17 command bytes. | |
| 371 | + */ | |
| 372 | + | |
| 363 | 373 | unsigned char cmd_count; |
| 364 | − unsigned char cmd[16]; | |
| 374 | + unsigned char cmd[FD_RAW_CMD_SIZE]; | |
| 365 | 375 | unsigned char reply_count; |
| 366 | − unsigned char reply[16]; | |
| 376 | + unsigned char reply[FD_RAW_REPLY_SIZE]; | |
| 367 | 377 | int track; |
| 368 | 378 | int resultcode; |
| 369 | 379 | |