From patchwork Thu Apr 27 23:01:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 9703717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DDDBA602CC for ; Thu, 27 Apr 2017 23:09:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D277628521 for ; Thu, 27 Apr 2017 23:09:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C542F2863B; Thu, 27 Apr 2017 23:09:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A98628521 for ; Thu, 27 Apr 2017 23:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161170AbdD0XJP (ORCPT ); Thu, 27 Apr 2017 19:09:15 -0400 Received: from smtprelay0087.hostedemail.com ([216.40.44.87]:39733 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932505AbdD0XJN (ORCPT ); Thu, 27 Apr 2017 19:09:13 -0400 X-Greylist: delayed 442 seconds by postgrey-1.27 at vger.kernel.org; Thu, 27 Apr 2017 19:09:13 EDT Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave08.hostedemail.com (Postfix) with ESMTP id 3CC61211D9F for ; Thu, 27 Apr 2017 23:01:51 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 4E9E4C211F; Thu, 27 Apr 2017 23:01:45 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: clam45_f36e27df9b1a X-Filterd-Recvd-Size: 3618 Received: from joe-laptop.perches.com (unknown [47.151.132.55]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Thu, 27 Apr 2017 23:01:44 +0000 (UTC) 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP __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);