5 #include <linux/kernel.h>
7 #include <linux/cdrom.h>
10 #include <asm/unaligned.h>
36 static int ide_floppy_get_format_capacities(
ide_drive_t *drive,
48 if (u_array_size <= 0)
58 header_len = pc_buf[3];
59 desc_cnt = header_len / 8;
69 for (i = 1; i < desc_cnt; i++) {
70 unsigned int desc_start = 4 + i*8;
72 if (u_index >= u_array_size)
97 static void ide_floppy_create_format_unit_cmd(
struct ide_atapi_pc *pc,
132 if (buf[8 + 2] & 0x40)
175 ide_floppy_get_sfrp_bit(drive, pc);
176 ide_floppy_create_format_unit_cmd(pc, buf, blocks, length, flags);
197 static int ide_floppy_get_format_progress(
ide_drive_t *drive,
223 stat = hwif->
tp_ops->read_status(hwif);
226 progress_indication = ((stat &
ATA_DSC) == 0) ? 0 : 0x10000;
229 if (
put_user(progress_indication, arg))
236 unsigned long arg,
unsigned int cmd)
239 struct gendisk *disk = floppy->
disk;
240 int prevent = (arg && cmd !=
CDROMEJECT) ? 1 : 0;
258 case IDEFLOPPY_IOCTL_FORMAT_SUPPORTED:
260 case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY:
261 return ide_floppy_get_format_capacities(drive, pc, argp);
262 case IDEFLOPPY_IOCTL_FORMAT_START:
265 return ide_floppy_format_unit(drive, pc, (
int __user *)argp);
266 case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
267 return ide_floppy_get_format_progress(drive, pc, argp);
274 fmode_t mode,
unsigned int cmd,
unsigned long arg)
282 err = ide_floppy_lockdoor(drive, &pc, arg, cmd);
286 err = ide_floppy_format_ioctl(drive, &pc, mode, cmd, argp);