xfs
[Top] [All Lists]

Re: [PATCH] New xfs_repair handling for inode nlink counts

To: Barry Naujok <bnaujok@xxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH] New xfs_repair handling for inode nlink counts
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 9 Mar 2007 07:34:10 +0000
Cc: xfs@xxxxxxxxxxx, xfs-dev@xxxxxxx
In-reply-to: <200703090619.RAA15327@larry.melbourne.sgi.com>
References: <200703090619.RAA15327@larry.melbourne.sgi.com>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.2.2i
+#ifdef TRACK_MEMORY
+
+#undef calloc
+#undef malloc
+#undef memalign
+#undef realloc
+#undef free


        Can you put all thise into a memory_tracking.h file that
        gets include with:

        #ifdef TRACK_MEMORY
        #include "track_memory.h"
        #endif

        Instead of polluting the implementation file?

+       /* add pointer to hash list, very basic simple hash function */
+       i = (((size_t)p) >> 8) & 0xff;

+       i = (((size_t)ptr) >> 8) & 0xff;

        Note that there is not guarantee that size_t and pointers have the
        same lenght, and there are system where it's not (win64?), better
        cast things use uintptr_t here.

--- xfsprogs.orig/repair/globals.h
+++ xfsprogs/repair/globals.h
@@ -16,6 +16,16 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#ifdef TRACK_MEMORY
+
+#define calloc(n,s)    track_calloc(__FILE__, __LINE__, (n), (s))
+#define malloc(s)      track_malloc(__FILE__, __LINE__, (s))
+#define memalign(b,s)  track_memalign(__FILE__, __LINE__, (b), (s))
+#define realloc(p,s)   track_realloc(__FILE__, __LINE__, (p), (s))
+#define free(p)                track_free(__FILE__, __LINE__, (p))
+
+#endif
+
 #ifndef _XFS_REPAIR_GLOBAL_H
 #define _XFS_REPAIR_GLOBAL_H

        The memory tracking should probably come after the inclusion
        guards.


<Prev in Thread] Current Thread [Next in Thread>