forked from Minki/linux
[NET] ATM: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ed4477b960
commit
f7d57453d2
@ -30,15 +30,15 @@ static ssize_t show_address(struct class_device *cdev, char *buf)
|
||||
|
||||
static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long flags;
|
||||
char *pos = buf;
|
||||
struct atm_dev *adev = to_atm_dev(cdev);
|
||||
struct atm_dev_addr *aaddr;
|
||||
struct atm_dev_addr *aaddr;
|
||||
int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin;
|
||||
int i, j;
|
||||
|
||||
spin_lock_irqsave(&adev->lock, flags);
|
||||
list_for_each_entry(aaddr, &adev->local, entry) {
|
||||
spin_lock_irqsave(&adev->lock, flags);
|
||||
list_for_each_entry(aaddr, &adev->local, entry) {
|
||||
for(i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) {
|
||||
if (j == *fmt) {
|
||||
pos += sprintf(pos, ".");
|
||||
@ -49,7 +49,7 @@ static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
|
||||
}
|
||||
pos += sprintf(pos, "\n");
|
||||
}
|
||||
spin_unlock_irqrestore(&adev->lock, flags);
|
||||
spin_unlock_irqrestore(&adev->lock, flags);
|
||||
|
||||
return pos - buf;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ static inline int vcc_writable(struct sock *sk)
|
||||
struct atm_vcc *vcc = atm_sk(sk);
|
||||
|
||||
return (vcc->qos.txtp.max_sdu +
|
||||
atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf;
|
||||
atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf;
|
||||
}
|
||||
|
||||
static void vcc_write_space(struct sock *sk)
|
||||
@ -500,14 +500,14 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
|
||||
msg->msg_flags |= MSG_TRUNC;
|
||||
}
|
||||
|
||||
error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
|
||||
if (error)
|
||||
return error;
|
||||
sock_recv_timestamp(msg, sk, skb);
|
||||
DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize);
|
||||
atm_return(vcc, skb->truesize);
|
||||
skb_free_datagram(sk, skb);
|
||||
return copied;
|
||||
error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
|
||||
if (error)
|
||||
return error;
|
||||
sock_recv_timestamp(msg, sk, skb);
|
||||
DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize);
|
||||
atm_return(vcc, skb->truesize);
|
||||
skb_free_datagram(sk, skb);
|
||||
return copied;
|
||||
}
|
||||
|
||||
|
||||
@ -675,7 +675,7 @@ static int check_qos(struct atm_qos *qos)
|
||||
int error;
|
||||
|
||||
if (!qos->txtp.traffic_class && !qos->rxtp.traffic_class)
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
if (qos->txtp.traffic_class != qos->rxtp.traffic_class &&
|
||||
qos->txtp.traffic_class && qos->rxtp.traffic_class &&
|
||||
qos->txtp.traffic_class != ATM_ANYCLASS &&
|
||||
@ -786,11 +786,11 @@ static int __init atm_init(void)
|
||||
printk(KERN_ERR "atmsvc_init() failed with %d\n", error);
|
||||
goto out_atmpvc_exit;
|
||||
}
|
||||
if ((error = atm_proc_init()) < 0) {
|
||||
if ((error = atm_proc_init()) < 0) {
|
||||
printk(KERN_ERR "atm_proc_init() failed with %d\n",error);
|
||||
goto out_atmsvc_exit;
|
||||
}
|
||||
if ((error = atm_sysfs_init()) < 0) {
|
||||
if ((error = atm_sysfs_init()) < 0) {
|
||||
printk(KERN_ERR "atm_sysfs_init() failed with %d\n",error);
|
||||
goto out_atmproc_exit;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
||||
}
|
||||
skb = skb_peek(&sk->sk_receive_queue);
|
||||
error = put_user(skb ? skb->len : 0,
|
||||
(int __user *)argp) ? -EFAULT : 0;
|
||||
(int __user *)argp) ? -EFAULT : 0;
|
||||
goto done;
|
||||
}
|
||||
case SIOCGSTAMP: /* borrowed from IP */
|
||||
|
@ -1473,9 +1473,9 @@ static void lec_arp_init(struct lec_priv *priv)
|
||||
for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
|
||||
INIT_HLIST_HEAD(&priv->lec_arp_tables[i]);
|
||||
}
|
||||
INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
|
||||
INIT_HLIST_HEAD(&priv->lec_no_forward);
|
||||
INIT_HLIST_HEAD(&priv->mcast_fwds);
|
||||
INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
|
||||
INIT_HLIST_HEAD(&priv->lec_no_forward);
|
||||
INIT_HLIST_HEAD(&priv->mcast_fwds);
|
||||
spin_lock_init(&priv->lec_arp_lock);
|
||||
INIT_DELAYED_WORK(&priv->lec_arp_work, lec_arp_check_expire);
|
||||
schedule_delayed_work(&priv->lec_arp_work, LEC_ARP_REFRESH_INTERVAL);
|
||||
@ -2380,7 +2380,7 @@ lec_set_flush_tran_id(struct lec_priv *priv,
|
||||
if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) {
|
||||
entry->flush_tran_id = tran_id;
|
||||
DPRINTK("Set flush transaction id to %lx for %p\n",
|
||||
tran_id, entry);
|
||||
tran_id, entry);
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
|
||||
|
@ -1079,7 +1079,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
|
||||
else if(eg_entry->shortcut->qos.txtp.max_pcr > 0)
|
||||
entry->shortcut = eg_entry->shortcut;
|
||||
}
|
||||
if(entry->shortcut){
|
||||
if(entry->shortcut){
|
||||
dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip));
|
||||
client->eg_ops->put(eg_entry);
|
||||
return;
|
||||
@ -1094,7 +1094,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
|
||||
{
|
||||
msg->qos = qos->qos;
|
||||
printk("mpoa: (%s) trying to get a CBR shortcut\n",client->dev->name);
|
||||
}
|
||||
}
|
||||
else memset(&msg->qos,0,sizeof(struct atm_qos));
|
||||
msg_to_mpoad(msg, client);
|
||||
return;
|
||||
|
@ -12,32 +12,32 @@
|
||||
int msg_to_mpoad(struct k_message *msg, struct mpoa_client *mpc);
|
||||
|
||||
struct mpoa_client {
|
||||
struct mpoa_client *next;
|
||||
struct net_device *dev; /* lec in question */
|
||||
int dev_num; /* e.g. 2 for lec2 */
|
||||
int (*old_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
|
||||
struct atm_vcc *mpoad_vcc; /* control channel to mpoad */
|
||||
uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */
|
||||
uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */
|
||||
struct mpoa_client *next;
|
||||
struct net_device *dev; /* lec in question */
|
||||
int dev_num; /* e.g. 2 for lec2 */
|
||||
int (*old_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
|
||||
struct atm_vcc *mpoad_vcc; /* control channel to mpoad */
|
||||
uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */
|
||||
uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */
|
||||
|
||||
rwlock_t ingress_lock;
|
||||
struct in_cache_ops *in_ops; /* ingress cache operations */
|
||||
in_cache_entry *in_cache; /* the ingress cache of this MPC */
|
||||
rwlock_t ingress_lock;
|
||||
struct in_cache_ops *in_ops; /* ingress cache operations */
|
||||
in_cache_entry *in_cache; /* the ingress cache of this MPC */
|
||||
|
||||
rwlock_t egress_lock;
|
||||
struct eg_cache_ops *eg_ops; /* egress cache operations */
|
||||
eg_cache_entry *eg_cache; /* the egress cache of this MPC */
|
||||
rwlock_t egress_lock;
|
||||
struct eg_cache_ops *eg_ops; /* egress cache operations */
|
||||
eg_cache_entry *eg_cache; /* the egress cache of this MPC */
|
||||
|
||||
uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */
|
||||
int number_of_mps_macs; /* number of the above MAC addresses */
|
||||
struct mpc_parameters parameters; /* parameters for this client */
|
||||
uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */
|
||||
int number_of_mps_macs; /* number of the above MAC addresses */
|
||||
struct mpc_parameters parameters; /* parameters for this client */
|
||||
};
|
||||
|
||||
|
||||
struct atm_mpoa_qos {
|
||||
struct atm_mpoa_qos *next;
|
||||
__be32 ipaddr;
|
||||
struct atm_qos qos;
|
||||
struct atm_mpoa_qos *next;
|
||||
__be32 ipaddr;
|
||||
struct atm_qos qos;
|
||||
};
|
||||
|
||||
|
||||
|
@ -369,7 +369,7 @@ static eg_cache_entry *eg_cache_get_by_vcc(struct atm_vcc *vcc, struct mpoa_clie
|
||||
while (entry != NULL){
|
||||
if (entry->shortcut == vcc) {
|
||||
atomic_inc(&entry->use);
|
||||
read_unlock_irqrestore(&mpc->egress_lock, flags);
|
||||
read_unlock_irqrestore(&mpc->egress_lock, flags);
|
||||
return entry;
|
||||
}
|
||||
entry = entry->next;
|
||||
@ -388,7 +388,7 @@ static eg_cache_entry *eg_cache_get_by_src_ip(__be32 ipaddr, struct mpoa_client
|
||||
while(entry != NULL){
|
||||
if(entry->latest_ip_addr == ipaddr) {
|
||||
atomic_inc(&entry->use);
|
||||
read_unlock_irq(&mpc->egress_lock);
|
||||
read_unlock_irq(&mpc->egress_lock);
|
||||
return entry;
|
||||
}
|
||||
entry = entry->next;
|
||||
|
@ -12,66 +12,66 @@ struct mpoa_client;
|
||||
void atm_mpoa_init_cache(struct mpoa_client *mpc);
|
||||
|
||||
typedef struct in_cache_entry {
|
||||
struct in_cache_entry *next;
|
||||
struct in_cache_entry *prev;
|
||||
struct timeval tv;
|
||||
struct timeval reply_wait;
|
||||
struct timeval hold_down;
|
||||
uint32_t packets_fwded;
|
||||
uint16_t entry_state;
|
||||
uint32_t retry_time;
|
||||
uint32_t refresh_time;
|
||||
uint32_t count;
|
||||
struct atm_vcc *shortcut;
|
||||
uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
|
||||
struct in_ctrl_info ctrl_info;
|
||||
atomic_t use;
|
||||
struct in_cache_entry *next;
|
||||
struct in_cache_entry *prev;
|
||||
struct timeval tv;
|
||||
struct timeval reply_wait;
|
||||
struct timeval hold_down;
|
||||
uint32_t packets_fwded;
|
||||
uint16_t entry_state;
|
||||
uint32_t retry_time;
|
||||
uint32_t refresh_time;
|
||||
uint32_t count;
|
||||
struct atm_vcc *shortcut;
|
||||
uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
|
||||
struct in_ctrl_info ctrl_info;
|
||||
atomic_t use;
|
||||
} in_cache_entry;
|
||||
|
||||
struct in_cache_ops{
|
||||
in_cache_entry *(*add_entry)(__be32 dst_ip,
|
||||
struct mpoa_client *client);
|
||||
in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client);
|
||||
in_cache_entry *(*get_with_mask)(__be32 dst_ip,
|
||||
in_cache_entry *(*add_entry)(__be32 dst_ip,
|
||||
struct mpoa_client *client);
|
||||
in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client);
|
||||
in_cache_entry *(*get_with_mask)(__be32 dst_ip,
|
||||
struct mpoa_client *client,
|
||||
__be32 mask);
|
||||
in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc,
|
||||
struct mpoa_client *client);
|
||||
void (*put)(in_cache_entry *entry);
|
||||
void (*remove_entry)(in_cache_entry *delEntry,
|
||||
in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc,
|
||||
struct mpoa_client *client);
|
||||
void (*put)(in_cache_entry *entry);
|
||||
void (*remove_entry)(in_cache_entry *delEntry,
|
||||
struct mpoa_client *client );
|
||||
int (*cache_hit)(in_cache_entry *entry,
|
||||
struct mpoa_client *client);
|
||||
void (*clear_count)(struct mpoa_client *client);
|
||||
void (*check_resolving)(struct mpoa_client *client);
|
||||
void (*refresh)(struct mpoa_client *client);
|
||||
void (*destroy_cache)(struct mpoa_client *mpc);
|
||||
int (*cache_hit)(in_cache_entry *entry,
|
||||
struct mpoa_client *client);
|
||||
void (*clear_count)(struct mpoa_client *client);
|
||||
void (*check_resolving)(struct mpoa_client *client);
|
||||
void (*refresh)(struct mpoa_client *client);
|
||||
void (*destroy_cache)(struct mpoa_client *mpc);
|
||||
};
|
||||
|
||||
typedef struct eg_cache_entry{
|
||||
struct eg_cache_entry *next;
|
||||
struct eg_cache_entry *prev;
|
||||
struct timeval tv;
|
||||
uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
|
||||
struct atm_vcc *shortcut;
|
||||
uint32_t packets_rcvd;
|
||||
uint16_t entry_state;
|
||||
__be32 latest_ip_addr; /* The src IP address of the last packet */
|
||||
struct eg_ctrl_info ctrl_info;
|
||||
atomic_t use;
|
||||
struct eg_cache_entry *next;
|
||||
struct eg_cache_entry *prev;
|
||||
struct timeval tv;
|
||||
uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
|
||||
struct atm_vcc *shortcut;
|
||||
uint32_t packets_rcvd;
|
||||
uint16_t entry_state;
|
||||
__be32 latest_ip_addr; /* The src IP address of the last packet */
|
||||
struct eg_ctrl_info ctrl_info;
|
||||
atomic_t use;
|
||||
} eg_cache_entry;
|
||||
|
||||
struct eg_cache_ops{
|
||||
eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client);
|
||||
eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client);
|
||||
eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client);
|
||||
eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client);
|
||||
eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client);
|
||||
void (*put)(eg_cache_entry *entry);
|
||||
void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client);
|
||||
void (*update)(eg_cache_entry *entry, uint16_t holding_time);
|
||||
void (*clear_expired)(struct mpoa_client *client);
|
||||
void (*destroy_cache)(struct mpoa_client *mpc);
|
||||
eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client);
|
||||
eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client);
|
||||
eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client);
|
||||
eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client);
|
||||
eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client);
|
||||
void (*put)(eg_cache_entry *entry);
|
||||
void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client);
|
||||
void (*update)(eg_cache_entry *entry, uint16_t holding_time);
|
||||
void (*clear_expired)(struct mpoa_client *client);
|
||||
void (*destroy_cache)(struct mpoa_client *mpc);
|
||||
};
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ extern struct proc_dir_entry *atm_proc_root; /* from proc.c. */
|
||||
|
||||
static int proc_mpc_open(struct inode *inode, struct file *file);
|
||||
static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
|
||||
size_t nbytes, loff_t *ppos);
|
||||
size_t nbytes, loff_t *ppos);
|
||||
|
||||
static int parse_qos(const char *buff);
|
||||
|
||||
@ -52,18 +52,18 @@ static struct file_operations mpc_file_operations = {
|
||||
* Returns the state of an ingress cache entry as a string
|
||||
*/
|
||||
static const char *ingress_state_string(int state){
|
||||
switch(state) {
|
||||
switch(state) {
|
||||
case INGRESS_RESOLVING:
|
||||
return "resolving ";
|
||||
return "resolving ";
|
||||
break;
|
||||
case INGRESS_RESOLVED:
|
||||
return "resolved ";
|
||||
return "resolved ";
|
||||
break;
|
||||
case INGRESS_INVALID:
|
||||
return "invalid ";
|
||||
return "invalid ";
|
||||
break;
|
||||
case INGRESS_REFRESHING:
|
||||
return "refreshing ";
|
||||
return "refreshing ";
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
@ -74,15 +74,15 @@ static const char *ingress_state_string(int state){
|
||||
* Returns the state of an egress cache entry as a string
|
||||
*/
|
||||
static const char *egress_state_string(int state){
|
||||
switch(state) {
|
||||
switch(state) {
|
||||
case EGRESS_RESOLVED:
|
||||
return "resolved ";
|
||||
return "resolved ";
|
||||
break;
|
||||
case EGRESS_PURGE:
|
||||
return "purge ";
|
||||
return "purge ";
|
||||
break;
|
||||
case EGRESS_INVALID:
|
||||
return "invalid ";
|
||||
return "invalid ";
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
@ -190,51 +190,51 @@ static int proc_mpc_open(struct inode *inode, struct file *file)
|
||||
}
|
||||
|
||||
static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
|
||||
size_t nbytes, loff_t *ppos)
|
||||
size_t nbytes, loff_t *ppos)
|
||||
{
|
||||
char *page, *p;
|
||||
char *page, *p;
|
||||
unsigned len;
|
||||
|
||||
if (nbytes == 0)
|
||||
if (nbytes == 0)
|
||||
return 0;
|
||||
|
||||
if (nbytes >= PAGE_SIZE)
|
||||
if (nbytes >= PAGE_SIZE)
|
||||
nbytes = PAGE_SIZE-1;
|
||||
|
||||
page = (char *)__get_free_page(GFP_KERNEL);
|
||||
if (!page)
|
||||
page = (char *)__get_free_page(GFP_KERNEL);
|
||||
if (!page)
|
||||
return -ENOMEM;
|
||||
|
||||
for (p = page, len = 0; len < nbytes; p++, len++) {
|
||||
if (get_user(*p, buff++)) {
|
||||
for (p = page, len = 0; len < nbytes; p++, len++) {
|
||||
if (get_user(*p, buff++)) {
|
||||
free_page((unsigned long)page);
|
||||
return -EFAULT;
|
||||
}
|
||||
if (*p == '\0' || *p == '\n')
|
||||
break;
|
||||
}
|
||||
if (*p == '\0' || *p == '\n')
|
||||
break;
|
||||
}
|
||||
|
||||
*p = '\0';
|
||||
*p = '\0';
|
||||
|
||||
if (!parse_qos(page))
|
||||
printk("mpoa: proc_mpc_write: could not parse '%s'\n", page);
|
||||
printk("mpoa: proc_mpc_write: could not parse '%s'\n", page);
|
||||
|
||||
free_page((unsigned long)page);
|
||||
free_page((unsigned long)page);
|
||||
|
||||
return len;
|
||||
return len;
|
||||
}
|
||||
|
||||
static int parse_qos(const char *buff)
|
||||
{
|
||||
/* possible lines look like this
|
||||
* add 130.230.54.142 tx=max_pcr,max_sdu rx=max_pcr,max_sdu
|
||||
*/
|
||||
unsigned char ip[4];
|
||||
/* possible lines look like this
|
||||
* add 130.230.54.142 tx=max_pcr,max_sdu rx=max_pcr,max_sdu
|
||||
*/
|
||||
unsigned char ip[4];
|
||||
int tx_pcr, tx_sdu, rx_pcr, rx_sdu;
|
||||
__be32 ipaddr;
|
||||
__be32 ipaddr;
|
||||
struct atm_qos qos;
|
||||
|
||||
memset(&qos, 0, sizeof(struct atm_qos));
|
||||
memset(&qos, 0, sizeof(struct atm_qos));
|
||||
|
||||
if (sscanf(buff, "del %hhu.%hhu.%hhu.%hhu",
|
||||
ip, ip+1, ip+2, ip+3) == 4) {
|
||||
@ -250,14 +250,14 @@ static int parse_qos(const char *buff)
|
||||
ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu, &rx_pcr, &rx_sdu) != 8)
|
||||
return 0;
|
||||
|
||||
ipaddr = *(__be32 *)ip;
|
||||
ipaddr = *(__be32 *)ip;
|
||||
qos.txtp.traffic_class = ATM_CBR;
|
||||
qos.txtp.max_pcr = tx_pcr;
|
||||
qos.txtp.max_sdu = tx_sdu;
|
||||
qos.rxtp.traffic_class = ATM_CBR;
|
||||
qos.rxtp.max_pcr = rx_pcr;
|
||||
qos.rxtp.max_sdu = rx_sdu;
|
||||
qos.aal = ATM_AAL5;
|
||||
qos.aal = ATM_AAL5;
|
||||
dprintk("mpoa: mpoa_proc.c: parse_qos(): setting qos paramameters to tx=%d,%d rx=%d,%d\n",
|
||||
qos.txtp.max_pcr,
|
||||
qos.txtp.max_sdu,
|
||||
@ -276,11 +276,11 @@ int mpc_proc_init(void)
|
||||
{
|
||||
struct proc_dir_entry *p;
|
||||
|
||||
p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root);
|
||||
p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root);
|
||||
if (!p) {
|
||||
printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME);
|
||||
return -ENOMEM;
|
||||
}
|
||||
printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME);
|
||||
return -ENOMEM;
|
||||
}
|
||||
p->proc_fops = &mpc_file_operations;
|
||||
p->owner = THIS_MODULE;
|
||||
return 0;
|
||||
|
@ -257,7 +257,7 @@ static int atm_dev_seq_show(struct seq_file *seq, void *v)
|
||||
|
||||
atm_dev_info(seq, dev);
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct seq_operations atm_dev_seq_ops = {
|
||||
@ -316,29 +316,29 @@ static struct file_operations pvc_seq_fops = {
|
||||
|
||||
static int vcc_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
if (v == (void *)1) {
|
||||
seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s",
|
||||
"Address ", "Itf VPI VCI Fam Flags Reply "
|
||||
"Send buffer Recv buffer [refcnt]\n");
|
||||
} else {
|
||||
struct vcc_state *state = seq->private;
|
||||
struct atm_vcc *vcc = atm_sk(state->sk);
|
||||
if (v == (void *)1) {
|
||||
seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s",
|
||||
"Address ", "Itf VPI VCI Fam Flags Reply "
|
||||
"Send buffer Recv buffer [refcnt]\n");
|
||||
} else {
|
||||
struct vcc_state *state = seq->private;
|
||||
struct atm_vcc *vcc = atm_sk(state->sk);
|
||||
|
||||
vcc_info(seq, vcc);
|
||||
}
|
||||
return 0;
|
||||
vcc_info(seq, vcc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct seq_operations vcc_seq_ops = {
|
||||
.start = vcc_seq_start,
|
||||
.next = vcc_seq_next,
|
||||
.stop = vcc_seq_stop,
|
||||
.show = vcc_seq_show,
|
||||
.start = vcc_seq_start,
|
||||
.next = vcc_seq_next,
|
||||
.stop = vcc_seq_stop,
|
||||
.show = vcc_seq_show,
|
||||
};
|
||||
|
||||
static int vcc_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return __vcc_seq_open(inode, file, 0, &vcc_seq_ops);
|
||||
return __vcc_seq_open(inode, file, 0, &vcc_seq_ops);
|
||||
}
|
||||
|
||||
static struct file_operations vcc_seq_fops = {
|
||||
|
@ -72,7 +72,7 @@ static int pvc_setsockopt(struct socket *sock, int level, int optname,
|
||||
|
||||
|
||||
static int pvc_getsockopt(struct socket *sock, int level, int optname,
|
||||
char __user *optval, int __user *optlen)
|
||||
char __user *optval, int __user *optlen)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
int error;
|
||||
@ -91,7 +91,7 @@ static int pvc_getname(struct socket *sock,struct sockaddr *sockaddr,
|
||||
struct atm_vcc *vcc = ATM_SD(sock);
|
||||
|
||||
if (!vcc->dev || !test_bit(ATM_VF_ADDR,&vcc->flags)) return -ENOTCONN;
|
||||
*sockaddr_len = sizeof(struct sockaddr_atmpvc);
|
||||
*sockaddr_len = sizeof(struct sockaddr_atmpvc);
|
||||
addr = (struct sockaddr_atmpvc *) sockaddr;
|
||||
addr->sap_family = AF_ATMPVC;
|
||||
addr->sap_addr.itf = vcc->dev->number;
|
||||
|
@ -56,12 +56,12 @@ static int atm_send_aal0(struct atm_vcc *vcc,struct sk_buff *skb)
|
||||
* still work
|
||||
*/
|
||||
if (!capable(CAP_NET_ADMIN) &&
|
||||
(((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
|
||||
((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT)))
|
||||
(((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
|
||||
((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT)))
|
||||
{
|
||||
kfree_skb(skb);
|
||||
return -EADDRNOTAVAIL;
|
||||
}
|
||||
}
|
||||
return vcc->dev->ops->send(vcc,skb);
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
|
||||
*tmp_p++ = dev->number;
|
||||
}
|
||||
mutex_unlock(&atm_dev_mutex);
|
||||
error = ((copy_to_user(buf, tmp_buf, size)) ||
|
||||
error = ((copy_to_user(buf, tmp_buf, size)) ||
|
||||
put_user(size, &iobuf->length))
|
||||
? -EFAULT : 0;
|
||||
kfree(tmp_buf);
|
||||
@ -414,13 +414,13 @@ static __inline__ void *dev_get_idx(loff_t left)
|
||||
|
||||
void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
{
|
||||
mutex_lock(&atm_dev_mutex);
|
||||
mutex_lock(&atm_dev_mutex);
|
||||
return *pos ? dev_get_idx(*pos) : (void *) 1;
|
||||
}
|
||||
|
||||
void atm_dev_seq_stop(struct seq_file *seq, void *v)
|
||||
{
|
||||
mutex_unlock(&atm_dev_mutex);
|
||||
mutex_unlock(&atm_dev_mutex);
|
||||
}
|
||||
|
||||
void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
|
@ -89,7 +89,7 @@ static int svc_release(struct socket *sock)
|
||||
clear_bit(ATM_VF_READY, &vcc->flags);
|
||||
/* VCC pointer is used as a reference, so we must not free it
|
||||
(thereby subjecting it to re-use) before all pending connections
|
||||
are closed */
|
||||
are closed */
|
||||
svc_disconnect(vcc);
|
||||
vcc_release(sock);
|
||||
}
|
||||
@ -144,7 +144,7 @@ static int svc_bind(struct socket *sock,struct sockaddr *sockaddr,
|
||||
error = -EUNATCH;
|
||||
goto out;
|
||||
}
|
||||
if (!sk->sk_err)
|
||||
if (!sk->sk_err)
|
||||
set_bit(ATM_VF_BOUND,&vcc->flags);
|
||||
error = -sk->sk_err;
|
||||
out:
|
||||
@ -229,7 +229,7 @@ static int svc_connect(struct socket *sock,struct sockaddr *sockaddr,
|
||||
* This is tricky:
|
||||
* Kernel ---close--> Demon
|
||||
* Kernel <--close--- Demon
|
||||
* or
|
||||
* or
|
||||
* Kernel ---close--> Demon
|
||||
* Kernel <--error--- Demon
|
||||
* or
|
||||
@ -470,13 +470,13 @@ static int svc_setsockopt(struct socket *sock, int level, int optname,
|
||||
}
|
||||
set_bit(ATM_VF_HASSAP, &vcc->flags);
|
||||
break;
|
||||
case SO_MULTIPOINT:
|
||||
case SO_MULTIPOINT:
|
||||
if (level != SOL_ATM || optlen != sizeof(int)) {
|
||||
error = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (get_user(value, (int __user *) optval)) {
|
||||
error = -EFAULT;
|
||||
if (get_user(value, (int __user *) optval)) {
|
||||
error = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
if (value == 1) {
|
||||
@ -486,7 +486,7 @@ static int svc_setsockopt(struct socket *sock, int level, int optname,
|
||||
} else {
|
||||
error = -EINVAL;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
error = vcc_setsockopt(sock, level, optname,
|
||||
optval, optlen);
|
||||
@ -539,7 +539,7 @@ static int svc_addparty(struct socket *sock, struct sockaddr *sockaddr,
|
||||
set_bit(ATM_VF_WAITING, &vcc->flags);
|
||||
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
|
||||
sigd_enq(vcc, as_addparty, NULL, NULL,
|
||||
(struct sockaddr_atmsvc *) sockaddr);
|
||||
(struct sockaddr_atmsvc *) sockaddr);
|
||||
if (flags & O_NONBLOCK) {
|
||||
finish_wait(sk->sk_sleep, &wait);
|
||||
error = -EINPROGRESS;
|
||||
@ -587,26 +587,26 @@ out:
|
||||
|
||||
static int svc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int error, ep_ref;
|
||||
struct sockaddr_atmsvc sa;
|
||||
int error, ep_ref;
|
||||
struct sockaddr_atmsvc sa;
|
||||
struct atm_vcc *vcc = ATM_SD(sock);
|
||||
|
||||
switch (cmd) {
|
||||
case ATM_ADDPARTY:
|
||||
if (!test_bit(ATM_VF_SESSION, &vcc->flags))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&sa, (void __user *) arg, sizeof(sa)))
|
||||
case ATM_ADDPARTY:
|
||||
if (!test_bit(ATM_VF_SESSION, &vcc->flags))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&sa, (void __user *) arg, sizeof(sa)))
|
||||
return -EFAULT;
|
||||
error = svc_addparty(sock, (struct sockaddr *) &sa, sizeof(sa), 0);
|
||||
break;
|
||||
case ATM_DROPPARTY:
|
||||
if (!test_bit(ATM_VF_SESSION, &vcc->flags))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&ep_ref, (void __user *) arg, sizeof(int)))
|
||||
error = svc_addparty(sock, (struct sockaddr *) &sa, sizeof(sa), 0);
|
||||
break;
|
||||
case ATM_DROPPARTY:
|
||||
if (!test_bit(ATM_VF_SESSION, &vcc->flags))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&ep_ref, (void __user *) arg, sizeof(int)))
|
||||
return -EFAULT;
|
||||
error = svc_dropparty(sock, ep_ref);
|
||||
break;
|
||||
default:
|
||||
error = svc_dropparty(sock, ep_ref);
|
||||
break;
|
||||
default:
|
||||
error = vcc_ioctl(sock, cmd, arg);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user