tape_class.h 1.6 KB

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