Re: [rfc 0/2] Introducing VmFlags field into smaps output
From: Stephen Rothwell
Date: Tue Oct 23 2012 - 19:56:43 EST
On Wed, 24 Oct 2012 00:32:54 +0200 Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:
>
> On Wed, 2012-10-24 at 01:59 +0400, Cyrill Gorcunov wrote:
> > [ilog2(VM_WRITE)] = { {'w', 'r'} },
>
> since we're being awfully positive about crazy late night ideas, how
> about something like:
>
> #define MNEM(_VM, _mn) [ilog2(_VM)] = {(const char [2]){_mn}}
>
> MNEM(VM_WRITE, "wr"),
The C standard and gcc allow you to initialise the 2 character array with
a (>=2 character) string literal with no casting, so
#define MNEM(_VM, _mn) [ilog2(_VM)] = {_mn}
should work.
[ and the the earlier version,
[ilog2(VM_READ)] = { "rd" },
etc, does work. ]
--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx
Attachment:
pgp00000.pgp
Description: PGP signature