From patchwork Mon May 9 07:20:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satoru Takeuchi X-Patchwork-Id: 9042041 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41785BF440 for ; Mon, 9 May 2016 07:20:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5BDE620155 for ; Mon, 9 May 2016 07:20:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4BB26201B9 for ; Mon, 9 May 2016 07:20:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752707AbcEIHUt (ORCPT ); Mon, 9 May 2016 03:20:49 -0400 Received: from mgwym02.jp.fujitsu.com ([211.128.242.41]:42727 "EHLO mgwym02.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751861AbcEIHUr (ORCPT ); Mon, 9 May 2016 03:20:47 -0400 Received: from yt-mxauth.gw.nic.fujitsu.com (unknown [192.168.229.68]) by mgwym02.jp.fujitsu.com with smtp id 3801_1b84_ff05be9c_2b27_43af_a8ae_fda773a26c3e; Mon, 09 May 2016 16:20:40 +0900 Received: from m3051.s.css.fujitsu.com (m3051.s.css.fujitsu.com [10.134.21.209]) by yt-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id BDB4FAC00CD for ; Mon, 9 May 2016 16:20:39 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.4.6 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20160122 X-SHieldMailCheckerMailID: b35e339cead440338653414c10f7e601 To: "linux-btrfs@vger.kernel.org" From: Satoru Takeuchi Subject: [PATCH 1/3] btrfs-progs: prop: convert error messages to use error() Message-ID: <57303A21.9070308@jp.fujitsu.com> Date: Mon, 9 May 2016 16:20:01 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP props.c uses 'fprintf(stderr, "ERROR: ...")' as its error messages, however we have generic error() function. Signed-off-by: Satoru Takeuchi --- props.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/props.c b/props.c index 5b74932..5b4e26e 100644 --- a/props.c +++ b/props.c @@ -48,7 +48,7 @@ static int prop_read_only(enum prop_object_type type, fd = open(object, O_RDONLY); if (fd < 0) { ret = -errno; - fprintf(stderr, "ERROR: open %s failed. %s\n", + error("open %s failed. %s", object, strerror(-ret)); goto out; } @@ -56,7 +56,7 @@ static int prop_read_only(enum prop_object_type type, ret = ioctl(fd, BTRFS_IOC_SUBVOL_GETFLAGS, &flags); if (ret < 0) { ret = -errno; - fprintf(stderr, "ERROR: failed to get flags for %s. %s\n", + error("failed to get flags for %s. %s", object, strerror(-ret)); goto out; } @@ -76,14 +76,14 @@ static int prop_read_only(enum prop_object_type type, flags = flags & ~BTRFS_SUBVOL_RDONLY; } else { ret = -EINVAL; - fprintf(stderr, "ERROR: invalid value for property.\n"); + error("invalid value for property."); goto out; } ret = ioctl(fd, BTRFS_IOC_SUBVOL_SETFLAGS, &flags); if (ret < 0) { ret = -errno; - fprintf(stderr, "ERROR: failed to set flags for %s. %s\n", + error("failed to set flags for %s. %s", object, strerror(-ret)); goto out; } @@ -130,8 +130,7 @@ static int prop_compression(enum prop_object_type type, fd = open_file_or_dir3(object, &dirstream, open_flags); if (fd == -1) { ret = -errno; - fprintf(stderr, "ERROR: open %s failed. %s\n", - object, strerror(-ret)); + error("open %s failed. %s", object, strerror(-ret)); goto out; } @@ -151,9 +150,8 @@ static int prop_compression(enum prop_object_type type, if (sret < 0) { ret = -errno; if (ret != -ENOATTR) - fprintf(stderr, - "ERROR: failed to %s compression for %s. %s\n", - value ? "set" : "get", object, strerror(-ret)); + error("failed to %s compression for %s. %s", + value ? "set" : "get", object, strerror(-ret)); else ret = 0; goto out; @@ -169,9 +167,8 @@ static int prop_compression(enum prop_object_type type, sret = fgetxattr(fd, xattr_name, buf, len); if (sret < 0) { ret = -errno; - fprintf(stderr, - "ERROR: failed to get compression for %s. %s\n", - object, strerror(-ret)); + error("failed to get compression for %s. %s", + object, strerror(-ret)); goto out; } fprintf(stdout, "compression=%.*s\n", (int)len, buf);