From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OcreM-0006Dz-Hr for mharc-grub-devel@gnu.org; Sat, 24 Jul 2010 23:13:14 -0400 Received: from [140.186.70.92] (port=36234 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcreJ-0005nT-Bt for grub-devel@gnu.org; Sat, 24 Jul 2010 23:13:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OcrbE-0007Cj-Gj for grub-devel@gnu.org; Sat, 24 Jul 2010 23:10:01 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:49157 helo=mrelay2-d.mgt.gandi.net) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OcrbE-0007CS-Cf for grub-devel@gnu.org; Sat, 24 Jul 2010 23:10:00 -0400 X-Originating-IP: 217.70.178.41 Received: from mfilter1-d.gandi.net (mfilter1-d.gandi.net [217.70.178.41]) by mrelay2-d.mgt.gandi.net (Postfix) with ESMTP id AE0D622513E for ; Sun, 25 Jul 2010 05:09:58 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at gandi.net Received: from mrelay2-d.mgt.gandi.net ([217.70.183.194]) by mfilter1-d.gandi.net (mfilter1-d.gandi.net [217.70.178.41]) (amavisd-new, port 10024) with ESMTP id 3aRtH4lVAlyX for ; Sun, 25 Jul 2010 05:09:57 +0200 (CEST) X-Originating-IP: 74.107.143.84 Received: from feather (pool-74-107-143-84.ptldor.fios.verizon.net [74.107.143.84]) (Authenticated sender: josh@joshtriplett.org) by mrelay2-d.mgt.gandi.net (Postfix) with ESMTPSA id 8F75022513D for ; Sun, 25 Jul 2010 05:09:55 +0200 (CEST) Date: Sat, 24 Jul 2010 20:09:53 -0700 From: Josh Triplett To: grub-devel@gnu.org Message-ID: <20100725030948.GA25314@feather> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ReaqsoxgOBHFXBhH" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [PATCH] Add grub_dcprintf for continuations without file/line X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jul 2010 03:13:12 -0000 --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The attached patch adds a new variant of grub_dprintf, grub_dcprintf, which avoids printing the __FILE__:__LINE__: prefix. This allows printing a single line with multiple print statements; for instance: grub_dprintf("some_module", "Thingy: "); print_complicated_thingy(thingy); grub_dcprintf("some_module", ", more details here\n"); Without the dcprintf variant, this line will contain three different file/line prefixes. I also added support for a "no-file-line" token in the debug environment variable, which turns off the file/line prefixes entirely. - Josh Triplett --ReaqsoxgOBHFXBhH Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="grub-dprintf-no-file-line.patch" === modified file 'include/grub/misc.h' --- include/grub/misc.h 2010-07-02 17:35:07 +0000 +++ include/grub/misc.h 2010-07-24 21:33:29 +0000 @@ -47,6 +47,8 @@ #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; } #define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args) +/* A "continuation" variant of dprintf which doesn't print file and line. */ +#define grub_dcprintf(condition, fmt, args...) grub_real_dprintf(0, 0, condition, fmt, ## args) /* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */ #define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n)) === modified file 'kern/misc.c' --- kern/misc.c 2010-07-02 17:35:07 +0000 +++ kern/misc.c 2010-07-24 21:17:37 +0000 @@ -180,7 +180,8 @@ if (grub_strword (debug, "all") || grub_strword (debug, condition)) { - grub_printf ("%s:%d: ", file, line); + if (line != 0 && !grub_strword (debug, "no-file-line")) + grub_printf ("%s:%d: ", file, line); va_start (args, fmt); grub_vprintf (fmt, args); va_end (args); --ReaqsoxgOBHFXBhH--