tape_class.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * (C) Copyright IBM Corp. 2004 All Rights Reserved.
  3. * tape_class.h
  4. *
  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. #include <linux/init.h>
  13. #include <linux/module.h>
  14. #include <linux/fs.h>
  15. #include <linux/major.h>
  16. #include <linux/kobj_map.h>
  17. #include <linux/cdev.h>
  18. #include <linux/device.h>
  19. #include <linux/kdev_t.h>
  20. #define TAPECLASS_NAME_LEN 32
  21. struct tape_class_device {
  22. struct cdev *char_device;
  23. struct device *class_device;
  24. char device_name[TAPECLASS_NAME_LEN];
  25. char mode_name[TAPECLASS_NAME_LEN];
  26. };
  27. /*
  28. * Register a tape device and return a pointer to the tape class device
  29. * created by the call.
  30. *
  31. * device
  32. * The pointer to the struct device of the physical (base) device.
  33. * dev
  34. * The intended major/minor number. The major number may be 0 to
  35. * get a dynamic major number.
  36. * fops
  37. * The pointer to the drivers file operations for the tape device.
  38. * device_name
  39. * Pointer to the logical device name (will also be used as kobject name
  40. * of the cdev). This can also be called the name of the tape class
  41. * device.
  42. * mode_name
  43. * Points to the name of the tape mode. This creates a link with that
  44. * name from the physical device to the logical device (class).
  45. */
  46. struct tape_class_device *register_tape_dev(
  47. struct device * device,
  48. dev_t dev,
  49. const struct file_operations *fops,
  50. char * device_name,
  51. char * node_name
  52. );
  53. void unregister_tape_dev(struct device *device, struct tape_class_device *tcd);
  54. #endif /* __TAPE_CLASS_H__ */