Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 2 | * Copyright IBM Corp. 2004 All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Tape class device support |
| 5 | * |
| 6 | * Author: Stefan Bader <shbader@de.ibm.com> |
| 7 | * Based on simple class device code by Greg K-H |
| 8 | */ |
| 9 | #ifndef __TAPE_CLASS_H__ |
| 10 | #define __TAPE_CLASS_H__ |
| 11 | |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/module.h> |
| 14 | #include <linux/fs.h> |
| 15 | #include <linux/major.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/cdev.h> |
| 17 | |
| 18 | #include <linux/device.h> |
| 19 | #include <linux/kdev_t.h> |
| 20 | |
| 21 | #define TAPECLASS_NAME_LEN 32 |
| 22 | |
| 23 | struct tape_class_device { |
Cornelia Huck | 7f021ce | 2007-10-22 12:52:42 +0200 | [diff] [blame] | 24 | struct cdev *char_device; |
| 25 | struct device *class_device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | char device_name[TAPECLASS_NAME_LEN]; |
| 27 | char mode_name[TAPECLASS_NAME_LEN]; |
| 28 | }; |
| 29 | |
| 30 | /* |
| 31 | * Register a tape device and return a pointer to the tape class device |
| 32 | * created by the call. |
| 33 | * |
| 34 | * device |
| 35 | * The pointer to the struct device of the physical (base) device. |
| 36 | * dev |
| 37 | * The intended major/minor number. The major number may be 0 to |
| 38 | * get a dynamic major number. |
| 39 | * fops |
| 40 | * The pointer to the drivers file operations for the tape device. |
| 41 | * device_name |
| 42 | * Pointer to the logical device name (will also be used as kobject name |
| 43 | * of the cdev). This can also be called the name of the tape class |
| 44 | * device. |
| 45 | * mode_name |
| 46 | * Points to the name of the tape mode. This creates a link with that |
| 47 | * name from the physical device to the logical device (class). |
| 48 | */ |
| 49 | struct tape_class_device *register_tape_dev( |
| 50 | struct device * device, |
| 51 | dev_t dev, |
Arjan van de Ven | 9c2e08c | 2007-02-12 00:55:37 -0800 | [diff] [blame] | 52 | const struct file_operations *fops, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | char * device_name, |
| 54 | char * node_name |
| 55 | ); |
Michael Holzheu | 92bf435 | 2008-04-17 07:46:05 +0200 | [diff] [blame] | 56 | void unregister_tape_dev(struct device *device, struct tape_class_device *tcd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
| 58 | #endif /* __TAPE_CLASS_H__ */ |