mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: akpm@linux-foundation.org, a.p.zijlstra@chello.nl,
	xemul@parallels.com, LKML <linux-kernel@vger.kernel.org>
Subject: Re: + procfs-add-vmflags-field-in-smaps-output-v3-fix-2.patch added to -mm tree
Date: Wed, 24 Oct 2012 20:47:46 +1100	[thread overview]
Message-ID: <20121024204746.8a8c0fa14b6495b5d5013db4@canb.auug.org.au> (raw)
In-Reply-To: <20121024084515.GB30983@moon>

[-- Attachment #1: Type: text/plain, Size: 1311 bytes --]

Hi Cyrill,

On Wed, 24 Oct 2012 12:45:15 +0400 Cyrill Gorcunov <gorcunov@openvz.org> wrote:
>
>  static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
>  {
> +#define __VM_FLAG(_f, _s)	[ilog2(_f)] = {(const char [2]){_s}}

I really don't think you need the cast (and it may hide bad usages) or
the second set of braces.  Thus:

#define __VM_FLAG(_f, _s)	[ilog2(_f)] = {_s}

> +
>  	/*
>  	 * Don't forget to update Documentation/ on changes.
>  	 */
> @@ -491,46 +493,49 @@ static void show_smap_vma_flags(struct s
>  		/*
>  		 * In case if we meet a flag we don't know about.
>  		 */
> -		[0 ... (BITS_PER_LONG-1)] = { {'?', '?'} },
> +		[0 ... (BITS_PER_LONG-1)] = { (const char [2]){"??"} },

And here.

Further is there any reason for the struct?

#define __VM_FLAG(_f, _s)	[ilog2(_f)] = _s

static const char mnemonics[BITS_PER_LONG][2] = {
...
};

>  	seq_puts(m, "VmFlags: ");
>  	for (i = 0; i < BITS_PER_LONG; i++) {
> -		if (vma->vm_flags & (1 << i))
> +		if (vma->vm_flags & (1ul << i)) {
>  			seq_printf(m, "%c%c ",
>  				   mnemonics[i].l[0],
>  				   mnemonics[i].l[1]);

				   mnemonics[i][0], mnemonics[i][1]

/me looks for another bike shed :-)
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-10-24  9:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20121023220300.1185C200057@hpza10.eem.corp.google.com>
2012-10-24  8:45 ` Cyrill Gorcunov
2012-10-24  9:24   ` Peter Zijlstra
2012-10-24  9:49     ` Cyrill Gorcunov
2012-10-24  9:47   ` Stephen Rothwell [this message]
2012-10-24  9:59     ` Cyrill Gorcunov
2012-10-24 10:26       ` Stephen Rothwell
2012-10-24 10:39         ` Cyrill Gorcunov

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=20121024204746.8a8c0fa14b6495b5d5013db4@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xemul@parallels.com \
    /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

all inboxes | Powered by JetHome®