rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | #include <linux/kernel.h> |
| 3 | #include <linux/export.h> |
| 4 | #include <linux/ide.h> |
| 5 | #include <linux/seq_file.h> |
| 6 | |
| 7 | #include "ide-floppy.h" |
| 8 | |
| 9 | static int idefloppy_capacity_proc_show(struct seq_file *m, void *v) |
| 10 | { |
| 11 | ide_drive_t*drive = (ide_drive_t *)m->private; |
| 12 | |
| 13 | seq_printf(m, "%llu\n", (long long)ide_gd_capacity(drive)); |
| 14 | return 0; |
| 15 | } |
| 16 | |
| 17 | static int idefloppy_capacity_proc_open(struct inode *inode, struct file *file) |
| 18 | { |
| 19 | return single_open(file, idefloppy_capacity_proc_show, PDE_DATA(inode)); |
| 20 | } |
| 21 | |
| 22 | static const struct file_operations idefloppy_capacity_proc_fops = { |
| 23 | .owner = THIS_MODULE, |
| 24 | .open = idefloppy_capacity_proc_open, |
| 25 | .read = seq_read, |
| 26 | .llseek = seq_lseek, |
| 27 | .release = single_release, |
| 28 | }; |
| 29 | |
| 30 | ide_proc_entry_t ide_floppy_proc[] = { |
| 31 | { "capacity", S_IFREG|S_IRUGO, &idefloppy_capacity_proc_fops }, |
| 32 | { "geometry", S_IFREG|S_IRUGO, &ide_geometry_proc_fops }, |
| 33 | {} |
| 34 | }; |
| 35 | |
| 36 | ide_devset_rw_field(bios_cyl, bios_cyl); |
| 37 | ide_devset_rw_field(bios_head, bios_head); |
| 38 | ide_devset_rw_field(bios_sect, bios_sect); |
| 39 | ide_devset_rw_field(ticks, pc_delay); |
| 40 | |
| 41 | const struct ide_proc_devset ide_floppy_settings[] = { |
| 42 | IDE_PROC_DEVSET(bios_cyl, 0, 1023), |
| 43 | IDE_PROC_DEVSET(bios_head, 0, 255), |
| 44 | IDE_PROC_DEVSET(bios_sect, 0, 63), |
| 45 | IDE_PROC_DEVSET(ticks, 0, 255), |
| 46 | { NULL }, |
| 47 | }; |