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

📄 my_memory.h

📁 iscsi源代码 UNH的progect 有initiator端和target端的源码
💻 H
字号:
/*	common/my_memory.h * *	vi: set autoindent tabstop=8 shiftwidth=8 : * *	This defines the generic functions used *	by both the iSCSI target and the iSCSI initiator for dynamic memory *	allocation. * *	This file contains auxilliary functions for iscsi initiator  *	code that are responsible for dealing with error recovery. * *	Copyright (C) 2001-2004 InterOperability Lab (IOL) *	University of New Hampshire (UNH) *	Durham, NH 03824 * *	This program is free software; you can redistribute it and/or modify *	it under the terms of the GNU General Public License as published by *	the Free Software Foundation; either version 2, or (at your option) *	any later version. * *	This program is distributed in the hope that it will be useful, *	but WITHOUT ANY WARRANTY; without even the implied warranty of *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *	GNU General Public License for more details. * *	You should have received a copy of the GNU General Public License *	along with this program; if not, write to the Free Software *	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, *	USA. * *	The name of IOL and/or UNH may not be used to endorse or promote  *	products derived from this software without specific prior  * 	written permission.*/#ifndef _MY_MEMORY_H#define _MY_MEMORY_H/* largest number of bytes kmalloc() will allocate as one block of memory */#define MAX_KMALLOC_SIZE		131072/*	called to allocate memory and keep a record of it */void *my_kmalloc(__u32 size, char *id);#ifdef ISCSI_CHECK_MEMORY/*	called only by my_kfree() when *ptr is not NULL */void _my_kfree(void **ptr, char *id);#else/*	as defined in linux/slab.h */extern void kfree(const void *);#endif/*	called to release memory allocated dynamically */static inline void __attribute__ ((no_instrument_function))my_kfree(void **ptr, char *id){	if (*ptr != NULL) {#ifdef ISCSI_CHECK_MEMORY		_my_kfree(ptr, id);#else		kfree(*ptr);		*ptr = NULL;#endif	}}#ifdef ISCSI_CHECK_MEMORYint_print_my_kmemory(char *buf);#endif/*	"prints" statistics on my memory usage into buf, *	returns no. of chars printed. */static inline int __attribute__ ((no_instrument_function))print_my_kmemory(char *buf){#ifdef ISCSI_CHECK_MEMORY	return _print_my_kmemory(buf);#else	return 0;#endif}#ifdef ISCSI_CHECK_MEMORYvoid _my_kempty(void);#endif/*	called only once, at very end when module is unloaded, *	to check for any allocated but not freed memory */static inline void __attribute__ ((no_instrument_function))my_kempty(void){#ifdef ISCSI_CHECK_MEMORY	_my_kempty();#endif}#endif

⌨️ 快捷键说明

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