diff mbox

device-mapper: Convert printks to pr_<level> macros

Message ID 265c09d8869388ced29b91fcae8d6f936ed2ad13.1492455602.git.joe@perches.com (mailing list archive)
State Superseded, archived
Delegated to: Mike Snitzer
Headers show

Commit Message

Joe Perches April 17, 2017, 7 p.m. UTC
Using pr_<level> is the more common logging style.

In addition, using the pr_<level> macros could shrink the kernel image
if/when the macros are converted to functions.

Miscellanea:

o Standardize style and use pr_fmt to prefix the output
o Standardize the DMDEBUG and DMDEBUG_LIMIT output prefix

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/device-mapper.h | 81 ++++++++++++++++++++++---------------------
 1 file changed, 42 insertions(+), 39 deletions(-)

Comments

kernel test robot April 17, 2017, 9:02 p.m. UTC | #1
Hi Joe,

[auto build test ERROR on v4.9-rc8]
[also build test ERROR on next-20170413]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Joe-Perches/device-mapper-Convert-printks-to-pr_-level-macros/20170418-030508
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from fs/nfs/blocklayout/blocklayout.h:35:0,
                    from fs/nfs/blocklayout/dev.c:11:
   fs/nfs/blocklayout/dev.c: In function 'bl_free_device':
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
>> include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                     ^~~~~~
>> fs/nfs/blocklayout/dev.c:33:5: note: in expansion of macro 'pr_err'
        pr_err("failed to unregister PR key.\n");
        ^~~~~~
   fs/nfs/blocklayout/dev.c: In function 'nfs4_block_decode_volume':
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
   include/linux/printk.h:284:19: note: in expansion of macro 'pr_fmt'
     printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                      ^~~~~~
