diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2003-09-04 09:06:15 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2003-09-04 09:06:15 -0700 |
| commit | de5f0c10a5038af9c4b72fbadfa5f695b0aa99d6 (patch) | |
| tree | 9fe351cbf3047eb518a3086da852f00e3d36991b | |
| parent | 016b189409b4ae5fbdc75f19de2a2c4bbb4b7377 (diff) | |
| parent | 8697648c34930bb48cfc40785688cd73a3e7269c (diff) | |
Merge nuts.ninka.net:/disk1/davem/BK/network-2.5
into nuts.ninka.net:/disk1/davem/BK/net-2.5
| -rw-r--r-- | crypto/Makefile | 3 | ||||
| -rw-r--r-- | crypto/autoload.c | 37 | ||||
| -rw-r--r-- | crypto/internal.h | 10 | ||||
| -rw-r--r-- | include/linux/kmod.h | 2 | ||||
| -rw-r--r-- | net/README | 26 | ||||
| -rw-r--r-- | net/atm/br2684.c | 137 | ||||
| -rw-r--r-- | net/unix/af_unix.c | 136 |
7 files changed, 171 insertions, 180 deletions
diff --git a/crypto/Makefile b/crypto/Makefile index f3325db1ee76..8326b4fb5be4 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -2,11 +2,10 @@ # Cryptographic API # -autoload-crypto-$(CONFIG_KMOD) = autoload.o proc-crypto-$(CONFIG_PROC_FS) = proc.o obj-$(CONFIG_CRYPTO) += api.o cipher.o digest.o compress.o \ - $(autoload-crypto-y) $(proc-crypto-y) + $(proc-crypto-y) obj-$(CONFIG_CRYPTO_HMAC) += hmac.o obj-$(CONFIG_CRYPTO_NULL) += crypto_null.o diff --git a/crypto/autoload.c b/crypto/autoload.c deleted file mode 100644 index 7cda40b39ddf..000000000000 --- a/crypto/autoload.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Cryptographic API. - * - * Algorithm autoloader. - * - * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ -#include <linux/kernel.h> -#include <linux/crypto.h> -#include <linux/string.h> -#include <linux/kmod.h> -#include "internal.h" - -/* - * A far more intelligent version of this is planned. For now, just - * try an exact match on the name of the algorithm. - */ -void crypto_alg_autoload(const char *name) -{ - request_module("%s", name); -} - -struct crypto_alg *crypto_alg_mod_lookup(const char *name) -{ - struct crypto_alg *alg = crypto_alg_lookup(name); - if (alg == NULL) { - crypto_alg_autoload(name); - alg = crypto_alg_lookup(name); - } - return alg; -} diff --git a/crypto/internal.h b/crypto/internal.h index 10880d149afe..8ba30b772ee3 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -15,6 +15,7 @@ #include <linux/highmem.h> #include <linux/interrupt.h> #include <linux/init.h> +#include <linux/kmod.h> #include <asm/hardirq.h> #include <asm/kmap_types.h> @@ -48,15 +49,12 @@ static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) struct crypto_alg *crypto_alg_lookup(const char *name); -#ifdef CONFIG_KMOD -void crypto_alg_autoload(const char *name); -struct crypto_alg *crypto_alg_mod_lookup(const char *name); -#else +/* A far more intelligent version of this is planned. For now, just + * try an exact match on the name of the algorithm. */ static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name) { - return crypto_alg_lookup(name); + return try_then_request_module(crypto_alg_lookup(name), name); } -#endif #ifdef CONFIG_CRYPTO_HMAC int crypto_alloc_hmac_block(struct crypto_tfm *tfm); diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 7fa02a737518..8412faeea0f7 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h @@ -29,7 +29,7 @@ extern int request_module(const char * name, ...) __attribute__ ((format (printf static inline int request_module(const char * name, ...) { return -ENOSYS; } #endif -#define try_then_request_module(x, mod...) ((x) ?: request_module(mod), (x)) +#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait); #ifdef CONFIG_HOTPLUG diff --git a/net/README b/net/README deleted file mode 100644 index e509ec526c25..000000000000 --- a/net/README +++ /dev/null @@ -1,26 +0,0 @@ - -Maintainers and developers for networking code sections - -Code Section Bug Report Contact --------------------+------------------------------------------- -802 [other ] alan@lxorguk.ukuu.org.uk - [token ring ] p.norton@computer.org -appletalk jschlst@samba.org -ax25 g4klx@g4klx.demon.co.uk -bridge buytenh@gnu.org -core alan@lxorguk.ukuu.org.uk -decnet SteveW@ACM.org -ethernet alan@lxorguk.ukuu.org.uk -ipv4 davem@caip.rutgers.edu,Eric.Schenk@dna.lth.se -ipv6 davem@caip.rutgers.edu,Eric.Schenk@dna.lth.se -ipx acme@conectiva.com.br -spx jschlst@samba.org -irda dagb@cs.uit.no -lapb g4klx@g4klx.demon.co.uk -netrom g4klx@g4klx.demon.co.uk -rose g4klx@g4klx.demon.co.uk -wanrouter gene@compuserve.com, jaspreet@sangoma and dm@sangoma.com -unix alan@lxorguk.ukuu.org.uk -x25 g4klx@g4klx.demon.co.uk -bluetooth maxk@qualcomm.com -8021q greearb@candelatech.com, vlan@scry.wanfear.com diff --git a/net/atm/br2684.c b/net/atm/br2684.c index fa25cbdd9a80..0f9d98463a69 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c @@ -18,6 +18,7 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary #include <net/arp.h> #include <linux/atm.h> #include <linux/atmdev.h> +#include <linux/seq_file.h> #include <linux/atmbr2684.h> @@ -666,31 +667,57 @@ static int br2684_ioctl(struct atm_vcc *atmvcc, unsigned int cmd, return -ENOIOCTLCMD; } -/* Never put more than 256 bytes in at once */ -static int br2684_proc_engine(loff_t pos, char *buf) +#ifdef CONFIG_PROC_FS +static void *br2684_seq_start(struct seq_file *seq, loff_t *pos) { - struct list_head *lhd, *lhc; - struct net_device *net_dev; - struct br2684_dev *brdev; - struct br2684_vcc *brvcc; - list_for_each(lhd, &br2684_devs) { - net_dev = list_entry_brdev(lhd); - brdev = BRPRIV(net_dev); - if (pos-- == 0) - return sprintf(buf, "dev %.16s: num=%d, mac=%02X:%02X:" - "%02X:%02X:%02X:%02X (%s)\n", net_dev->name, - brdev->number, - net_dev->dev_addr[0], - net_dev->dev_addr[1], - net_dev->dev_addr[2], - net_dev->dev_addr[3], - net_dev->dev_addr[4], - net_dev->dev_addr[5], - brdev->mac_was_set ? "set" : "auto"); - list_for_each(lhc, &brdev->brvccs) { - brvcc = list_entry_brvcc(lhc); - if (pos-- == 0) - return sprintf(buf, " vcc %d.%d.%d: encaps=%s" + loff_t offs = 0; + struct br2684_dev *brd; + + read_lock(&devs_lock); + + list_for_each_entry(brd, &br2684_devs, br2684_devs) { + if (offs == *pos) + return brd; + ++offs; + } + return NULL; +} + +static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + struct br2684_dev *brd = v; + + ++*pos; + + brd = list_entry(brd->br2684_devs.next, + struct br2684_dev, br2684_devs); + return (&brd->br2684_devs != &br2684_devs) ? brd : NULL; +} + +static void br2684_seq_stop(struct seq_file *seq, void *v) +{ + read_unlock(&devs_lock); +} + +static int br2684_seq_show(struct seq_file *seq, void *v) +{ + const struct br2684_dev *brdev = v; + const struct net_device *net_dev = brdev->net_dev; + const struct br2684_vcc *brvcc; + + seq_printf(seq, "dev %.16s: num=%d, mac=%02X:%02X:" + "%02X:%02X:%02X:%02X (%s)\n", net_dev->name, + brdev->number, + net_dev->dev_addr[0], + net_dev->dev_addr[1], + net_dev->dev_addr[2], + net_dev->dev_addr[3], + net_dev->dev_addr[4], + net_dev->dev_addr[5], + brdev->mac_was_set ? "set" : "auto"); + + list_for_each_entry(brvcc, &brdev->brvccs, brvccs) { + seq_printf(seq, " vcc %d.%d.%d: encaps=%s" #ifndef FASTER_VERSION ", failed copies %u/%u" #endif /* FASTER_VERSION */ @@ -711,63 +738,41 @@ static int br2684_proc_engine(loff_t pos, char *buf) #undef bs #undef b1 #endif /* CONFIG_ATM_BR2684_IPFILTER */ - } } return 0; } -static ssize_t br2684_proc_read(struct file *file, char *buf, size_t count, - loff_t *pos) +static struct seq_operations br2684_seq_ops = { + .start = br2684_seq_start, + .next = br2684_seq_next, + .stop = br2684_seq_stop, + .show = br2684_seq_show, +}; + +static int br2684_proc_open(struct inode *inode, struct file *file) { - unsigned long page; - int len = 0, x, left; - page = get_zeroed_page(GFP_KERNEL); - if (!page) - return -ENOMEM; - left = PAGE_SIZE - 256; - if (count < left) - left = count; - read_lock(&devs_lock); - for (;;) { - x = br2684_proc_engine(*pos, &((char *) page)[len]); - if (x == 0) - break; - if (x > left) - /* - * This should only happen if the user passed in - * a "count" too small for even one line - */ - x = -EINVAL; - if (x < 0) { - len = x; - break; - } - len += x; - left -= x; - (*pos)++; - if (left < 256) - break; - } - read_unlock(&devs_lock); - if (len > 0 && copy_to_user(buf, (char *) page, len)) - len = -EFAULT; - free_page(page); - return len; + return seq_open(file, &br2684_seq_ops); } -static struct file_operations br2684_proc_operations = { - .owner = THIS_MODULE, - .read = br2684_proc_read, +static struct file_operations br2684_proc_ops = { + .owner = THIS_MODULE, + .open = br2684_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, }; extern struct proc_dir_entry *atm_proc_root; /* from proc.c */ +#endif static int __init br2684_init(void) { +#ifdef CONFIG_PROC_FS struct proc_dir_entry *p; if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL) return -ENOMEM; - p->proc_fops = &br2684_proc_operations; + p->proc_fops = &br2684_proc_ops; +#endif br2684_ioctl_set(br2684_ioctl); return 0; } @@ -779,7 +784,9 @@ static void __exit br2684_exit(void) struct br2684_vcc *brvcc; br2684_ioctl_set(NULL); +#ifdef CONFIG_PROC_FS remove_proc_entry("br2684", atm_proc_root); +#endif while (!list_empty(&br2684_devs)) { net_dev = list_entry_brdev(br2684_devs.next); diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index d9dd8a2f3914..1a3873145535 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -111,6 +111,7 @@ #include <linux/tcp.h> #include <net/af_unix.h> #include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <net/scm.h> #include <linux/init.h> #include <linux/poll.h> @@ -1805,25 +1806,52 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl #ifdef CONFIG_PROC_FS -static int unix_read_proc(char *buffer, char **start, off_t offset, - int length, int *eof, void *data) +static struct sock *unix_seq_idx(int *iter, loff_t pos) { - off_t pos=0; - off_t begin=0; - int len=0; - int i; + loff_t off = 0; struct sock *s; - - len+= sprintf(buffer,"Num RefCount Protocol Flags Type St " - "Inode Path\n"); + for (s = first_unix_socket(iter); s; s = next_unix_socket(iter, s)) { + if (off == pos) + return s; + ++off; + } + return NULL; +} + + +static void *unix_seq_start(struct seq_file *seq, loff_t *pos) +{ read_lock(&unix_table_lock); - forall_unix_sockets (i,s) - { + return *pos ? unix_seq_idx(seq->private, *pos - 1) : ((void *) 1); +} + +static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos) +{ + ++*pos; + + if (v == (void *)1) + return first_unix_socket(seq->private); + return next_unix_socket(seq->private, v); +} + +static void unix_seq_stop(struct seq_file *seq, void *v) +{ + read_unlock(&unix_table_lock); +} + +static int unix_seq_show(struct seq_file *seq, void *v) +{ + + if (v == (void *)1) + seq_puts(seq, "Num RefCount Protocol Flags Type St " + "Inode Path\n"); + else { + struct sock *s = v; struct unix_sock *u = unix_sk(s); unix_state_rlock(s); - len+=sprintf(buffer+len,"%p: %08X %08X %08X %04X %02X %5lu", + seq_printf(seq, "%p: %08X %08X %08X %04X %02X %5lu", s, atomic_read(&s->sk_refcnt), 0, @@ -1835,39 +1863,61 @@ static int unix_read_proc(char *buffer, char **start, off_t offset, sock_i_ino(s)); if (u->addr) { - buffer[len++] = ' '; - memcpy(buffer+len, u->addr->name->sun_path, - u->addr->len-sizeof(short)); - if (!UNIX_ABSTRACT(s)) - len--; - else - buffer[len] = '@'; - len += u->addr->len - sizeof(short); - } - unix_state_runlock(s); + int i; + seq_putc(seq, ' '); + + for (i = 0; i < u->addr->len-sizeof(short); i++) + seq_putc(seq, u->addr->name->sun_path[i]); - buffer[len++]='\n'; - - pos = begin + len; - if(pos<offset) - { - len=0; - begin=pos; + if (UNIX_ABSTRACT(s)) + seq_putc(seq, '@'); } - if(pos>offset+length) - goto done; + unix_state_runlock(s); + seq_putc(seq, '\n'); } - *eof = 1; -done: - read_unlock(&unix_table_lock); - *start=buffer+(offset-begin); - len-=(offset-begin); - if(len>length) - len=length; - if (len < 0) - len = 0; - return len; + + return 0; +} + +struct seq_operations unix_seq_ops = { + .start = unix_seq_start, + .next = unix_seq_next, + .stop = unix_seq_stop, + .show = unix_seq_show, +}; + + +static int unix_seq_open(struct inode *inode, struct file *file) +{ + struct seq_file *seq; + int rc = -ENOMEM; + int *iter = kmalloc(sizeof(int), GFP_KERNEL); + + if (!iter) + goto out; + + rc = seq_open(file, &unix_seq_ops); + if (rc) + goto out_kfree; + + seq = file->private_data; + seq->private = iter; + *iter = 0; +out: + return rc; +out_kfree: + kfree(iter); + goto out; } + +static struct file_operations unix_seq_fops = { + .owner = THIS_MODULE, + .open = unix_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release_private, +}; + #endif struct proto_ops unix_stream_ops = { @@ -1947,7 +1997,7 @@ static int __init af_unix_init(void) sock_register(&unix_family_ops); #ifdef CONFIG_PROC_FS - create_proc_read_entry("net/unix", 0, 0, unix_read_proc, NULL); + proc_net_fops_create("unix", 0, &unix_seq_fops); #endif unix_sysctl_register(); return 0; @@ -1957,7 +2007,7 @@ static void __exit af_unix_exit(void) { sock_unregister(PF_UNIX); unix_sysctl_unregister(); - remove_proc_entry("net/unix", 0); + proc_net_remove("unix"); kmem_cache_destroy(unix_sk_cachep); } |
