netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	linux-netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH 1/4] printk: add %I4, %I6, %i4, %i6 format specifiers
Date: Thu, 30 Oct 2008 13:28:58 -0700	[thread overview]
Message-ID: <1225398538.1288.9.camel@localhost> (raw)
In-Reply-To: <1225305340.5688.36.camel@brick>

On Wed, 2008-10-29 at 11:35 -0700, Harvey Harrison wrote:
> For use in printing IPv4, or IPv6 addresses in the usual way:
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
>  lib/vsprintf.c |   31 +++++++++++++++++++++++++++++++
>  1 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index cb5bc04..a863006 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
[]
> @@ -650,6 +671,16 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field
>  		return mac_address_string(buf, end, ptr, field_width, precision, flags);
>  	case '6':
>  		return ip6_addr_string(buf, end, ptr, field_width, precision, flags);
> +	case 'i':
> +		flags |= SPECIAL;
> +		/* Fallthrough */
> +	case 'I':
> +		if (fmt[1] == '6')
> +			return ip6_addr_string(buf, end, ptr, field_width, precision, flags);
> +		if (fmt[1] == '4')
> +			return ip4_addr_string(buf, end, ptr, field_width, precision, flags);
> +		flags &= ~SPECIAL;
> +		break;
>  	}
>  	flags |= SMALL;
>  	if (field_width == -1) {

Hi Harvey.

I was thinking about extending %p<foo> to support
struct task_struct * and noticed this code isn't
really correct.

SPECIAL should be cleared from flags only when *fmt
is 'i' not 'I' and SPECIAL wasn't previously set.

cheers, Joe


  parent reply	other threads:[~2008-10-30 20:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 18:35 [PATCH 1/4] printk: add %I4, %I6, %i4, %i6 format specifiers Harvey Harrison
2008-10-29 20:04 ` David Miller
2008-10-30 20:28 ` Joe Perches [this message]
2008-10-30 23:59   ` Harvey Harrison

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=1225398538.1288.9.camel@localhost \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=harvey.harrison@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).