Commit 2df5f2d5 authored by Hanna V. Linder's avatar Hanna V. Linder Committed by Greg Kroah-Hartman

[PATCH] add class support to floppy tape driver zftape-init.c

Here is a patch to add class support to zftape-init.c:

MODULE_DESCRIPTION(ZFTAPE_VERSION " - "
                   "VFS interface for the Linux floppy tape driver. "
                   "Support for QIC-113 compatible volume table "
                   "and builtin compression (lzrw3 algorithm)");

I have verified it compiles but do not have the hardware to test it.
parent 694b0b32
......@@ -38,6 +38,7 @@
#include <linux/zftape.h>
#include <linux/init.h>
#include <linux/device.h>
#include "../zftape/zftape-init.h"
#include "../zftape/zftape-read.h"
......@@ -103,6 +104,8 @@ static struct file_operations zft_cdev =
.release = zft_close,
};
static struct class_simple *zft_class;
/* Open floppy tape device
*/
static int zft_open(struct inode *ino, struct file *filep)
......@@ -341,22 +344,29 @@ KERN_INFO
"installing zftape VFS interface for ftape driver ...");
TRACE_CATCH(register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),);
zft_class = class_simple_create(THIS_MODULE, "zft");
for (i = 0; i < 4; i++) {
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i),
S_IFCHR | S_IRUSR | S_IWUSR,
"qft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 4),
S_IFCHR | S_IRUSR | S_IWUSR,
"nqft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 16),
S_IFCHR | S_IRUSR | S_IWUSR,
"zqft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 20),
S_IFCHR | S_IRUSR | S_IWUSR,
"nzqft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 32),
S_IFCHR | S_IRUSR | S_IWUSR,
"rawqft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 36),
S_IFCHR | S_IRUSR | S_IWUSR,
"nrawqft%i", i);
......@@ -386,12 +396,19 @@ static void zft_exit(void)
}
for (i = 0; i < 4; i++) {
devfs_remove("qft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i));
devfs_remove("nqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 4));
devfs_remove("zqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 16));
devfs_remove("nzqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 20));
devfs_remove("rawqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 32));
devfs_remove("nrawqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 36));
}
class_simple_destroy(zft_class);
zft_uninit_mem(); /* release remaining memory, if any */
printk(KERN_INFO "zftape successfully unloaded.\n");
TRACE_EXIT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment