From patchwork Wed Sep 4 15:22:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 2853750 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 263349F485 for ; Wed, 4 Sep 2013 15:23:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA3B4204CE for ; Wed, 4 Sep 2013 15:23:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2AC03201ED for ; Wed, 4 Sep 2013 15:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762900Ab3IDPXH (ORCPT ); Wed, 4 Sep 2013 11:23:07 -0400 Received: from mail-pb0-f51.google.com ([209.85.160.51]:43830 "EHLO mail-pb0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756525Ab3IDPXE (ORCPT ); Wed, 4 Sep 2013 11:23:04 -0400 Received: by mail-pb0-f51.google.com with SMTP id jt11so448815pbb.24 for ; Wed, 04 Sep 2013 08:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o8EJgmphxlt3cHs2TTR18AVc9XzDDso+dscIVDZkX3A=; b=LzmWuzaFwIBRpp5+B7L5CHpLLKxLWYVDqd3C3g++CXrlTTtBebuFFpHsLFW3SwaxFd Ruvls2KfCRGZLUq69+bjjAP5ver8fYphzx0etHM8Rtp5FXJJkLFDjBOZNc5LCnRhEw4E M8GCZUaH71rsoUvYUSiQIK8fk2PDHpEEJ0PD6pu3UF70A5snAeyoxuNT/VRwCcVT2Rlh JZbf9wIo5Qm7b0QiBut5HaK6IojJmLcNIUAPCJ22ny3dBAqeXPW5uZmQFLw6GEzGRk2y W6HnjdYViHKYDf9W9pOCqNVgcmiUxthFypWfIEVWQX8RpRoOO4qQIZ6NBH9J9nwx0jKy dWhw== X-Received: by 10.68.189.5 with SMTP id ge5mr3949877pbc.42.1378308184405; Wed, 04 Sep 2013 08:23:04 -0700 (PDT) Received: from localhost.localdomain.localdomain ([223.65.191.73]) by mx.google.com with ESMTPSA id uw6sm29467271pbc.8.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Sep 2013 08:23:03 -0700 (PDT) From: Wang Shilong To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz, sandeen@redhat.com Subject: [PATCH 08/20] Btrfs-progs: fix magic return value in cmds-qgroup.c Date: Wed, 4 Sep 2013 23:22:25 +0800 Message-Id: <1378308157-4621-9-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1378308157-4621-1-git-send-email-wangshilong1991@gmail.com> References: <1378308157-4621-1-git-send-email-wangshilong1991@gmail.com> 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.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 From: Wang Shilong Signed-off-by: Wang Shilong --- cmds-qgroup.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 6fa4c17..ff2a1fa 100644 --- a/cmds-qgroup.c +++ b/cmds-qgroup.c @@ -54,12 +54,12 @@ static int qgroup_assign(int assign, int argc, char **argv) */ if ((args.src >> 48) >= (args.dst >> 48)) { fprintf(stderr, "ERROR: bad relation requested '%s'\n", path); - return 12; + return 1; } fd = open_file_or_dir(path, &dirstream); if (fd < 0) { fprintf(stderr, "ERROR: can't access '%s'\n", path); - return 12; + return 1; } ret = ioctl(fd, BTRFS_IOC_QGROUP_ASSIGN, &args); @@ -68,7 +68,7 @@ static int qgroup_assign(int assign, int argc, char **argv) if (ret < 0) { fprintf(stderr, "ERROR: unable to assign quota group: %s\n", strerror(e)); - return 30; + return 1; } return 0; } @@ -92,7 +92,7 @@ static int qgroup_create(int create, int argc, char **argv) fd = open_file_or_dir(path, &dirstream); if (fd < 0) { fprintf(stderr, "ERROR: can't access '%s'\n", path); - return 12; + return 1; } ret = ioctl(fd, BTRFS_IOC_QGROUP_CREATE, &args); @@ -101,7 +101,7 @@ static int qgroup_create(int create, int argc, char **argv) if (ret < 0) { fprintf(stderr, "ERROR: unable to create quota group: %s\n", strerror(e)); - return 30; + return 1; } return 0; } @@ -310,19 +310,17 @@ static int cmd_qgroup_show(int argc, char **argv) fd = open_file_or_dir(path, &dirstream); if (fd < 0) { fprintf(stderr, "ERROR: can't access '%s'\n", path); - return 12; + return 1; } ret = list_qgroups(fd); e = errno; close_file_or_dir(fd, dirstream); - if (ret < 0) { + if (ret < 0) fprintf(stderr, "ERROR: can't list qgroups: %s\n", strerror(e)); - return 30; - } - return ret; + return !!ret; } static const char * const cmd_qgroup_limit_usage[] = { @@ -392,12 +390,12 @@ static int cmd_qgroup_limit(int argc, char **argv) ret = test_issubvolume(path); if (ret < 0) { fprintf(stderr, "ERROR: error accessing '%s'\n", path); - return 12; + return 1; } if (!ret) { fprintf(stderr, "ERROR: '%s' is not a subvolume\n", path); - return 13; + return 1; } /* * keep qgroupid at 0, this indicates that the subvolume the @@ -412,7 +410,7 @@ static int cmd_qgroup_limit(int argc, char **argv) fd = open_file_or_dir(path, &dirstream); if (fd < 0) { fprintf(stderr, "ERROR: can't access '%s'\n", path); - return 12; + return 1; } ret = ioctl(fd, BTRFS_IOC_QGROUP_LIMIT, &args); @@ -421,7 +419,7 @@ static int cmd_qgroup_limit(int argc, char **argv) if (ret < 0) { fprintf(stderr, "ERROR: unable to limit requested quota group: " "%s\n", strerror(e)); - return 30; + return 1; } return 0; }