您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tcf_hash函数代码示例

51自学网 2021-06-03 08:41:52
  C++
这篇教程C++ tcf_hash函数代码示例写得很实用,希望能帮到您。

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

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

示例1: tcf_del_walker

static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,			  struct tcf_hashinfo *hinfo){	struct tcf_common *p, *s_p;	struct nlattr *nest;	int i = 0, n_i = 0;	nest = nla_nest_start(skb, a->order);	if (nest == NULL)		goto nla_put_failure;	if (nla_put_string(skb, TCA_KIND, a->ops->kind))		goto nla_put_failure;	for (i = 0; i < (hinfo->hmask + 1); i++) {		p = hinfo->htab[tcf_hash(i, hinfo->hmask)];		while (p != NULL) {			s_p = p->tcfc_next;			if (ACT_P_DELETED == tcf_hash_release(p, 0, hinfo))				module_put(a->ops->owner);			n_i++;			p = s_p;		}	}	if (nla_put_u32(skb, TCA_FCNT, n_i))		goto nla_put_failure;	nla_nest_end(skb, nest);	return n_i;nla_put_failure:	nla_nest_cancel(skb, nest);	return -EINVAL;}
开发者ID:AiWinters,项目名称:linux,代码行数:32,


示例2: tcf_del_walker

static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a){	struct tcf_hashinfo *hinfo = a->ops->hinfo;	struct hlist_head *head;	struct hlist_node *n;	struct tcf_common *p;	struct nlattr *nest;	int i = 0, n_i = 0;	int ret = -EINVAL;	nest = nla_nest_start(skb, a->order);	if (nest == NULL)		goto nla_put_failure;	if (nla_put_string(skb, TCA_KIND, a->ops->kind))		goto nla_put_failure;	for (i = 0; i < (hinfo->hmask + 1); i++) {		head = &hinfo->htab[tcf_hash(i, hinfo->hmask)];		hlist_for_each_entry_safe(p, n, head, tcfc_head) {			a->priv = p;			ret = tcf_hash_release(a, 0);			if (ret == ACT_P_DELETED) {				module_put(a->ops->owner);				n_i++;			} else if (ret < 0)				goto nla_put_failure;		}	}
开发者ID:lovejavaee,项目名称:linux-2,代码行数:27,


示例3: tcf_del_walker

static int tcf_del_walker(struct tcf_hashinfo *hinfo, struct sk_buff *skb,			  const struct tc_action_ops *ops){	struct nlattr *nest;	int i = 0, n_i = 0;	int ret = -EINVAL;	nest = nla_nest_start(skb, 0);	if (nest == NULL)		goto nla_put_failure;	if (nla_put_string(skb, TCA_KIND, ops->kind))		goto nla_put_failure;	for (i = 0; i < (hinfo->hmask + 1); i++) {		struct hlist_head *head;		struct hlist_node *n;		struct tc_action *p;		head = &hinfo->htab[tcf_hash(i, hinfo->hmask)];		hlist_for_each_entry_safe(p, n, head, tcfa_head) {			ret = __tcf_hash_release(p, false, true);			if (ret == ACT_P_DELETED) {				module_put(p->ops->owner);				n_i++;			} else if (ret < 0)				goto nla_put_failure;		}	}
开发者ID:AK101111,项目名称:linux,代码行数:27,


示例4: tcf_del_walker

static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,			  struct tcf_hashinfo *hinfo){	struct tcf_common *p, *s_p;	struct rtattr *r ;	int i= 0, n_i = 0;	r = (struct rtattr*) skb->tail;	RTA_PUT(skb, a->order, 0, NULL);	RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);	for (i = 0; i < (hinfo->hmask + 1); i++) {		p = hinfo->htab[tcf_hash(i, hinfo->hmask)];		while (p != NULL) {			s_p = p->tcfc_next;			if (ACT_P_DELETED == tcf_hash_release(p, 0, hinfo))				 module_put(a->ops->owner);			n_i++;			p = s_p;		}	}	RTA_PUT(skb, TCA_FCNT, 4, &n_i);	r->rta_len = skb->tail - (u8*)r;	return n_i;rtattr_failure:	skb_trim(skb, (u8*)r - skb->data);	return -EINVAL;}
开发者ID:Voskrese,项目名称:mipsonqemu,代码行数:29,


