From patchwork Thu Dec 25 01:16:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Hecheng X-Patchwork-Id: 5540761 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8E49FBEEBA for ; Thu, 25 Dec 2014 01:19:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C841B200FF for ; Thu, 25 Dec 2014 01:19:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D8475201BB for ; Thu, 25 Dec 2014 01:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751731AbaLYBTB (ORCPT ); Wed, 24 Dec 2014 20:19:01 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:26385 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751625AbaLYBS6 (ORCPT ); Wed, 24 Dec 2014 20:18:58 -0500 X-IronPort-AV: E=Sophos;i="5.04,848,1406563200"; d="scan'208";a="47007565" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 25 Dec 2014 09:15:35 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id sBP1ITri019404 for ; Thu, 25 Dec 2014 09:18:29 +0800 Received: from localhost.localdomain (10.167.226.111) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 25 Dec 2014 09:18:56 +0800 From: Gui Hecheng To: CC: Gui Hecheng Subject: [PATCH 2/2] btrfs-progs: refine btrfs-debug-tree error prompt when a mount point given Date: Thu, 25 Dec 2014 09:16:35 +0800 Message-ID: <1419470195-2889-2-git-send-email-guihc.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1419470195-2889-1-git-send-email-guihc.fnst@cn.fujitsu.com> References: <1419470195-2889-1-git-send-email-guihc.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.111] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Now, if exec: # btrfs-debug-tree it echos: : Superblock bytenr is larger than device size But it is quite misleading, because it is a valid btrfs. In this case, we should tell the developer to provide a block device. After apply: : '' is not a block device : 'usage: btrfs-debug-tree [options] device Signed-off-by: Gui Hecheng Reviewed-by: Satoru Takeuchi --- btrfs-debug-tree.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c index e46500d..7f079a9 100644 --- a/btrfs-debug-tree.c +++ b/btrfs-debug-tree.c @@ -179,6 +179,12 @@ int main(int ac, char **av) if (check_argc_exact(ac, 1)) print_usage(); + ret = check_arg_type(av[optind]); + if (ret != BTRFS_ARG_BLKDEV) { + fprintf(stderr, "'%s' is not a block device\n", av[optind]); + print_usage(); + } + info = open_ctree_fs_info(av[optind], 0, 0, OPEN_CTREE_PARTIAL); if (!info) { fprintf(stderr, "unable to open %s\n", av[optind]);