From: Christoph Hellwig <hch@infradead.org>
To: Barry Naujok <bnaujok@melbourne.sgi.com>
Cc: xfs@oss.sgi.com, xfs-dev@sgi.com
Subject: Re: [PATCH] New xfs_repair handling for inode nlink counts
Date: Fri, 9 Mar 2007 07:34:10 +0000 [thread overview]
Message-ID: <20070309073410.GA8798@infradead.org> (raw)
In-Reply-To: <200703090619.RAA15327@larry.melbourne.sgi.com>
+#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.
next prev parent reply other threads:[~2007-03-09 7:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-09 6:20 [PATCH] New xfs_repair handling for inode nlink counts Barry Naujok
2007-03-09 7:34 ` Christoph Hellwig [this message]
2007-03-13 1:51 ` Barry Naujok
2007-03-17 11:45 ` 'Christoph Hellwig'
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070309073410.GA8798@infradead.org \
--to=hch@infradead.org \
--cc=bnaujok@melbourne.sgi.com \
--cc=xfs-dev@sgi.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox