Release 4.11 net/atm/addr.c
/* net/atm/addr.c - Local ATM address registry */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
#include <linux/atm.h>
#include <linux/atmdev.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include "signaling.h"
#include "addr.h"
static int check_addr(const struct sockaddr_atmsvc *addr)
{
int i;
if (addr->sas_family != AF_ATMSVC)
return -EAFNOSUPPORT;
if (!*addr->sas_addr.pub)
return *addr->sas_addr.prv ? 0 : -EINVAL;
for (i = 1; i < ATM_E164_LEN + 1; i++) /* make sure it's \0-terminated */
if (!addr->sas_addr.pub[i])
return 0;
return -EINVAL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 84 | 98.82% | 2 | 66.67% |
Mitchell Blank Jr. | 1 | 1.18% | 1 | 33.33% |
Total | 85 | 100.00% | 3 | 100.00% |
static int identical(const struct sockaddr_atmsvc *a, const struct sockaddr_atmsvc *b)
{
if (*a->sas_addr.prv)
if (memcmp(a->sas_addr.prv, b->sas_addr.prv, ATM_ESA_LEN))
return 0;
if (!*a->sas_addr.pub)
return !*b->sas_addr.pub;
if (!*b->sas_addr.pub)
return 0;
return !strcmp(a->sas_addr.pub, b->sas_addr.pub);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 96 | 97.96% | 1 | 50.00% |
Mitchell Blank Jr. | 2 | 2.04% | 1 | 50.00% |
Total | 98 | 100.00% | 2 | 100.00% |
static void notify_sigd(const struct atm_dev *dev)
{
struct sockaddr_atmpvc pvc;
pvc.sap_addr.itf = dev->number;
sigd_enq(NULL, as_itf_notify, NULL, &pvc, NULL);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 39 | 97.50% | 1 | 50.00% |
Mitchell Blank Jr. | 1 | 2.50% | 1 | 50.00% |
Total | 40 | 100.00% | 2 | 100.00% |
void atm_reset_addr(struct atm_dev *dev, enum atm_addr_type_t atype)
{
unsigned long flags;
struct atm_dev_addr *this, *p;
struct list_head *head;
spin_lock_irqsave(&dev->lock, flags);
if (atype == ATM_ADDR_LECS)
head = &dev->lecs;
else
head = &dev->local;
list_for_each_entry_safe(this, p, head, entry) {
list_del(&this->entry);
kfree(this);
}
spin_unlock_irqrestore(&dev->lock, flags);
if (head == &dev->local)
notify_sigd(dev);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Eric Kinzie | 40 | 36.04% | 1 | 14.29% |
Linus Torvalds (pre-git) | 32 | 28.83% | 2 | 28.57% |
Chas Williams | 28 | 25.23% | 2 | 28.57% |
Martin Whitaker | 10 | 9.01% | 1 | 14.29% |
Linus Torvalds | 1 | 0.90% | 1 | 14.29% |
Total | 111 | 100.00% | 7 | 100.00% |
int atm_add_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr,
enum atm_addr_type_t atype)
{
unsigned long flags;
struct atm_dev_addr *this;
struct list_head *head;
int error;
error = check_addr(addr);
if (error)
return error;
spin_lock_irqsave(&dev->lock, flags);
if (atype == ATM_ADDR_LECS)
head = &dev->lecs;
else
head = &dev->local;
list_for_each_entry(this, head, entry) {
if (identical(&this->addr, addr)) {
spin_unlock_irqrestore(&dev->lock, flags);
return -EEXIST;
}
}
this = kmalloc(sizeof(struct atm_dev_addr), GFP_ATOMIC);
if (!this) {
spin_unlock_irqrestore(&dev->lock, flags);
return -ENOMEM;
}
this->addr = *addr;
list_add(&this->entry, head);
spin_unlock_irqrestore(&dev->lock, flags);
if (head == &dev->local)
notify_sigd(dev);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 105 | 53.03% | 2 | 28.57% |
Chas Williams | 50 | 25.25% | 2 | 28.57% |
Eric Kinzie | 41 | 20.71% | 1 | 14.29% |
Linus Torvalds | 1 | 0.51% | 1 | 14.29% |
Mitchell Blank Jr. | 1 | 0.51% | 1 | 14.29% |
Total | 198 | 100.00% | 7 | 100.00% |
int atm_del_addr(struct atm_dev *dev, const struct sockaddr_atmsvc *addr,
enum atm_addr_type_t atype)
{
unsigned long flags;
struct atm_dev_addr *this;
struct list_head *head;
int error;
error = check_addr(addr);
if (error)
return error;
spin_lock_irqsave(&dev->lock, flags);
if (atype == ATM_ADDR_LECS)
head = &dev->lecs;
else
head = &dev->local;
list_for_each_entry(this, head, entry) {
if (identical(&this->addr, addr)) {
list_del(&this->entry);
spin_unlock_irqrestore(&dev->lock, flags);
kfree(this);
if (head == &dev->local)
notify_sigd(dev);
return 0;
}
}
spin_unlock_irqrestore(&dev->lock, flags);
return -ENOENT;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 67 | 41.88% | 2 | 28.57% |
Chas Williams | 51 | 31.88% | 2 | 28.57% |
Eric Kinzie | 40 | 25.00% | 1 | 14.29% |
Mitchell Blank Jr. | 1 | 0.62% | 1 | 14.29% |
Linus Torvalds | 1 | 0.62% | 1 | 14.29% |
Total | 160 | 100.00% | 7 | 100.00% |
int atm_get_addr(struct atm_dev *dev, struct sockaddr_atmsvc __user * buf,
size_t size, enum atm_addr_type_t atype)
{
unsigned long flags;
struct atm_dev_addr *this;
struct list_head *head;
int total = 0, error;
struct sockaddr_atmsvc *tmp_buf, *tmp_bufp;
spin_lock_irqsave(&dev->lock, flags);
if (atype == ATM_ADDR_LECS)
head = &dev->lecs;
else
head = &dev->local;
list_for_each_entry(this, head, entry)
total += sizeof(struct sockaddr_atmsvc);
tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC);
if (!tmp_buf) {
spin_unlock_irqrestore(&dev->lock, flags);
return -ENOMEM;
}
list_for_each_entry(this, head, entry)
memcpy(tmp_bufp++, &this->addr, sizeof(struct sockaddr_atmsvc));
spin_unlock_irqrestore(&dev->lock, flags);
error = total > size ? -E2BIG : total;
if (copy_to_user(buf, tmp_buf, total < size ? total : size))
error = -EFAULT;
kfree(tmp_buf);
return error;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Chas Williams | 101 | 48.79% | 3 | 33.33% |
Linus Torvalds (pre-git) | 69 | 33.33% | 2 | 22.22% |
Eric Kinzie | 32 | 15.46% | 1 | 11.11% |
Al Viro | 3 | 1.45% | 1 | 11.11% |
Linus Torvalds | 2 | 0.97% | 2 | 22.22% |
Total | 207 | 100.00% | 9 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 508 | 55.28% | 3 | 21.43% |
Chas Williams | 230 | 25.03% | 3 | 21.43% |
Eric Kinzie | 153 | 16.65% | 1 | 7.14% |
Martin Whitaker | 10 | 1.09% | 1 | 7.14% |
Mitchell Blank Jr. | 6 | 0.65% | 1 | 7.14% |
Linus Torvalds | 5 | 0.54% | 2 | 14.29% |
Tejun Heo | 3 | 0.33% | 1 | 7.14% |
Al Viro | 3 | 0.33% | 1 | 7.14% |
Joe Perches | 1 | 0.11% | 1 | 7.14% |
Total | 919 | 100.00% | 14 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.