[patch 1/5] kexec debug output improvments

Simon Horman horms at verge.net.au
Wed May 9 02:47:45 EDT 2007


On Tue, May 08, 2007 at 07:40:09AM -0700, Geoff Levand wrote:
> Simon Horman wrote:
> > On Mon, May 07, 2007 at 05:02:47PM -0700, Geoff Levand wrote:
> >> kexec debug output improvments.
> >>  - Add better type checking for the debug output macro dfprintf().
> >>  - Add a convenence macro dprintf().
> >> 
> >> Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
> >> ---
> >>  kexec/kexec.h |    6 ++++--
> >>  1 file changed, 4 insertions(+), 2 deletions(-)
> >> 
> >> --- kexec-tools-hacked.orig/kexec/kexec.h
> >> +++ kexec-tools-hacked/kexec/kexec.h
> >> @@ -217,10 +217,12 @@ int parse_iomem_single(char *str, uint64
> >>  
> >>  #define MAX_LINE	160
> >>  
> >> +#define dprintf(args...) dfprintf(stdout, args)
> >>  #ifdef DEBUG
> >> -#define dfprintf(args...)	do {fprintf(args);} while(0)
> >> +#define dfprintf(_f, _args...) do {fprintf(_f, _args);} while(0)
> >>  #else
> >> -#define dfprintf(args...)	do { } while(0)
> >> +static inline int __attribute__ ((format (printf, 1, 2)))
> >> +	dfprintf(FILE *f, const char *fmt, ...) {return 0;}
> >>  #endif
> > 
> > I think that this should be
> > 
> > static inline int __attribute__ ((format (printf, 2, 3)))
> > 
> > am I crazy?
> 
> Yes, you are not crazy!  My mistake.

Thanks, I've applied a version with that fix.

I also tried moving dprintf inside the #ifdef as suggested
by Vivek. Turns out that both he and I were (somewhat obviously)
wrong as if dprintf is in there and DEBUG isn't defined,
then dprintf doesn't exists at all, which kind of bothers code that
calls it.

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/




More information about the kexec mailing list