From patchwork Tue Jul 1 23:11:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 4462771 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 7A3E8BEEAA for ; Tue, 1 Jul 2014 23:11:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BAE38202F2 for ; Tue, 1 Jul 2014 23:11:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9324202F0 for ; Tue, 1 Jul 2014 23:11:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964967AbaGAXLE (ORCPT ); Tue, 1 Jul 2014 19:11:04 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43711 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964943AbaGAXLD (ORCPT ); Tue, 1 Jul 2014 19:11:03 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 08E96ABEF; Tue, 1 Jul 2014 23:11:02 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 54026DAA76; Wed, 2 Jul 2014 01:11:01 +0200 (CEST) Date: Wed, 2 Jul 2014 01:11:01 +0200 From: David Sterba To: Gui Hecheng Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org Subject: Re: [PATCH 1/2] btrfs-progs: move the check_argc_* functions into utils.c Message-ID: <20140701231101.GT1553@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Gui Hecheng , linux-btrfs@vger.kernel.org References: <20140627123528.GC1553@twin.jikos.cz> <1404100452-8894-1-git-send-email-guihc.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1404100452-8894-1-git-send-email-guihc.fnst@cn.fujitsu.com> User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) 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=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 On Mon, Jun 30, 2014 at 11:54:11AM +0800, Gui Hecheng wrote: > To let the independent tools(e.g. btrfs-image, btrfs-convert, etc.) > share the convenience of check_argc_* functions, just move it into > utils.c. > Also add a new function "set_argv0" to set the correct tool name: > *btrfs-image*: too few arguments > > The original btrfs* tools work as before. Good cleanup, but I don't like to see the utils.c pull the commands.h, the argv0 or argument helpers are selfcontained, so the relevant definitions shloud be moved to utils.h . Moved ARGV0_BUF_SIZE -> utils.h Removed check_argc_* protoypes from command.h Trivial changes, I made them myself, no need to resend the patch. The diff: --- -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/commands.h +++ b/commands.h @@ -14,8 +14,6 @@ * Boston, MA 021110-1307, USA. */ -#define ARGV0_BUF_SIZE 64 - struct cmd_struct { const char *token; int (*fn)(int, char **); @@ -62,10 +60,6 @@ struct cmd_group { /* btrfs.c */ int prefixcmp(const char *str, const char *prefix); -int check_argc_exact(int nargs, int expected); -int check_argc_min(int nargs, int expected); -int check_argc_max(int nargs, int expected); - int handle_command_group(const struct cmd_group *grp, int argc, char **argv); diff --git a/utils.h b/utils.h index 20e5a2200052..e29ab936cd81 100644 --- a/utils.h +++ b/utils.h @@ -39,6 +39,8 @@ #define BTRFS_UUID_UNPARSED_SIZE 37 +#define ARGV0_BUF_SIZE 64 + int check_argc_exact(int nargs, int expected); int check_argc_min(int nargs, int expected); int check_argc_max(int nargs, int expected);