>> fs/nfs/blocklayout/dev.c:81:5: note: in expansion of macro 'pr_info'
        pr_info("signature too long: %d\n",
        ^~~~~~~
   fs/nfs/blocklayout/dev.c: In function 'bl_validate_designator':
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
>> include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                     ^~~~~~
   fs/nfs/blocklayout/dev.c:287:3: note: in expansion of macro 'pr_err'
      pr_err("pNFS: unsupported designator "
      ^~~~~~
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
>> include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                     ^~~~~~
   fs/nfs/blocklayout/dev.c:294:3: note: in expansion of macro 'pr_err'
      pr_err("pNFS: invalid designator "
      ^~~~~~
   fs/nfs/blocklayout/dev.c: In function 'bl_open_udev_path':
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
   include/linux/printk.h:279:22: note: in expansion of macro 'pr_fmt'
     printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
                         ^~~~~~
   include/linux/printk.h:280:17: note: in expansion of macro 'pr_warning'
    #define pr_warn pr_warning
                    ^~~~~~~~~~
>> fs/nfs/blocklayout/dev.c:320:3: note: in expansion of macro 'pr_warn'
      pr_warn("pNFS: failed to open device %s (%ld)\n",
      ^~~~~~~
   fs/nfs/blocklayout/dev.c: In function 'bl_parse_scsi':
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
   include/linux/printk.h:284:19: note: in expansion of macro 'pr_fmt'
     printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                      ^~~~~~
   fs/nfs/blocklayout/dev.c:373:2: note: in expansion of macro 'pr_info'
     pr_info("pNFS: using block device %s (reservation key 0x%llx)\n",
     ^~~~~~~
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
>> include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                     ^~~~~~
   fs/nfs/blocklayout/dev.c:378:3: note: in expansion of macro 'pr_err'
      pr_err("pNFS: block device %s does not support reservations.",
      ^~~~~~
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
>> include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                     ^~~~~~
   fs/nfs/blocklayout/dev.c:386:3: note: in expansion of macro 'pr_err'
      pr_err("pNFS: failed to register key for block device %s.",
      ^~~~~~
--
   In file included from fs/nfs/blocklayout/blocklayout.h:35:0,
                    from fs/nfs/blocklayout/extent_tree.c:7:
   include/linux/netdevice.h: In function 'netdev_cap_txqueue':
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
   include/linux/printk.h:279:22: note: in expansion of macro 'pr_fmt'
     printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
                         ^~~~~~
>> include/linux/net.h:238:3: note: in expansion of macro 'pr_warning'
      function(__VA_ARGS__);    \
      ^~~~~~~~
>> include/linux/net.h:252:2: note: in expansion of macro 'net_ratelimited_function'
     net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/net.h:252:27: note: in expansion of macro 'pr_warn'
     net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
                              ^~~~~~~
>> include/linux/netdevice.h:3119:3: note: in expansion of macro 'net_warn_ratelimited'
      net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n",
      ^~~~~~~~~~~~~~~~~~~~
   include/net/inet_connection_sock.h: In function 'inet_csk_clear_xmit_timer':
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
   include/linux/dynamic_debug.h:126:35: note: in expansion of macro 'pr_fmt'
      __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
                                      ^~~~~~
   include/linux/printk.h:309:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> include/net/inet_connection_sock.h:213:3: note: in expansion of macro 'pr_debug'
      pr_debug("%s", inet_csk_timer_bug_msg);
      ^~~~~~~~
   include/net/inet_connection_sock.h: In function 'inet_csk_reset_xmit_timer':
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
   include/linux/dynamic_debug.h:126:35: note: in expansion of macro 'pr_fmt'
      __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
                                      ^~~~~~
   include/linux/printk.h:309:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   include/net/inet_connection_sock.h:229:3: note: in expansion of macro 'pr_debug'
      pr_debug("reset_xmit_timer: sk=%p %d when=0x%lx, caller=%p\n",
      ^~~~~~~~
>> include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
    #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
                                     ^
   include/linux/dynamic_debug.h:126:35: note: in expansion of macro 'pr_fmt'
      __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
                                      ^~~~~~
   include/linux/printk.h:309:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   include/net/inet_connection_sock.h:247:3: note: in expansion of macro 'pr_debug'
      pr_debug("%s", inet_csk_timer_bug_msg);
      ^~~~~~~~

vim +536 include/linux/device-mapper.h

   530	#endif
   531	
   532	#ifdef pr_fmt
   533	#undef pr_fmt
   534	#endif
   535	
 > 536	#define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
   537	
   538	#define DMCRIT(fmt, ...)						\
   539		pr_crit(fmt "\n", ##__VA_ARGS__)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Joe Perches April 18, 2017, 2:51 a.m. UTC | #2
There is an argument for using these #pragmas for pr_fmt.

gcc/clang/icc all support push_macro and pop_macro pragmas.

As far as I can tell, these compilers are the only ones
used to compile
the kernel.

Anyone have any objection to using these pragmas?

On Tue, 2017-04-18 at 05:02 +0800, kbuild test robot wrote:
> Hi Joe,
> 
> [auto build test ERROR on v4.9-rc8]
> [also build test ERROR on next-20170413]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Joe-Perches/device-mapper-Convert-printks-to-pr_-level-macros/20170418-030508
> config: i386-allmodconfig (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386 
> 
> All error/warnings (new ones prefixed by >>):
> 
>    In file included from fs/nfs/blocklayout/blocklayout.h:35:0,
>                     from fs/nfs/blocklayout/dev.c:11:
>    fs/nfs/blocklayout/dev.c: In function 'bl_free_device':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
> > > fs/nfs/blocklayout/dev.c:33:5: note: in expansion of macro 'pr_err'
> 
>         pr_err("failed to unregister PR key.\n");
>         ^~~~~~
>    fs/nfs/blocklayout/dev.c: In function 'nfs4_block_decode_volume':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/printk.h:284:19: note: in expansion of macro 'pr_fmt'
>      printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
>                       ^~~~~~
> > > fs/nfs/blocklayout/dev.c:81:5: note: in expansion of macro 'pr_info'
> 
>         pr_info("signature too long: %d\n",
>         ^~~~~~~
>    fs/nfs/blocklayout/dev.c: In function 'bl_validate_designator':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
>    fs/nfs/blocklayout/dev.c:287:3: note: in expansion of macro 'pr_err'
>       pr_err("pNFS: unsupported designator "
>       ^~~~~~
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
>    fs/nfs/blocklayout/dev.c:294:3: note: in expansion of macro 'pr_err'
>       pr_err("pNFS: invalid designator "
>       ^~~~~~
>    fs/nfs/blocklayout/dev.c: In function 'bl_open_udev_path':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/printk.h:279:22: note: in expansion of macro 'pr_fmt'
>      printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
>                          ^~~~~~
>    include/linux/printk.h:280:17: note: in expansion of macro 'pr_warning'
>     #define pr_warn pr_warning
>                     ^~~~~~~~~~
> > > fs/nfs/blocklayout/dev.c:320:3: note: in expansion of macro 'pr_warn'
> 
>       pr_warn("pNFS: failed to open device %s (%ld)\n",
>       ^~~~~~~
>    fs/nfs/blocklayout/dev.c: In function 'bl_parse_scsi':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/printk.h:284:19: note: in expansion of macro 'pr_fmt'
>      printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
>                       ^~~~~~
>    fs/nfs/blocklayout/dev.c:373:2: note: in expansion of macro 'pr_info'
>      pr_info("pNFS: using block device %s (reservation key 0x%llx)\n",
>      ^~~~~~~
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
>    fs/nfs/blocklayout/dev.c:378:3: note: in expansion of macro 'pr_err'
>       pr_err("pNFS: block device %s does not support reservations.",
>       ^~~~~~
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
>    fs/nfs/blocklayout/dev.c:386:3: note: in expansion of macro 'pr_err'
>       pr_err("pNFS: failed to register key for block device %s.",
>       ^~~~~~
> --
>    In file included from fs/nfs/blocklayout/blocklayout.h:35:0,
>                     from fs/nfs/blocklayout/extent_tree.c:7:
>    include/linux/netdevice.h: In function 'netdev_cap_txqueue':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/printk.h:279:22: note: in expansion of macro 'pr_fmt'
>      printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
>                          ^~~~~~
> > > include/linux/net.h:238:3: note: in expansion of macro 'pr_warning'
> 
>       function(__VA_ARGS__);    \
>       ^~~~~~~~
> > > include/linux/net.h:252:2: note: in expansion of macro 'net_ratelimited_function'
> 
>      net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
>      ^~~~~~~~~~~~~~~~~~~~~~~~
> > > include/linux/net.h:252:27: note: in expansion of macro 'pr_warn'
> 
>      net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
>                               ^~~~~~~
> > > include/linux/netdevice.h:3119:3: note: in expansion of macro 'net_warn_ratelimited'
> 
>       net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n",
>       ^~~~~~~~~~~~~~~~~~~~
>    include/net/inet_connection_sock.h: In function 'inet_csk_clear_xmit_timer':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/dynamic_debug.h:126:35: note: in expansion of macro 'pr_fmt'
>       __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
>                                       ^~~~~~
>    include/linux/printk.h:309:2: note: in expansion of macro 'dynamic_pr_debug'
>      dynamic_pr_debug(fmt, ##__VA_ARGS__)
>      ^~~~~~~~~~~~~~~~
> > > include/net/inet_connection_sock.h:213:3: note: in expansion of macro 'pr_debug'
> 
>       pr_debug("%s", inet_csk_timer_bug_msg);
>       ^~~~~~~~
>    include/net/inet_connection_sock.h: In function 'inet_csk_reset_xmit_timer':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/dynamic_debug.h:126:35: note: in expansion of macro 'pr_fmt'
>       __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
>                                       ^~~~~~
>    include/linux/printk.h:309:2: note: in expansion of macro 'dynamic_pr_debug'
>      dynamic_pr_debug(fmt, ##__VA_ARGS__)
>      ^~~~~~~~~~~~~~~~
>    include/net/inet_connection_sock.h:229:3: note: in expansion of macro 'pr_debug'
>       pr_debug("reset_xmit_timer: sk=%p %d when=0x%lx, caller=%p\n",
>       ^~~~~~~~
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/dynamic_debug.h:126:35: note: in expansion of macro 'pr_fmt'
>       __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
>                                       ^~~~~~
>    include/linux/printk.h:309:2: note: in expansion of macro 'dynamic_pr_debug'
>      dynamic_pr_debug(fmt, ##__VA_ARGS__)
>      ^~~~~~~~~~~~~~~~
>    include/net/inet_connection_sock.h:247:3: note: in expansion of macro 'pr_debug'
>       pr_debug("%s", inet_csk_timer_bug_msg);
>       ^~~~~~~~
> 
> vim +536 include/linux/device-mapper.h
> 
>    530	#endif
>    531	
>    532	#ifdef pr_fmt
>    533	#undef pr_fmt
>    534	#endif
>    535	
>  > 536	#define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>    537	
>    538	#define DMCRIT(fmt, ...)						\
>    539		pr_crit(fmt "\n", ##__VA_ARGS__)
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Joe Perches April 18, 2017, 7:13 p.m. UTC | #3
(wrote this yesterday, neglected to send)

On Tue, 2017-04-18 at 05:02 +0800, kbuild test robot wrote:
> Hi Joe,

Hello Fengguang's robot.

> [auto build test ERROR on v4.9-rc8]
> [also build test ERROR on next-20170413]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Joe-Perches/device-mapper-Convert-printks-to-pr_-level-macros/20170418-030508
> config: i386-allmodconfig (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386 
> 
> All error/warnings (new ones prefixed by >>):
> 
>    In file included from fs/nfs/blocklayout/blocklayout.h:35:0,
>                     from fs/nfs/blocklayout/dev.c:11:
>    fs/nfs/blocklayout/dev.c: In function 'bl_free_device':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
> > > fs/nfs/blocklayout/dev.c:33:5: note: in expansion of macro 'pr_err'
> 
>         pr_err("failed to unregister PR key.\n");
>         ^~~~~~
>    fs/nfs/blocklayout/dev.c: In function 'nfs4_block_decode_volume':

Right.

I didn't compile the all the files that #include device-mapper.h
only drivers/md/.

My mistake.  I'll investigate and possibly resubmit.

(investigated and sent email about possible #pragma macro_push use)

> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/printk.h:284:19: note: in expansion of macro 'pr_fmt'
>      printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
>                       ^~~~~~
> > > fs/nfs/blocklayout/dev.c:81:5: note: in expansion of macro 'pr_info'
> 
>         pr_info("signature too long: %d\n",
>         ^~~~~~~
>    fs/nfs/blocklayout/dev.c: In function 'bl_validate_designator':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
>    fs/nfs/blocklayout/dev.c:287:3: note: in expansion of macro 'pr_err'
>       pr_err("pNFS: unsupported designator "
>       ^~~~~~
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
>    fs/nfs/blocklayout/dev.c:294:3: note: in expansion of macro 'pr_err'
>       pr_err("pNFS: invalid designator "
>       ^~~~~~
>    fs/nfs/blocklayout/dev.c: In function 'bl_open_udev_path':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/printk.h:279:22: note: in expansion of macro 'pr_fmt'
>      printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
>                          ^~~~~~
>    include/linux/printk.h:280:17: note: in expansion of macro 'pr_warning'
>     #define pr_warn pr_warning
>                     ^~~~~~~~~~
> > > fs/nfs/blocklayout/dev.c:320:3: note: in expansion of macro 'pr_warn'
> 
>       pr_warn("pNFS: failed to open device %s (%ld)\n",
>       ^~~~~~~
>    fs/nfs/blocklayout/dev.c: In function 'bl_parse_scsi':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/printk.h:284:19: note: in expansion of macro 'pr_fmt'
>      printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
>                       ^~~~~~
>    fs/nfs/blocklayout/dev.c:373:2: note: in expansion of macro 'pr_info'
>      pr_info("pNFS: using block device %s (reservation key 0x%llx)\n",
>      ^~~~~~~
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
>    fs/nfs/blocklayout/dev.c:378:3: note: in expansion of macro 'pr_err'
>       pr_err("pNFS: block device %s does not support reservations.",
>       ^~~~~~
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
> > > include/linux/printk.h:277:18: note: in expansion of macro 'pr_fmt'
> 
>      printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>                      ^~~~~~
>    fs/nfs/blocklayout/dev.c:386:3: note: in expansion of macro 'pr_err'
>       pr_err("pNFS: failed to register key for block device %s.",
>       ^~~~~~
> --
>    In file included from fs/nfs/blocklayout/blocklayout.h:35:0,
>                     from fs/nfs/blocklayout/extent_tree.c:7:
>    include/linux/netdevice.h: In function 'netdev_cap_txqueue':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/printk.h:279:22: note: in expansion of macro 'pr_fmt'
>      printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
>                          ^~~~~~
> > > include/linux/net.h:238:3: note: in expansion of macro 'pr_warning'
> 
>       function(__VA_ARGS__);    \
>       ^~~~~~~~
> > > include/linux/net.h:252:2: note: in expansion of macro 'net_ratelimited_function'
> 
>      net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
>      ^~~~~~~~~~~~~~~~~~~~~~~~
> > > include/linux/net.h:252:27: note: in expansion of macro 'pr_warn'
> 
>      net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
>                               ^~~~~~~
> > > include/linux/netdevice.h:3119:3: note: in expansion of macro 'net_warn_ratelimited'
> 
>       net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n",
>       ^~~~~~~~~~~~~~~~~~~~
>    include/net/inet_connection_sock.h: In function 'inet_csk_clear_xmit_timer':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/dynamic_debug.h:126:35: note: in expansion of macro 'pr_fmt'
>       __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
>                                       ^~~~~~
>    include/linux/printk.h:309:2: note: in expansion of macro 'dynamic_pr_debug'
>      dynamic_pr_debug(fmt, ##__VA_ARGS__)
>      ^~~~~~~~~~~~~~~~
> > > include/net/inet_connection_sock.h:213:3: note: in expansion of macro 'pr_debug'
> 
>       pr_debug("%s", inet_csk_timer_bug_msg);
>       ^~~~~~~~
>    include/net/inet_connection_sock.h: In function 'inet_csk_reset_xmit_timer':
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/dynamic_debug.h:126:35: note: in expansion of macro 'pr_fmt'
>       __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
>                                       ^~~~~~
>    include/linux/printk.h:309:2: note: in expansion of macro 'dynamic_pr_debug'
>      dynamic_pr_debug(fmt, ##__VA_ARGS__)
>      ^~~~~~~~~~~~~~~~
>    include/net/inet_connection_sock.h:229:3: note: in expansion of macro 'pr_debug'
>       pr_debug("reset_xmit_timer: sk=%p %d when=0x%lx, caller=%p\n",
>       ^~~~~~~~
> > > include/linux/device-mapper.h:536:34: error: expected ')' before 'DM_MSG_PREFIX'
> 
>     #define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>                                      ^
>    include/linux/dynamic_debug.h:126:35: note: in expansion of macro 'pr_fmt'
>       __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
>                                       ^~~~~~
>    include/linux/printk.h:309:2: note: in expansion of macro 'dynamic_pr_debug'
>      dynamic_pr_debug(fmt, ##__VA_ARGS__)
>      ^~~~~~~~~~~~~~~~
>    include/net/inet_connection_sock.h:247:3: note: in expansion of macro 'pr_debug'
>       pr_debug("%s", inet_csk_timer_bug_msg);
>       ^~~~~~~~
> 
> vim +536 include/linux/device-mapper.h
> 
>    530	#endif
>    531	
>    532	#ifdef pr_fmt
>    533	#undef pr_fmt
>    534	#endif
>    535	
>  > 536	#define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
>    537	
>    538	#define DMCRIT(fmt, ...)						\
>    539		pr_crit(fmt "\n", ##__VA_ARGS__)
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index b7ab76ed8e11..759a1a0c72dc 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -533,48 +533,51 @@  extern struct ratelimit_state dm_ratelimit_state;
 #define dm_ratelimit()	0
 #endif
 
-#define DMCRIT(f, arg...) \
-	printk(KERN_CRIT DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
-
-#define DMERR(f, arg...) \
-	printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
-#define DMERR_LIMIT(f, arg...) \
-	do { \
-		if (dm_ratelimit())	\
-			printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " \
-			       f "\n", ## arg); \
-	} while (0)
-
-#define DMWARN(f, arg...) \
-	printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
-#define DMWARN_LIMIT(f, arg...) \
-	do { \
-		if (dm_ratelimit())	\
-			printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " \
-			       f "\n", ## arg); \
-	} while (0)
-
-#define DMINFO(f, arg...) \
-	printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
-#define DMINFO_LIMIT(f, arg...) \
-	do { \
-		if (dm_ratelimit())	\
-			printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f \
-			       "\n", ## arg); \
-	} while (0)
+#ifdef pr_fmt
+#undef pr_fmt
+#endif
+
+#define pr_fmt(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt
+
+#define DMCRIT(fmt, ...)						\
+	pr_crit(fmt "\n", ##__VA_ARGS__)
+
+#define DMERR(fmt, ...)							\
+	pr_err(fmt "\n", ##__VA_ARGS__)
+#define DMERR_LIMIT(fmt, ...)						\
+do {									\
+	if (dm_ratelimit())						\
+		DMERR(fmt, ##__VA_ARGS__);				\
+} while (0)
+
+#define DMWARN(fmt, ...)						\
+	pr_warn(fmt "\n", ##__VA_ARGS__)
+#define DMWARN_LIMIT(fmt, ...)						\
+do {									\
+	if (dm_ratelimit())						\
+		DMWARN(fmt, ##__VA_ARGS__);				\
+} while (0)
+
+#define DMINFO(fmt, ...)						\
+	pr_info(fmt "\n", ##__VA_ARGS__)
+#define DMINFO_LIMIT(fmt, ...)						\
+do {									\
+	if (dm_ratelimit())						\
+		DMINFO(fmt, ##__VA_ARGS__);				\
+} while (0)
 
 #ifdef CONFIG_DM_DEBUG
-#  define DMDEBUG(f, arg...) \
-	printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX " DEBUG: " f "\n", ## arg)
-#  define DMDEBUG_LIMIT(f, arg...) \
-	do { \
-		if (dm_ratelimit())	\
-			printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX ": " f \
-			       "\n", ## arg); \
-	} while (0)
+#  define DMDEBUG(fmt, ...)						\
+	printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX " DEBUG: " fmt "\n", \
+	       ##__VA_ARGS__)
+#  define DMDEBUG_LIMIT(fmt, ...)					\
+do {									\
+	if (dm_ratelimit())						\
+		DMDEBUG(fmt, ##__VA_ARGS__);				\
+} while (0)
 #else
-#  define DMDEBUG(f, arg...) do {} while (0)
-#  define DMDEBUG_LIMIT(f, arg...) do {} while (0)
+#  define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
+#  define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
 #endif
 
 #define DMEMIT(x...) sz += ((sz >= maxlen) ? \