source: freewrt/target/linux/generic-2.4/patches/224-atm_hotplug.patch@ a3abab6

freewrt_1_0 freewrt_2_0
Last change on this file since a3abab6 was 475ad56, checked in by Waldemar Brodkorb <wbx@…>, 20 years ago

add OpenWrt trunk revision 3830.

git-svn-id: svn://www.freewrt.org/trunk/freewrt@1 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 2.7 KB
  • include/linux/atmdev.h

    diff -urN linux.old/include/linux/atmdev.h linux.dev/include/linux/atmdev.h
    old new  
    408408struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
    409409    int number,atm_dev_flags_t *flags); /* number == -1: pick first available */
    410410struct atm_dev *atm_dev_lookup(int number);
     411void atm_dev_set_link_status(struct atm_dev *dev, int status);
    411412void atm_dev_deregister(struct atm_dev *dev);
    412413void shutdown_atm_dev(struct atm_dev *dev);
    413414void vcc_insert_socket(struct sock *sk);
  • net/atm/resources.c

    diff -urN linux.old/net/atm/resources.c linux.dev/net/atm/resources.c
    old new  
    1010#include <linux/sonet.h>
    1111#include <linux/kernel.h> /* for barrier */
    1212#include <linux/module.h>
     13#include <linux/kmod.h>
    1314#include <linux/bitops.h>
    1415#include <net/sock.h>    /* for struct sock */
    1516#include <asm/segment.h> /* for get_fs_long and put_fs_long */
     
    7071        return dev;
    7172}
    7273
     74#ifdef CONFIG_HOTPLUG
     75static void atm_run_sbin_hotplug(struct atm_dev *dev, char *action)
     76{
     77        char *argv[3], *envp[5], ifname[12 + IFNAMSIZ], atmname[255], action_str[32];
     78        int i;
     79
     80        sprintf(ifname, "INTERFACE=atm%d", dev->number);
     81        sprintf(atmname, "ATMDRIVER=%s", dev->type);
     82        sprintf(action_str, "ACTION=%s", action);
     83
     84        i = 0;
     85        argv[i++] = hotplug_path;
     86        argv[i++] = "net";
     87        argv[i] = 0;
     88
     89        i = 0;
     90        /* minimal command environment */
     91        envp [i++] = "HOME=/";
     92        envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
     93        envp [i++] = ifname;
     94        envp [i++] = atmname;
     95        envp [i++] = action_str;
     96        envp [i] = 0;
     97
     98        return call_usermodehelper(argv [0], argv, envp);
     99}
     100#endif
     101
     102void atm_dev_set_link_status(struct atm_dev *dev, int status)
     103{
     104#ifdef CONFIG_HOTPLUG
     105        if (status)
     106                atm_run_sbin_hotplug(dev, "up");
     107        else
     108                atm_run_sbin_hotplug(dev, "down");
     109#endif
     110}
     111
    73112struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
    74113                                 int number, atm_dev_flags_t *flags)
    75114{
     
    123162                }
    124163        }
    125164#endif
    126 
     165#ifdef CONFIG_HOTPLUG
     166        atm_run_sbin_hotplug(dev, "register");
     167#endif
     168       
    127169        return dev;
    128170}
    129171
     
    131173void atm_dev_deregister(struct atm_dev *dev)
    132174{
    133175        unsigned long warning_time;
     176       
     177#ifdef CONFIG_HOTPLUG
     178        atm_run_sbin_hotplug(dev, "unregister");
     179#endif
    134180
    135181#ifdef CONFIG_PROC_FS
    136182        if (dev->ops->proc_read)
     
    399445}
    400446
    401447
     448EXPORT_SYMBOL(atm_dev_set_link_status);
    402449EXPORT_SYMBOL(atm_dev_register);
    403450EXPORT_SYMBOL(atm_dev_deregister);
    404451EXPORT_SYMBOL(atm_dev_lookup);
Note: See TracBrowser for help on using the repository browser.