aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy_proc.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-09-01 20:52:57 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-01 20:52:57 -0400
commit6d703a81ad5fdd102334751ddacb053ecc6ff046 (patch)
tree1bebde3a0c34677296dc4784e800445ea02b4f0a /drivers/ide/ide-floppy_proc.c
parent76fbebfbb593bd66780db0a808afe1d21c7ff6d6 (diff)
ide: convert to ->proc_fops
->read_proc, ->write_proc are going away, ->proc_fops should be used instead. The only tricky place is IDENTIFY handling: if for some reason taskfile_lib_get_identify() fails, buffer _is_ changed and at least first byte is overwritten. Emulate old behaviour with returning that first byte to userspace and reporting length=1 despite overall -E. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ide/ide-floppy_proc.c')
-rw-r--r--drivers/ide/ide-floppy_proc.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/ide/ide-floppy_proc.c b/drivers/ide/ide-floppy_proc.c
index fcd4d8153df5..d711d9b883de 100644
--- a/drivers/ide/ide-floppy_proc.c
+++ b/drivers/ide/ide-floppy_proc.c
@@ -1,22 +1,34 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/ide.h> 2#include <linux/ide.h>
3#include <linux/seq_file.h>
3 4
4#include "ide-floppy.h" 5#include "ide-floppy.h"
5 6
6static int proc_idefloppy_read_capacity(char *page, char **start, off_t off, 7static int idefloppy_capacity_proc_show(struct seq_file *m, void *v)
7 int count, int *eof, void *data)
8{ 8{
9 ide_drive_t*drive = (ide_drive_t *)data; 9 ide_drive_t*drive = (ide_drive_t *)m->private;
10 int len;
11 10
12 len = sprintf(page, "%llu\n", (long long)ide_gd_capacity(drive)); 11 seq_printf(m, "%llu\n", (long long)ide_gd_capacity(drive));
13 PROC_IDE_READ_RETURN(page, start, off, count, eof, len); 12 return 0;
14} 13}
15 14
15static int idefloppy_capacity_proc_open(struct inode *inode, struct file *file)
16{
17 return single_open(file, idefloppy_capacity_proc_show, PDE(inode)->data);
18}
19
20static const struct file_operations idefloppy_capacity_proc_fops = {
21 .owner = THIS_MODULE,
22 .open = idefloppy_capacity_proc_open,
23 .read = seq_read,
24 .llseek = seq_lseek,
25 .release = single_release,
26};
27
16ide_proc_entry_t ide_floppy_proc[] = { 28ide_proc_entry_t ide_floppy_proc[] = {
17 { "capacity", S_IFREG|S_IRUGO, proc_idefloppy_read_capacity, NULL }, 29 { "capacity", S_IFREG|S_IRUGO, &idefloppy_capacity_proc_fops },
18 { "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL }, 30 { "geometry", S_IFREG|S_IRUGO, &ide_geometry_proc_fops },
19 { NULL, 0, NULL, NULL } 31 {}
20}; 32};
21 33
22ide_devset_rw_field(bios_cyl, bios_cyl); 34ide_devset_rw_field(bios_cyl, bios_cyl);