From patchwork Fri Jun 24 08:24:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satoru Takeuchi X-Patchwork-Id: 9196939 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 D902960754 for ; Fri, 24 Jun 2016 08:25:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C32FE28495 for ; Fri, 24 Jun 2016 08:25:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B51642849A; Fri, 24 Jun 2016 08:25:35 +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=ham 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 3D98228495 for ; Fri, 24 Jun 2016 08:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750943AbcFXIZb (ORCPT ); Fri, 24 Jun 2016 04:25:31 -0400 Received: from mgwym01.jp.fujitsu.com ([211.128.242.40]:43963 "EHLO mgwym01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750853AbcFXIZ3 (ORCPT ); Fri, 24 Jun 2016 04:25:29 -0400 Received: from yt-mxoi2.gw.nic.fujitsu.com (unknown [192.168.229.69]) by mgwym01.jp.fujitsu.com with smtp id 1fc3_16f9_61ade129_c55f_435d_936e_a9c397521453; Fri, 24 Jun 2016 17:25:23 +0900 Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by yt-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 645F1AC01FA for ; Fri, 24 Jun 2016 17:25:22 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.4.6 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20160122 X-SHieldMailCheckerMailID: 1f1dd50c394e4f309c003ada09e32954 To: "linux-btrfs@vger.kernel.org" From: Satoru Takeuchi Subject: [PATCH] btrfs-progs: fi show: print error message if no valid Btrfs is specified Message-ID: Date: Fri, 24 Jun 2016 17:24:47 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 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-Virus-Scanned: ClamAV using ClamSMTP * Before this patch =============================== # ./btrfs fi show foo # "foo" doesn't mean any valid Btrfs # # no error message # echo $? 1 =============================== * After this patch =============================== # ./btrfs fi show foo ERROR: foo is not a valid Btrfs # # echo $? 1 =============================== Signed-off-by: Satoru Takeuchi --- cmds-filesystem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 88867a3..90f3c49 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -898,9 +898,10 @@ devs_only: list_for_each_entry(fs_devices, &all_uuids, list) print_one_uuid(fs_devices, unit_mode); - if (search && !found) + if (search && !found) { + error("%s is not a valid Btrfs", search); ret = 1; - + } while (!list_empty(&all_uuids)) { fs_devices = list_entry(all_uuids.next, struct btrfs_fs_devices, list);