示例5: tcf_hash_insert

void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo){	unsigned int h = tcf_hash(p->tcfc_index, hinfo->hmask);	write_lock_bh(hinfo->lock);	p->tcfc_next = hinfo->htab[h];	hinfo->htab[h] = p;	write_unlock_bh(hinfo->lock);}
开发者ID:AiWinters,项目名称:linux,代码行数:9,


示例6: read_lock_bh

struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo){	struct tcf_common *p;	read_lock_bh(hinfo->lock);	for (p = hinfo->htab[tcf_hash(index, hinfo->hmask)]; p;	     p = p->tcfc_next) {		if (p->tcfc_index == index)			break;	}	read_unlock_bh(hinfo->lock);	return p;}
开发者ID:AiWinters,项目名称:linux,代码行数:14,


示例7: tcf_act_police_walker

static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *cb,			      int type, struct tc_action *a){	struct tcf_common *p;	int err = 0, index = -1, i = 0, s_i = 0, n_i = 0;	struct nlattr *nest;	read_lock_bh(&police_lock);	s_i = cb->args[0];	for (i = 0; i < (POL_TAB_MASK + 1); i++) {		p = tcf_police_ht[tcf_hash(i, POL_TAB_MASK)];		for (; p; p = p->tcfc_next) {			index++;			if (index < s_i)				continue;			a->priv = p;			a->order = index;			nest = nla_nest_start(skb, a->order);			if (nest == NULL)				goto nla_put_failure;			if (type == RTM_DELACTION)				err = tcf_action_dump_1(skb, a, 0, 1);			else				err = tcf_action_dump_1(skb, a, 0, 0);			if (err < 0) {				index--;				nla_nest_cancel(skb, nest);				goto done;			}			nla_nest_end(skb, nest);			n_i++;		}	}done:	read_unlock_bh(&police_lock);	if (n_i)		cb->args[0] += n_i;	return n_i;nla_put_failure:	nla_nest_cancel(skb, nest);	goto done;}
开发者ID:NKSG,项目名称:INTER_MANET_NS3,代码行数:46,


示例8: tcf_dump_walker

static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,			   struct tc_action *a, struct tcf_hashinfo *hinfo){	struct tcf_common *p;	int err = 0, index = -1, i = 0, s_i = 0, n_i = 0;	struct nlattr *nest;	read_lock_bh(hinfo->lock);	s_i = cb->args[0];	for (i = 0; i < (hinfo->hmask + 1); i++) {		p = hinfo->htab[tcf_hash(i, hinfo->hmask)];		for (; p; p = p->tcfc_next) {			index++;			if (index < s_i)				continue;			a->priv = p;			a->order = n_i;			nest = nla_nest_start(skb, a->order);			if (nest == NULL)				goto nla_put_failure;			err = tcf_action_dump_1(skb, a, 0, 0);			if (err < 0) {				index--;				nlmsg_trim(skb, nest);				goto done;			}			nla_nest_end(skb, nest);			n_i++;			if (n_i >= TCA_ACT_MAX_PRIO)				goto done;		}	}done:	read_unlock_bh(hinfo->lock);	if (n_i)		cb->args[0] += n_i;	return n_i;nla_put_failure:	nla_nest_cancel(skb, nest);	goto done;}
开发者ID:AiWinters,项目名称:linux,代码行数:46,


示例9: 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,


示例10: tcf_dump_walker

