diff options
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 7b2032bc357b..9d6f62baac27 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/major.h> | 31 | #include <linux/major.h> |
32 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
33 | #include <linux/genhd.h> | 33 | #include <linux/genhd.h> |
34 | #include <linux/seq_file.h> | ||
34 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
35 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
36 | #include <linux/ide.h> | 37 | #include <linux/ide.h> |
@@ -1816,22 +1817,32 @@ static void ide_tape_release(struct device *dev) | |||
1816 | } | 1817 | } |
1817 | 1818 | ||
1818 | #ifdef CONFIG_IDE_PROC_FS | 1819 | #ifdef CONFIG_IDE_PROC_FS |
1819 | static int proc_idetape_read_name | 1820 | static int idetape_name_proc_show(struct seq_file *m, void *v) |
1820 | (char *page, char **start, off_t off, int count, int *eof, void *data) | ||
1821 | { | 1821 | { |
1822 | ide_drive_t *drive = (ide_drive_t *) data; | 1822 | ide_drive_t *drive = (ide_drive_t *) m->private; |
1823 | idetape_tape_t *tape = drive->driver_data; | 1823 | idetape_tape_t *tape = drive->driver_data; |
1824 | char *out = page; | ||
1825 | int len; | ||
1826 | 1824 | ||
1827 | len = sprintf(out, "%s\n", tape->name); | 1825 | seq_printf(m, "%s\n", tape->name); |
1828 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); | 1826 | return 0; |
1827 | } | ||
1828 | |||
1829 | static int idetape_name_proc_open(struct inode *inode, struct file *file) | ||
1830 | { | ||
1831 | return single_open(file, idetape_name_proc_show, PDE(inode)->data); | ||
1829 | } | 1832 | } |
1830 | 1833 | ||
1834 | static const struct file_operations idetape_name_proc_fops = { | ||
1835 | .owner = THIS_MODULE, | ||
1836 | .open = idetape_name_proc_open, | ||
1837 | .read = seq_read, | ||
1838 | .llseek = seq_lseek, | ||
1839 | .release = single_release, | ||
1840 | }; | ||
1841 | |||
1831 | static ide_proc_entry_t idetape_proc[] = { | 1842 | static ide_proc_entry_t idetape_proc[] = { |
1832 | { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL }, | 1843 | { "capacity", S_IFREG|S_IRUGO, &ide_capacity_proc_fops }, |
1833 | { "name", S_IFREG|S_IRUGO, proc_idetape_read_name, NULL }, | 1844 | { "name", S_IFREG|S_IRUGO, &idetape_name_proc_fops }, |
1834 | { NULL, 0, NULL, NULL } | 1845 | {} |
1835 | }; | 1846 | }; |
1836 | 1847 | ||
1837 | static ide_proc_entry_t *ide_tape_proc_entries(ide_drive_t *drive) | 1848 | static ide_proc_entry_t *ide_tape_proc_entries(ide_drive_t *drive) |