4 * Copyright (C) 2001 Cluster File Systems, Inc.
6 * This code is issued under the GNU General Public License.
7 * See the file COPYING in this distribution
10 #include <linux/autoconf.h>
11 #include <linux/slab.h>
12 #include <linux/kp30.h>
14 /* global variables */
15 extern int obd_debug_level;
16 extern int obd_print_entry;
17 extern unsigned long obd_memory;
19 #define OBD_ALLOC(ptr, size) \
21 (ptr) = kmalloc((unsigned long)(size), GFP_KERNEL); \
22 if ((ptr) == NULL) { \
23 CERROR("kernel malloc failed at %s:%d\n", \
24 __FILE__, __LINE__); \
26 memset((ptr), 0, (size)); \
27 obd_memory += (size); \
29 CDEBUG(D_MALLOC, "kmalloced: %ld at %x (tot %ld).\n", \
30 (long)(size), (int)(ptr), obd_memory); \
33 #define OBD_FREE(ptr, size) \
36 CDEBUG(D_MALLOC, "kfreed: %d at %x (tot %ld).\n", \
37 (int)(size), (int)(ptr), obd_memory); \
38 obd_memory -= (size); \