[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: __FILE__ (Re: [PATCH] framework for building modules externally)
From: |
Christian Franke |
Subject: |
Re: __FILE__ (Re: [PATCH] framework for building modules externally) |
Date: |
Thu, 06 Nov 2008 22:10:56 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11 |
Robert Millan wrote:
On Wed, Nov 05, 2008 at 10:41:20PM +0100, Christian Franke wrote:
PS: The current use of __FILE__ may also add extra unexpected size: For
packaging, configure is often run outside of $srcdir with a absolute
path name. This may result in long __FILE__ strings, like
/home/maintainer/packaging/grub/tmp/grub-1.96+20081105-1/src/grub-1.96/kern/disk.c
This has annoyed me for a while. Do you know a proper fix?
There is apparently no option to modify __FILE__ expansion. Therefore,
the relative file name has to be specified in the module itself.
See attached patch for a possible fix: Each module using grub_dprintf
(here disk.c) may specify its name in 'this_file'. When all modules are
changed, the '#define this_file' and all #undefs can be removed.
Christian
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 15c18f5..36e4bcc 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -27,7 +27,9 @@
#define ALIGN_UP(addr, align) (((grub_uint64_t)addr + align - 1) & ~(align -
1))
-#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__,
__LINE__, condition, fmt, ## args);
+#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(this_file,
__LINE__, condition, fmt, ## args);
+#define this_file __FILE__
+
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))
diff --git a/kern/disk.c b/kern/disk.c
index ed82506..039c011 100644
--- a/kern/disk.c
+++ b/kern/disk.c
@@ -25,6 +25,9 @@
#include <grub/time.h>
#include <grub/file.h>
+#undef this_file
+static const char this_file[] = "kern/disk.c";
+
#define GRUB_CACHE_TIMEOUT 2
/* The last time the disk was used. */
- [PATCH] framework for building modules externally, Robert Millan, 2008/11/01
- Re: [PATCH] framework for building modules externally, Robert Millan, 2008/11/01
- Re: [PATCH] framework for building modules externally, Vesa Jääskeläinen, 2008/11/04
- Re: [PATCH] framework for building modules externally, Robert Millan, 2008/11/04
- Re: [PATCH] framework for building modules externally, Vesa Jääskeläinen, 2008/11/04
- Re: [PATCH] framework for building modules externally, Robert Millan, 2008/11/04
- Re: [PATCH] framework for building modules externally, Christian Franke, 2008/11/05
- Re: [PATCH] framework for building modules externally, Robert Millan, 2008/11/05
- Re: [PATCH] framework for building modules externally, Christian Franke, 2008/11/05
- __FILE__ (Re: [PATCH] framework for building modules externally), Robert Millan, 2008/11/06
- Re: __FILE__ (Re: [PATCH] framework for building modules externally),
Christian Franke <=
- Re: __FILE__ (Re: [PATCH] framework for building modules externally), Robert Millan, 2008/11/07
- Re: __FILE__ (Re: [PATCH] framework for building modules externally), Christian Franke, 2008/11/10
- Re: [PATCH] framework for building modules externally, Robert Millan, 2008/11/06
- Re: [PATCH] framework for building modules externally, Christian Franke, 2008/11/06
- Re: [PATCH] framework for building modules externally, Robert Millan, 2008/11/07
- Re: [PATCH] framework for building modules externally, Robert Millan, 2008/11/08
- Re: [PATCH] framework for building modules externally, Christian Franke, 2008/11/10
Re: [PATCH] framework for building modules externally, Robert Millan, 2008/11/05