config-osm.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Configuration OSM
  3. *
  4. * Copyright (C) 2005 Markus Lidel <Markus.Lidel@shadowconnect.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. *
  11. * Fixes/additions:
  12. * Markus Lidel <Markus.Lidel@shadowconnect.com>
  13. * initial version.
  14. */
  15. #include <linux/module.h>
  16. #include <linux/i2o.h>
  17. #include <linux/dcache.h>
  18. #include <linux/namei.h>
  19. #include <linux/fs.h>
  20. #include <asm/uaccess.h>
  21. #define OSM_NAME "config-osm"
  22. #define OSM_VERSION "1.323"
  23. #define OSM_DESCRIPTION "I2O Configuration OSM"
  24. /* access mode user rw */
  25. #define S_IWRSR (S_IRUSR | S_IWUSR)
  26. static struct i2o_driver i2o_config_driver;
  27. /* Config OSM driver struct */
  28. static struct i2o_driver i2o_config_driver = {
  29. .name = OSM_NAME,
  30. };
  31. #ifdef CONFIG_I2O_CONFIG_OLD_IOCTL
  32. #include "i2o_config.c"
  33. #endif
  34. /**
  35. * i2o_config_init - Configuration OSM initialization function
  36. *
  37. * Registers Configuration OSM in the I2O core and if old ioctl's are
  38. * compiled in initialize them.
  39. *
  40. * Returns 0 on success or negative error code on failure.
  41. */
  42. static int __init i2o_config_init(void)
  43. {
  44. printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
  45. if (i2o_driver_register(&i2o_config_driver)) {
  46. osm_err("handler register failed.\n");
  47. return -EBUSY;
  48. }
  49. #ifdef CONFIG_I2O_CONFIG_OLD_IOCTL
  50. if (i2o_config_old_init()) {
  51. osm_err("old config handler initialization failed\n");
  52. i2o_driver_unregister(&i2o_config_driver);
  53. return -EBUSY;
  54. }
  55. #endif
  56. return 0;
  57. }
  58. /**
  59. * i2o_config_exit - Configuration OSM exit function
  60. *
  61. * If old ioctl's are compiled in exit remove them and unregisters
  62. * Configuration OSM from I2O core.
  63. */
  64. static void i2o_config_exit(void)
  65. {
  66. #ifdef CONFIG_I2O_CONFIG_OLD_IOCTL
  67. i2o_config_old_exit();
  68. #endif
  69. i2o_driver_unregister(&i2o_config_driver);
  70. }
  71. MODULE_AUTHOR("Markus Lidel <Markus.Lidel@shadowconnect.com>");
  72. MODULE_LICENSE("GPL");
  73. MODULE_DESCRIPTION(OSM_DESCRIPTION);
  74. MODULE_VERSION(OSM_VERSION);
  75. module_init(i2o_config_init);
  76. module_exit(i2o_config_exit);