blob: 9e32780c317f39e7f7d0cb3a7296b8292ebbc699 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * (C) Copyright IBM Corp. 2004 All Rights Reserved.
Heiko Carstense018ba12006-02-01 03:06:31 -08003 * tape_class.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 * Tape class device support
6 *
7 * Author: Stefan Bader <shbader@de.ibm.com>
8 * Based on simple class device code by Greg K-H
9 */
10#ifndef __TAPE_CLASS_H__
11#define __TAPE_CLASS_H__
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/fs.h>
16#include <linux/major.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <linux/kobj_map.h>
18#include <linux/cdev.h>
19
20#include <linux/device.h>
21#include <linux/kdev_t.h>
22
23#define TAPECLASS_NAME_LEN 32
24
25struct tape_class_device {
Cornelia Huck7f021ce2007-10-22 12:52:42 +020026 struct cdev *char_device;
27 struct device *class_device;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 char device_name[TAPECLASS_NAME_LEN];
29 char mode_name[TAPECLASS_NAME_LEN];
30};
31
32/*
33 * Register a tape device and return a pointer to the tape class device
34 * created by the call.
35 *
36 * device
37 * The pointer to the struct device of the physical (base) device.
38 * dev
39 * The intended major/minor number. The major number may be 0 to
40 * get a dynamic major number.
41 * fops
42 * The pointer to the drivers file operations for the tape device.
43 * device_name
44 * Pointer to the logical device name (will also be used as kobject name
45 * of the cdev). This can also be called the name of the tape class
46 * device.
47 * mode_name
48 * Points to the name of the tape mode. This creates a link with that
49 * name from the physical device to the logical device (class).
50 */
51struct tape_class_device *register_tape_dev(
52 struct device * device,
53 dev_t dev,
Arjan van de Ven9c2e08c2007-02-12 00:55:37 -080054 const struct file_operations *fops,
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 char * device_name,
56 char * node_name
57);
Michael Holzheu92bf4352008-04-17 07:46:05 +020058void unregister_tape_dev(struct device *device, struct tape_class_device *tcd);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60#endif /* __TAPE_CLASS_H__ */