blob: d25ac075b1adca690bc013014d84ceb62f060025 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Heiko Carstensa53c8fa2012-07-20 11:15:04 +02003 * Copyright IBM Corp. 2004 All Rights Reserved.
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/cdev.h>
18
19#include <linux/device.h>
20#include <linux/kdev_t.h>
21
22#define TAPECLASS_NAME_LEN 32
23
24struct tape_class_device {
Cornelia Huck7f021ce2007-10-22 12:52:42 +020025 struct cdev *char_device;
26 struct device *class_device;
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 char device_name[TAPECLASS_NAME_LEN];
28 char mode_name[TAPECLASS_NAME_LEN];
29};
30
31/*
32 * Register a tape device and return a pointer to the tape class device
33 * created by the call.
34 *
35 * device
36 * The pointer to the struct device of the physical (base) device.
37 * dev
38 * The intended major/minor number. The major number may be 0 to
39 * get a dynamic major number.
40 * fops
41 * The pointer to the drivers file operations for the tape device.
42 * device_name
43 * Pointer to the logical device name (will also be used as kobject name
44 * of the cdev). This can also be called the name of the tape class
45 * device.
46 * mode_name
47 * Points to the name of the tape mode. This creates a link with that
48 * name from the physical device to the logical device (class).
49 */
50struct tape_class_device *register_tape_dev(
51 struct device * device,
52 dev_t dev,
Arjan van de Ven9c2e08c2007-02-12 00:55:37 -080053 const struct file_operations *fops,
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 char * device_name,
55 char * node_name
56);
Michael Holzheu92bf4352008-04-17 07:46:05 +020057void unregister_tape_dev(struct device *device, struct tape_class_device *tcd);
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
59#endif /* __TAPE_CLASS_H__ */