From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KyC8P-0004sU-8p for mharc-grub-devel@gnu.org; Thu, 06 Nov 2008 16:11:21 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KyC8N-0004qz-Un for grub-devel@gnu.org; Thu, 06 Nov 2008 16:11:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KyC8M-0004pt-Bi for grub-devel@gnu.org; Thu, 06 Nov 2008 16:11:19 -0500 Received: from [199.232.76.173] (port=37820 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KyC8M-0004pq-66 for grub-devel@gnu.org; Thu, 06 Nov 2008 16:11:18 -0500 Received: from mailout02.t-online.de ([194.25.134.17]:49296) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KyC8K-0007xN-QZ for grub-devel@gnu.org; Thu, 06 Nov 2008 16:11:17 -0500 Received: from fwd07.aul.t-online.de by mailout02.sul.t-online.de with smtp id 1KyC8J-0000hp-00; Thu, 06 Nov 2008 22:11:15 +0100 Received: from [10.3.2.2] (ZGjo6kZvohRjd6CrlEdoYe8DFBs6iVwajAPXJLYSwbSDxnewqKjRynbCQXIBuOaZXm@[217.235.218.64]) by fwd07.aul.t-online.de with esmtp id 1KyC82-17DeIS0; Thu, 6 Nov 2008 22:10:58 +0100 Message-ID: <49135D60.5080400@t-online.de> Date: Thu, 06 Nov 2008 22:10:56 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11 MIME-Version: 1.0 To: The development of GRUB 2 References: <20081101123229.GA14438@thorin> <20081101190204.GB4639@thorin> <49109AB8.4010509@nic.fi> <20081104190751.GA25519@thorin> <49109EE7.6050406@nic.fi> <20081104193911.GA26419@thorin> <491143E2.4040705@t-online.de> <20081105094240.GA12201@thorin> <49121300.2050506@t-online.de> <20081106145252.GA24460@thorin> In-Reply-To: <20081106145252.GA24460@thorin> Content-Type: multipart/mixed; boundary="------------090403090206080502040907" X-ID: ZGjo6kZvohRjd6CrlEdoYe8DFBs6iVwajAPXJLYSwbSDxnewqKjRynbCQXIBuOaZXm X-TOI-MSGID: 3bdac3e7-cdb5-48cf-832f-5a7337824121 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: __FILE__ (Re: [PATCH] framework for building modules externally) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2008 21:11:20 -0000 This is a multi-part message in MIME format. --------------090403090206080502040907 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------090403090206080502040907 Content-Type: text/x-patch; name="grub2-dprintf-file.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-dprintf-file.patch" 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 #include +#undef this_file +static const char this_file[] = "kern/disk.c"; + #define GRUB_CACHE_TIMEOUT 2 /* The last time the disk was used. */ --------------090403090206080502040907--