lua: Fixed some cross-platform issues for PPC (and probably other architectures)
[openwrt.git] / target / linux / generic-2.4 / patches / 224-atm_hotplug.patch
1 Index: linux-2.4.35.4/include/linux/atmdev.h
2 ===================================================================
3 --- linux-2.4.35.4.orig/include/linux/atmdev.h
4 +++ linux-2.4.35.4/include/linux/atmdev.h
5 @@ -400,6 +400,7 @@ extern rwlock_t vcc_sklist_lock;
6 struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
7 int number,atm_dev_flags_t *flags); /* number == -1: pick first available */
8 struct atm_dev *atm_dev_lookup(int number);
9 +void atm_dev_set_link_status(struct atm_dev *dev, int status);
10 void atm_dev_deregister(struct atm_dev *dev);
11 void shutdown_atm_dev(struct atm_dev *dev);
12 void vcc_insert_socket(struct sock *sk);
13 Index: linux-2.4.35.4/net/atm/resources.c
14 ===================================================================
15 --- linux-2.4.35.4.orig/net/atm/resources.c
16 +++ linux-2.4.35.4/net/atm/resources.c
17 @@ -10,6 +10,7 @@
18 #include <linux/sonet.h>
19 #include <linux/kernel.h> /* for barrier */
20 #include <linux/module.h>
21 +#include <linux/kmod.h>
22 #include <linux/bitops.h>
23 #include <net/sock.h> /* for struct sock */
24 #include <asm/segment.h> /* for get_fs_long and put_fs_long */
25 @@ -70,6 +71,44 @@ struct atm_dev *atm_dev_lookup(int numbe
26 return dev;
27 }
28
29 +#ifdef CONFIG_HOTPLUG
30 +static void atm_run_sbin_hotplug(struct atm_dev *dev, char *action)
31 +{
32 + char *argv[3], *envp[5], ifname[12 + IFNAMSIZ], atmname[255], action_str[32];
33 + int i;
34 +
35 + sprintf(ifname, "INTERFACE=atm%d", dev->number);
36 + sprintf(atmname, "ATMDRIVER=%s", dev->type);
37 + sprintf(action_str, "ACTION=%s", action);
38 +
39 + i = 0;
40 + argv[i++] = hotplug_path;
41 + argv[i++] = "net";
42 + argv[i] = 0;
43 +
44 + i = 0;
45 + /* minimal command environment */
46 + envp [i++] = "HOME=/";
47 + envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
48 + envp [i++] = ifname;
49 + envp [i++] = atmname;
50 + envp [i++] = action_str;
51 + envp [i] = 0;
52 +
53 + return call_usermodehelper(argv [0], argv, envp);
54 +}
55 +#endif
56 +
57 +void atm_dev_set_link_status(struct atm_dev *dev, int status)
58 +{
59 +#ifdef CONFIG_HOTPLUG
60 + if (status)
61 + atm_run_sbin_hotplug(dev, "up");
62 + else
63 + atm_run_sbin_hotplug(dev, "down");
64 +#endif
65 +}
66 +
67 struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
68 int number, atm_dev_flags_t *flags)
69 {
70 @@ -123,7 +162,10 @@ struct atm_dev *atm_dev_register(const c
71 }
72 }
73 #endif
74 -
75 +#ifdef CONFIG_HOTPLUG
76 + atm_run_sbin_hotplug(dev, "register");
77 +#endif
78 +
79 return dev;
80 }
81
82 @@ -131,6 +173,10 @@ struct atm_dev *atm_dev_register(const c
83 void atm_dev_deregister(struct atm_dev *dev)
84 {
85 unsigned long warning_time;
86 +
87 +#ifdef CONFIG_HOTPLUG
88 + atm_run_sbin_hotplug(dev, "unregister");
89 +#endif
90
91 #ifdef CONFIG_PROC_FS
92 if (dev->ops->proc_read)
93 @@ -399,6 +445,7 @@ done:
94 }
95
96
97 +EXPORT_SYMBOL(atm_dev_set_link_status);
98 EXPORT_SYMBOL(atm_dev_register);
99 EXPORT_SYMBOL(atm_dev_deregister);
100 EXPORT_SYMBOL(atm_dev_lookup);
This page took 0.04926 seconds and 5 git commands to generate.