From patchwork Thu Aug 7 02:35:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Hecheng X-Patchwork-Id: 4689061 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 9881EC0338 for ; Thu, 7 Aug 2014 02:36:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0227201DC for ; Thu, 7 Aug 2014 02:36:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0815B2018E for ; Thu, 7 Aug 2014 02:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754668AbaHGCgR (ORCPT ); Wed, 6 Aug 2014 22:36:17 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:7817 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754444AbaHGCgQ (ORCPT ); Wed, 6 Aug 2014 22:36:16 -0400 X-IronPort-AV: E=Sophos;i="5.04,279,1406563200"; d="scan'208";a="34288721" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 07 Aug 2014 10:33:25 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s772aCtj005030 for ; Thu, 7 Aug 2014 10:36:12 +0800 Received: from localhost.localdomain (10.167.226.111) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 7 Aug 2014 10:36:24 +0800 From: Gui Hecheng To: CC: Gui Hecheng Subject: [PATCH 1/3] btrfs-progs: check option conflict for btrfs-convert Date: Thu, 7 Aug 2014 10:35:57 +0800 Message-ID: <1407378959-23728-1-git-send-email-guihc.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.1.4 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=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The -d, -i, -n options make no sense to rollback. Check the improper usages such as: # btrfs-convert -r -d Signed-off-by: Gui Hecheng --- btrfs-convert.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/btrfs-convert.c b/btrfs-convert.c index 952e3e6..2ea6a09 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -2699,6 +2699,7 @@ int main(int argc, char *argv[]) int noxattr = 0; int datacsum = 1; int rollback = 0; + int usage_error = 0; char *file; while(1) { int c = getopt(argc, argv, "dinr"); @@ -2729,6 +2730,18 @@ int main(int argc, char *argv[]) return 1; } + if (rollback) { + if (!datacsum || noxattr || !packing) { + fprintf(stderr, "Usage error: -d, -i, -n options do not apply to rollback\n"); + usage_error++; + } + } + + if (usage_error) { + print_usage(); + return 1; + } + file = argv[optind]; ret = check_mounted(file); if (ret < 0) {