本文整理汇总了C++中sk_add_node函数的典型用法代码示例。如果您正苦于以下问题:C++ sk_add_node函数的具体用法?C++ sk_add_node怎么用?C++ sk_add_node使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sk_add_node函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: __vcc_insert_socket
void __vcc_insert_socket(struct sock *sk)
{
struct atm_vcc *vcc = atm_sk(sk);
struct hlist_head *head = &vcc_hash[vcc->vci &
(VCC_HTABLE_SIZE - 1)];
sk->sk_hashent = vcc->vci & (VCC_HTABLE_SIZE - 1);
sk_add_node(sk, head);
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:8,代码来源:common.c
示例2: pn_sock_hash
void pn_sock_hash(struct sock *sk)
{
struct hlist_head *hlist = pn_hash_list(pn_sk(sk)->sobject);
spin_lock_bh(&pnsocks.lock);
sk_add_node(sk, hlist);
spin_unlock_bh(&pnsocks.lock);
}
开发者ID:CallMeVentus,项目名称:i9070_kernel_CoCore-P,代码行数:8,代码来源:socket.c
示例3: raw_v4_hash
static void raw_v4_hash(struct sock *sk)
{
struct hlist_head *head = &raw_v4_htable[inet_sk(sk)->num &
(RAWV4_HTABLE_SIZE - 1)];
write_lock_bh(&raw_v4_lock);
sk_add_node(sk, head);
sock_prot_inc_use(sk->sk_prot);
write_unlock_bh(&raw_v4_lock);
}
开发者ID:OpenHMR,项目名称:Open-HMR600,代码行数:10,代码来源:raw.c
示例4: raw_hash_sk
void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h)
{
struct hlist_head *head;
head = &h->ht[inet_sk(sk)->num & (RAW_HTABLE_SIZE - 1)];
write_lock_bh(&h->lock);
sk_add_node(sk, head);
sock_prot_inc_use(sk->sk_prot);
write_unlock_bh(&h->lock);
}
开发者ID:Mr-Aloof,项目名称:wl500g,代码行数:11,代码来源:raw.c
示例5: raw_hash_sk
void raw_hash_sk(struct sock *sk)
{
struct raw_hashinfo *h = sk->sk_prot->h.raw_hash;
struct hlist_head *head;
head = &h->ht[inet_sk(sk)->inet_num & (RAW_HTABLE_SIZE - 1)];
write_lock_bh(&h->lock);
sk_add_node(sk, head);
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
write_unlock_bh(&h->lock);
}
开发者ID:Lanyaaki,项目名称:ipaugenblick,代码行数:12,代码来源:raw.c
示例6: pep_sk
static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp)
{
struct pep_sock *pn = pep_sk(sk);
struct sock *newsk = NULL;
struct sk_buff *oskb;
int err;
lock_sock(sk);
err = pep_wait_connreq(sk, flags & O_NONBLOCK);
if (err)
goto out;
newsk = __sk_head(&pn->ackq);
oskb = skb_dequeue(&newsk->sk_receive_queue);
err = pep_accept_conn(newsk, oskb);
if (err) {
skb_queue_head(&newsk->sk_receive_queue, oskb);
newsk = NULL;
goto out;
}
kfree_skb(oskb);
sock_hold(sk);
pep_sk(newsk)->listener = sk;
sock_hold(newsk);
sk_del_node_init(newsk);
sk_acceptq_removed(sk);
sk_add_node(newsk, &pn->hlist);
__sock_put(newsk);
out:
release_sock(sk);
*errp = err;
return newsk;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:37,代码来源:pep.c
示例7: pep_connreq_rcv
static int pep_connreq_rcv(struct sock *sk, struct sk_buff *skb)
{
struct sock *newsk;
struct pep_sock *newpn, *pn = pep_sk(sk);
struct pnpipehdr *hdr;
struct sockaddr_pn dst;
u16 peer_type;
u8 pipe_handle, enabled, n_sb;
u8 aligned = 0;
if (!pskb_pull(skb, sizeof(*hdr) + 4))
return -EINVAL;
hdr = pnp_hdr(skb);
pipe_handle = hdr->pipe_handle;
switch (hdr->state_after_connect) {
case PN_PIPE_DISABLE:
enabled = 0;
break;
case PN_PIPE_ENABLE:
enabled = 1;
break;
default:
pep_reject_conn(sk, skb, PN_PIPE_ERR_INVALID_PARAM);
return -EINVAL;
}
peer_type = hdr->other_pep_type << 8;
if (unlikely(sk->sk_state != TCP_LISTEN) || sk_acceptq_is_full(sk)) {
pep_reject_conn(sk, skb, PN_PIPE_ERR_PEP_IN_USE);
return -ENOBUFS;
}
/* Parse sub-blocks (options) */
n_sb = hdr->data[4];
while (n_sb > 0) {
u8 type, buf[1], len = sizeof(buf);
const u8 *data = pep_get_sb(skb, &type, &len, buf);
if (data == NULL)
return -EINVAL;
switch (type) {
case PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE:
if (len < 1)
return -EINVAL;
peer_type = (peer_type & 0xff00) | data[0];
break;
case PN_PIPE_SB_ALIGNED_DATA:
aligned = data[0] != 0;
break;
}
n_sb--;
}
skb = skb_clone(skb, GFP_ATOMIC);
if (!skb)
return -ENOMEM;
/* Create a new to-be-accepted sock */
newsk = sk_alloc(sock_net(sk), PF_PHONET, GFP_ATOMIC, sk->sk_prot);
if (!newsk) {
kfree_skb(skb);
return -ENOMEM;
}
sock_init_data(NULL, newsk);
newsk->sk_state = TCP_SYN_RECV;
newsk->sk_backlog_rcv = pipe_do_rcv;
newsk->sk_protocol = sk->sk_protocol;
newsk->sk_destruct = pipe_destruct;
newpn = pep_sk(newsk);
pn_skb_get_dst_sockaddr(skb, &dst);
newpn->pn_sk.sobject = pn_sockaddr_get_object(&dst);
newpn->pn_sk.resource = pn->pn_sk.resource;
skb_queue_head_init(&newpn->ctrlreq_queue);
newpn->pipe_handle = pipe_handle;
atomic_set(&newpn->tx_credits, 0);
newpn->peer_type = peer_type;
newpn->rx_credits = 0;
newpn->rx_fc = newpn->tx_fc = PN_LEGACY_FLOW_CONTROL;
newpn->init_enable = enabled;
newpn->aligned = aligned;
BUG_ON(!skb_queue_empty(&newsk->sk_receive_queue));
skb_queue_head(&newsk->sk_receive_queue, skb);
if (!sock_flag(sk, SOCK_DEAD))
sk->sk_data_ready(sk, 0);
sk_acceptq_added(sk);
sk_add_node(newsk, &pn->ackq);
return 0;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:92,代码来源:pep.c
示例8: pep_sk
//.........这里部分代码省略.........
err = -EINVAL;
goto drop;
}
sk_acceptq_removed(sk);
err = -EPROTO;
if (!pskb_may_pull(skb, sizeof(*hdr) + 4))
goto drop;
hdr = pnp_hdr(skb);
pipe_handle = hdr->pipe_handle;
switch (hdr->state_after_connect) {
case PN_PIPE_DISABLE:
enabled = 0;
break;
case PN_PIPE_ENABLE:
enabled = 1;
break;
default:
pep_reject_conn(sk, skb, PN_PIPE_ERR_INVALID_PARAM,
GFP_KERNEL);
goto drop;
}
peer_type = hdr->other_pep_type << 8;
/* Parse sub-blocks (options) */
n_sb = hdr->data[4];
while (n_sb > 0) {
u8 type, buf[1], len = sizeof(buf);
const u8 *data = pep_get_sb(skb, &type, &len, buf);
if (data == NULL)
goto drop;
switch (type) {
case PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE:
if (len < 1)
goto drop;
peer_type = (peer_type & 0xff00) | data[0];
break;
case PN_PIPE_SB_ALIGNED_DATA:
aligned = data[0] != 0;
break;
}
n_sb--;
}
/* Check for duplicate pipe handle */
newsk = pep_find_pipe(&pn->hlist, &dst, pipe_handle);
if (unlikely(newsk)) {
__sock_put(newsk);
newsk = NULL;
pep_reject_conn(sk, skb, PN_PIPE_ERR_PEP_IN_USE, GFP_KERNEL);
goto drop;
}
/* Create a new to-be-accepted sock */
newsk = sk_alloc(sock_net(sk), PF_PHONET, GFP_KERNEL, sk->sk_prot);
if (!newsk) {
pep_reject_conn(sk, skb, PN_PIPE_ERR_OVERLOAD, GFP_KERNEL);
err = -ENOBUFS;
goto drop;
}
sock_init_data(NULL, newsk);
newsk->sk_state = TCP_SYN_RECV;
newsk->sk_backlog_rcv = pipe_do_rcv;
newsk->sk_protocol = sk->sk_protocol;
newsk->sk_destruct = pipe_destruct;
newpn = pep_sk(newsk);
pn_skb_get_dst_sockaddr(skb, &dst);
pn_skb_get_src_sockaddr(skb, &src);
newpn->pn_sk.sobject = pn_sockaddr_get_object(&dst);
newpn->pn_sk.dobject = pn_sockaddr_get_object(&src);
newpn->pn_sk.resource = pn_sockaddr_get_resource(&dst);
sock_hold(sk);
newpn->listener = sk;
skb_queue_head_init(&newpn->ctrlreq_queue);
newpn->pipe_handle = pipe_handle;
atomic_set(&newpn->tx_credits, 0);
newpn->ifindex = 0;
newpn->peer_type = peer_type;
newpn->rx_credits = 0;
newpn->rx_fc = newpn->tx_fc = PN_LEGACY_FLOW_CONTROL;
newpn->init_enable = enabled;
newpn->aligned = aligned;
err = pep_accept_conn(newsk, skb);
if (err) {
sock_put(newsk);
newsk = NULL;
goto drop;
}
sk_add_node(newsk, &pn->hlist);
drop:
release_sock(sk);
kfree_skb(skb);
*errp = err;
return newsk;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:101,代码来源:pep.c
示例9: lapd_pass_frame_to_socket_nt
static int lapd_pass_frame_to_socket_nt(
struct sk_buff *skb)
{
struct lapd_sock *listening_lapd_sock = NULL;
struct sock *sk = NULL;
struct hlist_node *node;
struct lapd_data_hdr *hdr = (struct lapd_data_hdr *)skb->data;
struct lapd_device *dev = to_lapd_dev(skb->dev);
int queued = 0;
write_lock_bh(&lapd_hash_lock);
sk_for_each(sk, node, lapd_get_hash(dev)) {
struct lapd_sock *lapd_sock = to_lapd_sock(sk);
if (lapd_sock->dev == dev) {
if (sk->sk_state == LAPD_SK_STATE_LISTEN) {
listening_lapd_sock = lapd_sock;
continue;
}
if (lapd_sock->sapi == hdr->addr.sapi &&
lapd_sock->tei == hdr->addr.tei) {
skb->sk = sk;
write_unlock_bh(&lapd_hash_lock);
queued = lapd_pass_frame_to_socket(
lapd_sock, skb);
goto frame_handled;
}
}
}
if (listening_lapd_sock) {
/* A socket has not been found */
struct lapd_data_hdr *hdr = (struct lapd_data_hdr *)skb->data;
struct lapd_sock *new_lapd_sock;
if (hdr->addr.sapi != LAPD_SAPI_Q931 &&
hdr->addr.sapi != LAPD_SAPI_X25) {
lapd_msg(KERN_WARNING,
"SAPI %d not supported\n",
hdr->addr.sapi);
}
new_lapd_sock = lapd_new_sock(listening_lapd_sock,
hdr->addr.tei, hdr->addr.sapi);
if (!new_lapd_sock) {
write_unlock_bh(&lapd_hash_lock);
return FALSE;
}
sk_add_node(&new_lapd_sock->sk, lapd_get_hash(dev));
write_unlock_bh(&lapd_hash_lock);
skb->sk = &new_lapd_sock->sk;
{
struct lapd_new_dlc *new_dlc;
new_dlc = kmalloc(sizeof(struct lapd_new_dlc), GFP_ATOMIC);
if (!new_dlc)
return FALSE;
new_dlc->lapd_sock = new_lapd_sock;
hlist_add_head(&new_dlc->node, &listening_lapd_sock->new_dlcs);
queued = lapd_pass_frame_to_socket(new_lapd_sock, skb);
if (!sock_flag(&listening_lapd_sock->sk, SOCK_DEAD))
listening_lapd_sock->sk.sk_data_ready(
&listening_lapd_sock->sk, skb->len);
}
} else {
lapd_handle_socketless_frame(skb);
write_unlock_bh(&lapd_hash_lock);
}
frame_handled:
return queued;
}
开发者ID:GunioRobot,项目名称:vstuff,代码行数:87,代码来源:input.c
注:本文中的sk_add_node函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论