History

floppy: add defines for sizes of cmd & reply buffers of floppy_raw_cmd

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.

Denis Efremov committed 6 years ago

Commit bd10a5f1 parent 9c4c5a22 files · +17 −16Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/fd.h+12−2
@@ -360,10 +360,20 @@ struct floppy_raw_cmd { · 359 unmodified lines
360360 int buffer_length; /* length of allocated buffer */
361361
362362 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+
363373 unsigned char cmd_count;
364− unsigned char cmd[16];
374+ unsigned char cmd[FD_RAW_CMD_SIZE];
365375 unsigned char reply_count;
366− unsigned char reply[16];
376+ unsigned char reply[FD_RAW_REPLY_SIZE];
367377 int track;
368378 int resultcode;
369379