add patch for generating hotplug events on atm device create
SVN-Revision: 2532
This commit is contained in:
parent
733dc97762
commit
e152f61c48
1 changed files with 98 additions and 0 deletions
|
@ -0,0 +1,98 @@
|
|||
diff -urN linux.old/include/linux/atmdev.h linux.dev/include/linux/atmdev.h
|
||||
--- linux.old/include/linux/atmdev.h 2005-11-17 12:51:55.883585000 +0100
|
||||
+++ linux.dev/include/linux/atmdev.h 2005-11-17 13:49:22.012671000 +0100
|
||||
@@ -408,6 +408,7 @@
|
||||
struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
|
||||
int number,atm_dev_flags_t *flags); /* number == -1: pick first available */
|
||||
struct atm_dev *atm_dev_lookup(int number);
|
||||
+void atm_dev_set_link_status(struct atm_dev *dev, int status);
|
||||
void atm_dev_deregister(struct atm_dev *dev);
|
||||
void shutdown_atm_dev(struct atm_dev *dev);
|
||||
void vcc_insert_socket(struct sock *sk);
|
||||
diff -urN linux.old/net/atm/resources.c linux.dev/net/atm/resources.c
|
||||
--- linux.old/net/atm/resources.c 2003-11-28 19:26:21.000000000 +0100
|
||||
+++ linux.dev/net/atm/resources.c 2005-11-17 14:27:26.514267750 +0100
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <linux/sonet.h>
|
||||
#include <linux/kernel.h> /* for barrier */
|
||||
#include <linux/module.h>
|
||||
+#include <linux/kmod.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <net/sock.h> /* for struct sock */
|
||||
#include <asm/segment.h> /* for get_fs_long and put_fs_long */
|
||||
@@ -70,6 +71,44 @@
|
||||
return dev;
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_HOTPLUG
|
||||
+static void atm_run_sbin_hotplug(struct atm_dev *dev, char *action)
|
||||
+{
|
||||
+ char *argv[3], *envp[5], ifname[12 + IFNAMSIZ], atmname[255], action_str[32];
|
||||
+ int i;
|
||||
+
|
||||
+ sprintf(ifname, "INTERFACE=atm%d", dev->number);
|
||||
+ sprintf(atmname, "ATMDRIVER=%s", dev->type);
|
||||
+ sprintf(action_str, "ACTION=%s", action);
|
||||
+
|
||||
+ i = 0;
|
||||
+ argv[i++] = hotplug_path;
|
||||
+ argv[i++] = "net";
|
||||
+ argv[i] = 0;
|
||||
+
|
||||
+ i = 0;
|
||||
+ /* minimal command environment */
|
||||
+ envp [i++] = "HOME=/";
|
||||
+ envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
|
||||
+ envp [i++] = ifname;
|
||||
+ envp [i++] = atmname;
|
||||
+ envp [i++] = action_str;
|
||||
+ envp [i] = 0;
|
||||
+
|
||||
+ return call_usermodehelper(argv [0], argv, envp);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+void atm_dev_set_link_status(struct atm_dev *dev, int status)
|
||||
+{
|
||||
+#ifdef CONFIG_HOTPLUG
|
||||
+ if (status)
|
||||
+ atm_run_sbin_hotplug(dev, "up");
|
||||
+ else
|
||||
+ atm_run_sbin_hotplug(dev, "down");
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
|
||||
int number, atm_dev_flags_t *flags)
|
||||
{
|
||||
@@ -123,7 +162,10 @@
|
||||
}
|
||||
}
|
||||
#endif
|
||||
-
|
||||
+#ifdef CONFIG_HOTPLUG
|
||||
+ atm_run_sbin_hotplug(dev, "register");
|
||||
+#endif
|
||||
+
|
||||
return dev;
|
||||
}
|
||||
|
||||
@@ -131,6 +173,10 @@
|
||||
void atm_dev_deregister(struct atm_dev *dev)
|
||||
{
|
||||
unsigned long warning_time;
|
||||
+
|
||||
+#ifdef CONFIG_HOTPLUG
|
||||
+ atm_run_sbin_hotplug(dev, "unregister");
|
||||
+#endif
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
if (dev->ops->proc_read)
|
||||
@@ -399,6 +445,7 @@
|
||||
}
|
||||
|
||||
|
||||
+EXPORT_SYMBOL(atm_dev_set_link_status);
|
||||
EXPORT_SYMBOL(atm_dev_register);
|
||||
EXPORT_SYMBOL(atm_dev_deregister);
|
||||
EXPORT_SYMBOL(atm_dev_lookup);
|
Loading…
Reference in a new issue