static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,			   struct tc_action *a, struct tcf_hashinfo *hinfo){	struct tcf_common *p;	int err = 0, index = -1,i = 0, s_i = 0, n_i = 0;	struct rtattr *r ;	read_lock(hinfo->lock);	s_i = cb->args[0];	for (i = 0; i < (hinfo->hmask + 1); i++) {		p = hinfo->htab[tcf_hash(i, hinfo->hmask)];		for (; p; p = p->tcfc_next) {			index++;			if (index < s_i)				continue;			a->priv = p;			a->order = n_i;			r = (struct rtattr*) skb->tail;			RTA_PUT(skb, a->order, 0, NULL);			err = tcf_action_dump_1(skb, a, 0, 0);			if (err < 0) {				index--;				skb_trim(skb, (u8*)r - skb->data);				goto done;			}			r->rta_len = skb->tail - (u8*)r;			n_i++;			if (n_i >= TCA_ACT_MAX_PRIO)				goto done;		}	}done:	read_unlock(hinfo->lock);	if (n_i)		cb->args[0] += n_i;	return n_i;rtattr_failure:	skb_trim(skb, (u8*)r - skb->data);	goto done;}
开发者ID:Voskrese,项目名称:mipsonqemu,代码行数:44,


示例11: 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);#ifdef CONFIG_NET_ESTIMATOR			gen_kill_estimator(&p->tcfc_bstats,					   &p->tcfc_rate_est);#endif			kfree(p);			return;		}	}	BUG_TRAP(0);}
开发者ID:Voskrese,项目名称:mipsonqemu,代码行数:20,


示例12: tcf_police_destroy

static void tcf_police_destroy(struct tcf_police *p){	unsigned int h = tcf_hash(p->tcf_index, POL_TAB_MASK);	struct tcf_common **p1p;	for (p1p = &tcf_police_ht[h]; *p1p; p1p = &(*p1p)->tcfc_next) {		if (*p1p == &p->common) {			write_lock_bh(&police_lock);			*p1p = p->tcf_next;			write_unlock_bh(&police_lock);			gen_kill_estimator(&p->tcf_bstats,					   &p->tcf_rate_est);			if (p->tcfp_R_tab)				qdisc_put_rtab(p->tcfp_R_tab);			if (p->tcfp_P_tab)				qdisc_put_rtab(p->tcfp_P_tab);			kfree(p);			return;		}	}	BUG_TRAP(0);}
开发者ID:NKSG,项目名称:INTER_MANET_NS3,代码行数:22,


示例13: 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);			/*			 * gen_estimator est_timer() might access p->tcfc_lock			 * or bstats, wait a RCU grace period before freeing p			 */			kfree_rcu(p, tcfc_rcu);			return;		}	}	WARN_ON(1);}
开发者ID:AiWinters,项目名称:linux,代码行数:22,


示例14: tcf_dump_walker

static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,			   struct tc_action *a){	struct tcf_hashinfo *hinfo = a->ops->hinfo;	struct hlist_head *head;	struct tcf_common *p;	int err = 0, index = -1, i = 0, s_i = 0, n_i = 0;	struct nlattr *nest;	spin_lock_bh(&hinfo->lock);	s_i = cb->args[0];	for (i = 0; i < (hinfo->hmask + 1); i++) {		head = &hinfo->htab[tcf_hash(i, hinfo->hmask)];		hlist_for_each_entry_rcu(p, head, tcfc_head) {			index++;			if (index < s_i)				continue;			a->priv = p;			a->order = n_i;			nest = nla_nest_start(skb, a->order);			if (nest == NULL)				goto nla_put_failure;			err = tcf_action_dump_1(skb, a, 0, 0);			if (err < 0) {				index--;				nlmsg_trim(skb, nest);				goto done;			}			nla_nest_end(skb, nest);			n_i++;			if (n_i >= TCA_ACT_MAX_PRIO)				goto done;		}	}
开发者ID:lovejavaee,项目名称:linux-2,代码行数:38,



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


C++ tcf_hash_create函数代码示例
C++ tcf_csum_skb_nextlayer函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。