aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.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-cd.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-cd.c')
-rw-r--r--drivers/ide/ide-cd.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index ad0ab0c0a493..b79ca419d8d9 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -30,6 +30,7 @@
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/seq_file.h>
33#include <linux/slab.h> 34#include <linux/slab.h>
34#include <linux/interrupt.h> 35#include <linux/interrupt.h>
35#include <linux/errno.h> 36#include <linux/errno.h>
@@ -1389,19 +1390,30 @@ static sector_t ide_cdrom_capacity(ide_drive_t *drive)
1389 return capacity * sectors_per_frame; 1390 return capacity * sectors_per_frame;
1390} 1391}
1391 1392
1392static int proc_idecd_read_capacity(char *page, char **start, off_t off, 1393static int idecd_capacity_proc_show(struct seq_file *m, void *v)
1393 int count, int *eof, void *data)
1394{ 1394{
1395 ide_drive_t *drive = data; 1395 ide_drive_t *drive = m->private;
1396 int len;
1397 1396
1398 len = sprintf(page, "%llu\n", (long long)ide_cdrom_capacity(drive)); 1397 seq_printf(m, "%llu\n", (long long)ide_cdrom_capacity(drive));
1399 PROC_IDE_READ_RETURN(page, start, off, count, eof, len); 1398 return 0;
1399}
1400
1401static int idecd_capacity_proc_open(struct inode *inode, struct file *file)
1402{
1403 return single_open(file, idecd_capacity_proc_show, PDE(inode)->data);
1400} 1404}
1401 1405
1406static const struct file_operations idecd_capacity_proc_fops = {
1407 .owner = THIS_MODULE,
1408 .open = idecd_capacity_proc_open,
1409 .read = seq_read,
1410 .llseek = seq_lseek,
1411 .release = single_release,
1412};
1413
1402static ide_proc_entry_t idecd_proc[] = { 1414static ide_proc_entry_t idecd_proc[] = {
1403 { "capacity", S_IFREG|S_IRUGO, proc_idecd_read_capacity, NULL }, 1415 { "capacity", S_IFREG|S_IRUGO, &idecd_capacity_proc_fops },
1404 { NULL, 0, NULL, NULL } 1416 {}
1405}; 1417};
1406 1418
1407static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive) 1419static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive)