Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright IBM Corp. 2004   All Rights Reserved.
0004  *
0005  * Tape class device support
0006  *
0007  * Author: Stefan Bader <shbader@de.ibm.com>
0008  * Based on simple class device code by Greg K-H
0009  */
0010 #ifndef __TAPE_CLASS_H__
0011 #define __TAPE_CLASS_H__
0012 
0013 #include <linux/init.h>
0014 #include <linux/module.h>
0015 #include <linux/fs.h>
0016 #include <linux/major.h>
0017 #include <linux/cdev.h>
0018 
0019 #include <linux/device.h>
0020 #include <linux/kdev_t.h>
0021 
0022 #define TAPECLASS_NAME_LEN  32
0023 
0024 struct tape_class_device {
0025     struct cdev     *char_device;
0026     struct device       *class_device;
0027     char            device_name[TAPECLASS_NAME_LEN];
0028     char            mode_name[TAPECLASS_NAME_LEN];
0029 };
0030 
0031 /*
0032  * Register a tape device and return a pointer to the tape class device
0033  * created by the call.
0034  *
0035  * device
0036  *  The pointer to the struct device of the physical (base) device.
0037  * dev
0038  *  The intended major/minor number. The major number may be 0 to
0039  *  get a dynamic major number.
0040  * fops
0041  *  The pointer to the drivers file operations for the tape device.
0042  * device_name
0043  *  Pointer to the logical device name (will also be used as kobject name
0044  *  of the cdev). This can also be called the name of the tape class
0045  *  device.
0046  * mode_name
0047  *  Points to the name of the tape mode. This creates a link with that
0048  *  name from the physical device to the logical device (class).
0049  */
0050 struct tape_class_device *register_tape_dev(
0051     struct device *     device,
0052     dev_t           dev,
0053     const struct file_operations *fops,
0054     char *          device_name,
0055     char *          node_name
0056 );
0057 void unregister_tape_dev(struct device *device, struct tape_class_device *tcd);
0058 
0059 #endif /* __TAPE_CLASS_H__ */