224-atm_hotplug.patch 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. diff -urN linux.old/include/linux/atmdev.h linux.dev/include/linux/atmdev.h
  2. --- linux.old/include/linux/atmdev.h 2005-11-17 12:51:55.883585000 +0100
  3. +++ linux.dev/include/linux/atmdev.h 2005-11-17 13:49:22.012671000 +0100
  4. @@ -408,6 +408,7 @@
  5. struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
  6. int number,atm_dev_flags_t *flags); /* number == -1: pick first available */
  7. struct atm_dev *atm_dev_lookup(int number);
  8. +void atm_dev_set_link_status(struct atm_dev *dev, int status);
  9. void atm_dev_deregister(struct atm_dev *dev);
  10. void shutdown_atm_dev(struct atm_dev *dev);
  11. void vcc_insert_socket(struct sock *sk);
  12. diff -urN linux.old/net/atm/resources.c linux.dev/net/atm/resources.c
  13. --- linux.old/net/atm/resources.c 2003-11-28 19:26:21.000000000 +0100
  14. +++ linux.dev/net/atm/resources.c 2005-11-17 14:27:26.514267750 +0100
  15. @@ -10,6 +10,7 @@
  16. #include <linux/sonet.h>
  17. #include <linux/kernel.h> /* for barrier */
  18. #include <linux/module.h>
  19. +#include <linux/kmod.h>
  20. #include <linux/bitops.h>
  21. #include <net/sock.h> /* for struct sock */
  22. #include <asm/segment.h> /* for get_fs_long and put_fs_long */
  23. @@ -70,6 +71,44 @@
  24. return dev;
  25. }
  26. +#ifdef CONFIG_HOTPLUG
  27. +static void atm_run_sbin_hotplug(struct atm_dev *dev, char *action)
  28. +{
  29. + char *argv[3], *envp[5], ifname[12 + IFNAMSIZ], atmname[255], action_str[32];
  30. + int i;
  31. +
  32. + sprintf(ifname, "INTERFACE=atm%d", dev->number);
  33. + sprintf(atmname, "ATMDRIVER=%s", dev->type);
  34. + sprintf(action_str, "ACTION=%s", action);
  35. +
  36. + i = 0;
  37. + argv[i++] = hotplug_path;
  38. + argv[i++] = "net";
  39. + argv[i] = 0;
  40. +
  41. + i = 0;
  42. + /* minimal command environment */
  43. + envp [i++] = "HOME=/";
  44. + envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
  45. + envp [i++] = ifname;
  46. + envp [i++] = atmname;
  47. + envp [i++] = action_str;
  48. + envp [i] = 0;
  49. +
  50. + return call_usermodehelper(argv [0], argv, envp);
  51. +}
  52. +#endif
  53. +
  54. +void atm_dev_set_link_status(struct atm_dev *dev, int status)
  55. +{
  56. +#ifdef CONFIG_HOTPLUG
  57. + if (status)
  58. + atm_run_sbin_hotplug(dev, "up");
  59. + else
  60. + atm_run_sbin_hotplug(dev, "down");
  61. +#endif
  62. +}
  63. +
  64. struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
  65. int number, atm_dev_flags_t *flags)
  66. {
  67. @@ -123,7 +162,10 @@
  68. }
  69. }
  70. #endif
  71. -
  72. +#ifdef CONFIG_HOTPLUG
  73. + atm_run_sbin_hotplug(dev, "register");
  74. +#endif
  75. +
  76. return dev;
  77. }
  78. @@ -131,6 +173,10 @@
  79. void atm_dev_deregister(struct atm_dev *dev)
  80. {
  81. unsigned long warning_time;
  82. +
  83. +#ifdef CONFIG_HOTPLUG
  84. + atm_run_sbin_hotplug(dev, "unregister");
  85. +#endif
  86. #ifdef CONFIG_PROC_FS
  87. if (dev->ops->proc_read)
  88. @@ -399,6 +445,7 @@
  89. }
  90. +EXPORT_SYMBOL(atm_dev_set_link_status);
  91. EXPORT_SYMBOL(atm_dev_register);
  92. EXPORT_SYMBOL(atm_dev_deregister);
  93. EXPORT_SYMBOL(atm_dev_lookup);