2 * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.
\r
3 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
\r
5 * This software is available to you under the OpenIB.org BSD license
\r
8 * Redistribution and use in source and binary forms, with or
\r
9 * without modification, are permitted provided that the following
\r
10 * conditions are met:
\r
12 * - Redistributions of source code must retain the above
\r
13 * copyright notice, this list of conditions and the following
\r
16 * - Redistributions in binary form must reproduce the above
\r
17 * copyright notice, this list of conditions and the following
\r
18 * disclaimer in the documentation and/or other materials
\r
19 * provided with the distribution.
\r
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
\r
25 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
\r
26 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\r
36 * Definitions of Data-Structures for memory allocation tracking functions.
\r
43 #ifndef _CL_MEMTRACK_H_
\r
44 #define _CL_MEMTRACK_H_
\r
47 #include <complib/cl_types.h>
\r
48 #include <complib/cl_memory.h>
\r
49 #include <complib/cl_debug.h>
\r
50 #include <complib/cl_qmap.h>
\r
51 #include <complib/cl_spinlock.h>
\r
54 /* Structure to track memory allocations. */
\r
55 typedef struct _cl_mem_tracker
\r
57 /* List for tracking memory allocations. */
\r
58 cl_qmap_t alloc_map;
\r
60 /* Lock for synchronization. */
\r
63 /* List to manage free headers. */
\r
64 cl_qlist_t free_hdr_list;
\r
69 #define FILE_NAME_LENGTH 64
\r
72 /* Header for all memory allocations. */
\r
73 typedef struct _cl_malloc_hdr
\r
75 cl_map_item_t map_item;
\r
77 char file_name[FILE_NAME_LENGTH];
\r
83 extern cl_mem_tracker_t *gp_mem_tracker;
\r
85 #endif /* _CL_MEMTRACK_H_ */
\r