当前位置: 首页>>代码示例>>C++>>正文


C++ write_unlock_bh函数代码示例

本文整理汇总了C++中write_unlock_bh函数的典型用法代码示例。如果您正苦于以下问题:C++ write_unlock_bh函数的具体用法?C++ write_unlock_bh怎么用?C++ write_unlock_bh使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了write_unlock_bh函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: iscsi_sw_tcp_conn_set_callbacks

static void iscsi_sw_tcp_conn_set_callbacks(struct iscsi_conn *conn)
{
	struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
	struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
	struct sock *sk = tcp_sw_conn->sock->sk;

	/* assign new callbacks */
	write_lock_bh(&sk->sk_callback_lock);
	sk->sk_user_data = conn;
	tcp_sw_conn->old_data_ready = sk->sk_data_ready;
	tcp_sw_conn->old_state_change = sk->sk_state_change;
	tcp_sw_conn->old_write_space = sk->sk_write_space;
	sk->sk_data_ready = iscsi_sw_tcp_data_ready;
	sk->sk_state_change = iscsi_sw_tcp_state_change;
	sk->sk_write_space = iscsi_sw_tcp_write_space;
	write_unlock_bh(&sk->sk_callback_lock);
}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:17,代码来源:iscsi_tcp.c

示例2: rxrpc_remove_user_ID

/*
 * removal a call's user ID from the socket tree to make the user ID available
 * again and so that it won't be seen again in association with that call
 */
void rxrpc_remove_user_ID(struct rxrpc_sock *rx, struct rxrpc_call *call)
{
	_debug("RELEASE CALL %d", call->debug_id);

	if (test_bit(RXRPC_CALL_HAS_USERID, &call->flags)) {
		write_lock_bh(&rx->call_lock);
		rb_erase(&call->sock_node, &call->socket->calls);
		clear_bit(RXRPC_CALL_HAS_USERID, &call->flags);
		write_unlock_bh(&rx->call_lock);
	}

	read_lock_bh(&call->state_lock);
	if (!test_bit(RXRPC_CALL_RELEASED, &call->flags) &&
	    !test_and_set_bit(RXRPC_CALL_RELEASE, &call->events))
		rxrpc_queue_call(call);
	read_unlock_bh(&call->state_lock);
}
开发者ID:AICP,项目名称:kernel_moto_shamu,代码行数:21,代码来源:ar-recvmsg.c

示例3: ip6_tnl_dev_uninit

static void
ip6_tnl_dev_uninit(struct net_device *dev)
{
	struct ip6_tnl *t = netdev_priv(dev);
	struct net *net = dev_net(dev);
	struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);

	if (dev == ip6n->fb_tnl_dev) {
		write_lock_bh(&ip6_tnl_lock);
		ip6n->tnls_wc[0] = NULL;
		write_unlock_bh(&ip6_tnl_lock);
	} else {
		ip6_tnl_unlink(ip6n, t);
	}
	ip6_tnl_dst_reset(t);
	dev_put(dev);
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:17,代码来源:ip6_tunnel.c

示例4: dp_bfd_timer_send_callback

