From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033608AbdD0XB7 (ORCPT ); Thu, 27 Apr 2017 19:01:59 -0400 Received: from smtprelay0091.hostedemail.com ([216.40.44.91]:37719 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752631AbdD0XBu (ORCPT ); Thu, 27 Apr 2017 19:01:50 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1345:1437:1534:1543:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2901:3138:3139:3140:3141:3142:3354:3865:3867:3868:3870:3871:3872:3874:4321:4605:5007:6117:6119:6261:7903:8603:8660:10004:10848:11026:11658:11914:12296:12438:12555:12679:12895:13132:13148:13230:13231:13972:14181:14394:14721:21080:21212:21451:30054:30069,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: clam45_f36e27df9b1a X-Filterd-Recvd-Size: 3618 From: Joe Perches To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] fs/block_dev: Add prototype and __printf verification to __vfs_msg Date: Thu, 27 Apr 2017 16:01:42 -0700 Message-Id: <2fc96794033de983453beab51155996354396d05.1493333654.git.joe@perches.com> X-Mailer: git-send-email 2.10.0.rc2.1.g053435c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __vfs_msg currently has no prototype and takes a format and arguments. Add a prototype to include/linux/blkdev.h with __printf verification and fix fallout. Miscellanea: o Rename prefix argument to level as that's the common usage for KERN_ uses o Remove the unnecessary __vfs_msg call in the #ifndef CONFIG_PRINTK vfs_msg macro and just call no_printk o Surround the __vfs_msg function with #ifdef CONFIG_PRINTK to reduce object size when CONFIG_PRINTK is not used Signed-off-by: Joe Perches --- vfs_msg is currently used only by fs/block_dev.c and could be marked as a static function instead without any prototype vfs_msg is also only used with KERN_ERR so perhaps it'd be more sensible to just remove the KERN_ERR and call it vfs_err Perhaps also it'd be simpler to make vfs_err/vfs_msg a single macro without the __vfs_err indirection. fs/block_dev.c | 8 +++++--- include/linux/blkdev.h | 11 +++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index f625dcebcf13..9ed962fd66de 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -54,7 +54,8 @@ struct block_device *I_BDEV(struct inode *inode) } EXPORT_SYMBOL(I_BDEV); -void __vfs_msg(struct super_block *sb, const char *prefix, const char *fmt, ...) +#ifdef CONFIG_PRINTK +void __vfs_msg(struct super_block *sb, const char *level, const char *fmt, ...) { struct va_format vaf; va_list args; @@ -62,9 +63,10 @@ void __vfs_msg(struct super_block *sb, const char *prefix, const char *fmt, ...) va_start(args, fmt); vaf.fmt = fmt; vaf.va = &args; - printk_ratelimited("%sVFS (%s): %pV\n", prefix, sb->s_id, &vaf); + printk_ratelimited("%sVFS (%s): %pV\n", level, sb->s_id, &vaf); va_end(args); } +#endif static void bdev_write_inode(struct block_device *bdev) { @@ -775,7 +777,7 @@ int bdev_dax_supported(struct super_block *sb, int blocksize) if (len < 1) { vfs_msg(sb, KERN_ERR, - "error: dax access failed (%d)", len); + "error: dax access failed (%ld)", len); return len < 0 ? len : -EIO; } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index b94df4eed785..657a30aa52d6 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -912,14 +912,13 @@ static inline void rq_flush_dcache_pages(struct request *rq) #endif #ifdef CONFIG_PRINTK -#define vfs_msg(sb, level, fmt, ...) \ +__printf(3, 4) +void __vfs_msg(struct super_block *sb, const char *level, const char *fmt, ...); +#define vfs_msg(sb, level, fmt, ...) \ __vfs_msg(sb, level, fmt, ##__VA_ARGS__) #else -#define vfs_msg(sb, level, fmt, ...) \ -do { \ - no_printk(fmt, ##__VA_ARGS__); \ - __vfs_msg(sb, "", " "); \ -} while (0) +#define vfs_msg(sb, level, fmt, ...) \ + no_printk(level fmt, ##__VA_ARGS__) #endif extern int blk_register_queue(struct gendisk *disk); -- 2.10.0.rc2.1.g053435c