ubuffer.h

来自「一个NAND FLASH文件系统」· C头文件 代码 · 共 74 行

H
74
字号
/** * *	\file ubuffer.h *	\brief fast/static buffer management *	\author	Created by Ricky, 2003.6.10 * */#ifndef ___UBUFFER_H___#define ___UBUFFER_H___#ifdef __cplusplusextern "C"{#endif/**********************************************************************************************	global referenced macro defines & type defines*********************************************************************************************/struct ubufm{	void *node_pool;		/* data pool */	unsigned int node_size; /* data struct size */	unsigned int node_nums;	/* ubuf(data) num */	void *freeList;			/* free list, used by ubuf internal */	int lock;				/* buffer lock */};/**********************************************************************************************	global referenced variables*********************************************************************************************//**********************************************************************************************	global function prototype*********************************************************************************************//** init ubuffer data structure with given discriptor */int uBufInit(struct ubufm *dis); /** get buffer from pool */void * uBufGet(struct ubufm *dis);/** * get buffer from pool * this is Critical protect version, * you should use this version when multitherad  * access the same buffer pool */void * uBufGetCt(struct ubufm *dis);/** put buffer to pool */int uBufPut(void *p, struct ubufm *dis);/** * put buffer to pool,  * this is critical protect version, * you should use this version when multithread * access the same buffer pool */int uBufPutCt(void *p, struct ubufm *dis);/** get buffer pointer by index(offset) */void * uBufGetBufByIndex(unsigned int index, struct ubufm *dis);/** get index by pointer */int uBufGetIndex(void *p, struct ubufm *dis);#ifdef __cplusplus}#endif#endif

⌨️ 快捷键说明

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