void dp_bfd_timer_send_callback(unsigned long mydis)
{    
    dp_bfd_session_s *session;
   
    session = dp_bfd_find_session_simple(mydis);
    if(NULL == session)
    {
        if(dp_bfd_debug & DEBUG_BFD_TIMER)
            printk("dp_bfd_timer_send_callback session not found\n");
        return;
    }
    
    session->flag &= (~DP_BFD_SEND_TIMER_ON);
    if(session->bfd_cyc_switch)
    {
        session->bfd_cyc_handshake_time++;
        if(session->bfd_cyc_handshake_time >= BFD_CYC_HANDSHAKE_TIMEOUT)
        {
            session->bfd_cyc_switch = 0;
            session->fail = 1;
            dp_bfd_send_event(session, EVENT_BFD_CYC_HANDSHAKE_TIMEOUT, BFD_EVENT_CRUCIAL);
        }
    }
        
    if(!(session->flag & DP_BFD_SEND_TIMER_ON))
    {
        session->send_timer.expires = jiffies + session->send_interval;
        session->send_timer.data = mydis;
        session->send_timer.function = dp_bfd_timer_send_callback;
        add_timer_on(&session->send_timer, 1);
        session->flag |= DP_BFD_SEND_TIMER_ON;
        
        if(dp_bfd_debug & DEBUG_BFD_TIMER)
            printk("dp_bfd_timer_send_callback add send_timer\n");
    }
    else
    {
        mod_timer(&session->send_timer, jiffies + session->send_interval);
        
        if(dp_bfd_debug & DEBUG_BFD_TIMER)
            printk("dp_bfd_timer_send_callback mod send_timer\n");
    }

    dp_bfd_send_msg(session, DP_BFD_SEND_CONTROL_PACKET);
    write_unlock_bh(&g_session_cask[session->packet.my_discriminator%256].session_lock);
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:46,代码来源:dp_bfd_deal.c

示例5: rxrpc_send_abort

/*
 * abort a call, sending an ABORT packet to the peer
 */
static void rxrpc_send_abort(struct rxrpc_call *call, u32 abort_code)
{
	write_lock_bh(&call->state_lock);

	if (call->state <= RXRPC_CALL_COMPLETE) {
		call->state = RXRPC_CALL_LOCALLY_ABORTED;
		call->abort_code = abort_code;
		set_bit(RXRPC_CALL_ABORT, &call->events);
		del_timer_sync(&call->resend_timer);
		del_timer_sync(&call->ack_timer);
		clear_bit(RXRPC_CALL_RESEND_TIMER, &call->events);
		clear_bit(RXRPC_CALL_ACK, &call->events);
		clear_bit(RXRPC_CALL_RUN_RTIMER, &call->flags);
		rxrpc_queue_call(call);
	}

	write_unlock_bh(&call->state_lock);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:21,代码来源:ar-output.c

示例6: tipc_net_start

int tipc_net_start(u32 addr)
{
	char addr_string[16];

	write_lock_bh(&tipc_net_lock);
	tipc_own_addr = addr;
	tipc_named_reinit();
	tipc_port_reinit();
	tipc_bclink_init();
	write_unlock_bh(&tipc_net_lock);

	tipc_cfg_reinit();

	pr_info("Started in network mode\n");
	pr_info("Own node address %s, network identity %u\n",
		tipc_addr_string_fill(addr_string, tipc_own_addr), tipc_net_id);
	return 0;
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:18,代码来源:net.c

示例7: aarp_expire_timeout

/* Handle the timer event */
static void aarp_expire_timeout(unsigned long unused)
{
	int ct;

	write_lock_bh(&aarp_lock);

	for (ct = 0; ct < AARP_HASH_SIZE; ct++) {
		__aarp_expire_timer(&resolved[ct]);
		__aarp_kick(&unresolved[ct]);
		__aarp_expire_timer(&unresolved[ct]);
		__aarp_expire_timer(&proxies[ct]);
	}

	write_unlock_bh(&aarp_lock);
	mod_timer(&aarp_timer, jiffies +
			       (unresolved_count ? sysctl_aarp_tick_time :
				sysctl_aarp_expiry_time));
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:19,代码来源:aarp.c

示例8: tcf_hash_destroy

void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo)
{
	unsigned int h = tcf_hash(p->tcfc_index, hinfo->hmask);
	struct tcf_common **p1p;

	for (p1p = &hinfo->htab[h]; *p1p; p1p = &(*p1p)->tcfc_next) {
		if (*p1p == p) {
			write_lock_bh(hinfo->lock);
			*p1p = p->tcfc_next;
			write_unlock_bh(hinfo->lock);
			gen_kill_estimator(&p->tcfc_bstats,
					   &p->tcfc_rate_est);
			kfree(p);
			return;
		}
	}
	WARN_ON(1);
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:18,代码来源:act_api.c

示例9: ipv6_add_dev

static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
{
	struct inet6_dev *ndev;

	ASSERT_RTNL();

	if (dev->mtu < IPV6_MIN_MTU)
		return NULL;

	ndev = kmalloc(sizeof(struct inet6_dev), GFP_KERNEL);

	if (ndev) {
		memset(ndev, 0, sizeof(struct inet6_dev));

		ndev->lock = RW_LOCK_UNLOCKED;
		ndev->dev = dev;
		memcpy(&ndev->cnf, &ipv6_devconf_dflt, sizeof(ndev->cnf));
		ndev->cnf.mtu6 = dev->mtu;
		ndev->cnf.sysctl = NULL;
		ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl);
		if (ndev->nd_parms == NULL) {
			kfree(ndev);
			return NULL;
		}
		inet6_dev_count++;
		/* We refer to the device */
		dev_hold(dev);

		write_lock_bh(&addrconf_lock);
		dev->ip6_ptr = ndev;
		/* One reference from device */
		in6_dev_hold(ndev);
		write_unlock_bh(&addrconf_lock);

		ipv6_mc_init_dev(ndev);

#ifdef CONFIG_SYSCTL
		neigh_sysctl_register(dev, ndev->nd_parms, NET_IPV6, NET_IPV6_NEIGH, "ipv6");
		addrconf_sysctl_register(ndev, &ndev->cnf);
#endif
	}
	return ndev;
}
开发者ID:hugh712,项目名称:Jollen,代码行数:43,代码来源:addrconf.c

示例10: xfrm_unregister_type

int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
{
	struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
	struct xfrm_type_map *typemap;
	int err = 0;

	if (unlikely(afinfo == NULL))
		return -EAFNOSUPPORT;
	typemap = afinfo->type_map;

	write_lock_bh(&typemap->lock);
	if (unlikely(typemap->map[type->proto] != type))
		err = -ENOENT;
	else
		typemap->map[type->proto] = NULL;
	write_unlock_bh(&typemap->lock);
	xfrm_policy_put_afinfo(afinfo);
	return err;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:19,代码来源:xfrm_policy.c

示例11: L2DATA

struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct neighbour *neigh,
			     struct net_device *dev)
{
	struct l2t_entry *e;
	struct l2t_data *d = L2DATA(cdev);
	u32 addr = *(u32 *) neigh->primary_key;
	int ifidx = neigh->dev->ifindex;
	int hash = arp_hash(addr, ifidx, d);
	struct port_info *p = netdev_priv(dev);
	int smt_idx = p->port_id;

	write_lock_bh(&d->lock);
	for (e = d->l2tab[hash].first; e; e = e->next)
		if (e->addr == addr && e->ifindex == ifidx &&
		    e->smt_idx == smt_idx) {
			l2t_hold(d, e);
			if (atomic_read(&e->refcnt) == 1)
				reuse_entry(e, neigh);
			goto done;
		}

	/* Need to allocate a new entry */
	e = alloc_l2e(d);
	if (e) {
		spin_lock(&e->lock);	/* avoid race with t3_l2t_free */
		e->next = d->l2tab[hash].first;
		d->l2tab[hash].first = e;
		e->state = L2T_STATE_RESOLVING;
		e->addr = addr;
		e->ifindex = ifidx;
		e->smt_idx = smt_idx;
		atomic_set(&e->refcnt, 1);
		neigh_replace(e, neigh);
		if (neigh->dev->priv_flags & IFF_802_1Q_VLAN)
			e->vlan = vlan_dev_vlan_id(neigh->dev);
		else
			e->vlan = VLAN_NONE;
		spin_unlock(&e->lock);
	}
done:
	write_unlock_bh(&d->lock);
	return e;
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:43,代码来源:l2t.c

示例12: arp_invalidate

static int arp_invalidate(struct net_device *dev, __be32 ip)
{
	struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev);
	int err = -ENXIO;
	struct neigh_table *tbl = &arp_tbl;

	if (neigh) {
		if (neigh->nud_state & ~NUD_NOARP)
			err = neigh_update(neigh, NULL, NUD_FAILED,
					   NEIGH_UPDATE_F_OVERRIDE|
					   NEIGH_UPDATE_F_ADMIN, 0);
		write_lock_bh(&tbl->lock);
		neigh_release(neigh);
		neigh_remove_one(neigh, tbl);
		write_unlock_bh(&tbl->lock);
	}

	return err;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:19,代码来源:arp.c

示例13: dp_bfd_timer_echo_receive_callback

void dp_bfd_timer_echo_receive_callback(unsigned long mydis)
{
    dp_bfd_session_s *session;  
    
    session = dp_bfd_find_session_simple(mydis);
    if(NULL == session)
    {
        if(dp_bfd_debug & DEBUG_BFD_TIMER)
            printk("dp_bfd_timer_echo_receive_callback session not found\n");
        return;
    }
    
    session->flag &= (~DP_BFD_ECHORECV_TIMER_ON);
    session->packet.sta = DOWN;
    session->packet.diag = ECHO_FUNCTION_FAILED;
    
    if(session->flag & DP_BFD_ECHOSEND_TIMER_ON)
    {
        del_timer_sync(&session->echo_send_timer);
        session->flag &= (~DP_BFD_ECHOSEND_TIMER_ON);
    }
    
    if(session->flag & DP_BFD_SEND_TIMER_ON)
    {
        del_timer_sync(&session->send_timer);
        session->flag &= (~DP_BFD_SEND_TIMER_ON);
    }
    if(session->flag & DP_BFD_RECEIVE_TIMER_ON)
    {
        del_timer_sync(&session->receive_timer);
        session->flag &= (~DP_BFD_RECEIVE_TIMER_ON);
    }
    
    dp_bfd_send_msg(session, DP_BFD_SEND_CONTROL_PACKET);
    
    session->packet.your_discriminator = 0;
    if(DP_BFD_INITIATIVE_MODE == session->session_mode)
    {
        dp_bfd_timer_cyc_handshake_add(session);
    }
    
    write_unlock_bh(&g_session_cask[session->packet.my_discriminator%256].session_lock);
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:43,代码来源:dp_bfd_deal.c

示例14: ip_mc_inc_group

void ip_mc_inc_group(struct in_device *in_dev, u32 addr)
{
    struct ip_mc_list *im;

    ASSERT_RTNL();

    for (im=in_dev->mc_list; im; im=im->next) {
        if (im->multiaddr == addr) {
            im->users++;
            goto out;
        }
    }

    im = (struct ip_mc_list *)kmalloc(sizeof(*im), GFP_KERNEL);
    if (!im)
        goto out;

    im->users=1;
    im->interface=in_dev;
    in_dev_hold(in_dev);
    im->multiaddr=addr;
    atomic_set(&im->refcnt, 1);
    spin_lock_init(&im->lock);
#ifdef  CONFIG_IP_MULTICAST
    im->tm_running=0;
    init_timer(&im->timer);
    im->timer.data=(unsigned long)im;
    im->timer.function=&igmp_timer_expire;
    im->unsolicit_count = IGMP_Unsolicited_Report_Count;
    im->reporter = 0;
#endif
    im->loaded = 0;
    write_lock_bh(&in_dev->lock);
    im->next=in_dev->mc_list;
    in_dev->mc_list=im;
    write_unlock_bh(&in_dev->lock);
    igmp_group_added(im);
    if (in_dev->dev->flags & IFF_UP)
        ip_rt_multicast_event(in_dev);
out:
    return;
}
开发者ID:jhbsz,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:42,代码来源:igmp.c

示例15: ip6mr_mfc_delete

static int ip6mr_mfc_delete(struct mf6cctl *mfc)
{
	int line;
	struct mfc6_cache *c, **cp;

	line = MFC6_HASH(&mfc->mf6cc_mcastgrp.sin6_addr, &mfc->mf6cc_origin.sin6_addr);

	for (cp = &mfc6_cache_array[line]; (c = *cp) != NULL; cp = &c->next) {
		if (ipv6_addr_equal(&c->mf6c_origin, &mfc->mf6cc_origin.sin6_addr) &&
		    ipv6_addr_equal(&c->mf6c_mcastgrp, &mfc->mf6cc_mcastgrp.sin6_addr)) {
			write_lock_bh(&mrt_lock);
			*cp = c->next;
			write_unlock_bh(&mrt_lock);

			kmem_cache_free(mrt_cachep, c);
			return 0;
		}
	}
	return -ENOENT;
}
开发者ID:IgnasD,项目名称:Tomato-RAF,代码行数:20,代码来源:ip6mr.c


注:本文中的write_unlock_bh函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。