⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dst.c

📁 一个基于linux的TCP/IP协议栈的实现
💻 C
字号:
/* dst.c * linqianghe@163.com * 2006-11-13 */#include "dst.h"#if RT_CACHE_DEBUG >= 2 static atomic_t		mydst_total = ATOMIC_INIT(0);#endifstatic int mydst_discard_in(struct sk_buff *skb){	kfree_skb(skb);	return 0;}static int mydst_discard_out(struct sk_buff *skb){	kfree_skb(skb);	return 0;}void * mydst_alloc( struct dst_ops * ops ){	struct dst_entry * dst;	if( ops->gc && atomic_read(&ops->entries) > ops->gc_thresh ){		if( ops->gc() )			return NULL;	}	dst = kmem_cache_alloc( ops->kmem_cachep, SLAB_ATOMIC );	if( !dst )		return NULL;	memset( dst, 0, ops->entry_size );	atomic_set(&dst->__refcnt, 0);	dst->ops = ops;	dst->lastuse = jiffies;	dst->path = dst;	dst->input = mydst_discard_in;	dst->output = mydst_discard_out;#if RT_CACHE_DEBUG >= 2 	atomic_inc( &mydst_total );#endif	atomic_inc( &ops->entries );	return dst;}EXPORT_SYMBOL_GPL( mydst_alloc );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -