From patchwork Tue Aug 6 12:25:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 2839402 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 853359F479 for ; Tue, 6 Aug 2013 12:25:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B96E20160 for ; Tue, 6 Aug 2013 12:25:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A103F2012F for ; Tue, 6 Aug 2013 12:25:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756168Ab3HFMZW (ORCPT ); Tue, 6 Aug 2013 08:25:22 -0400 Received: from cantor2.suse.de ([195.135.220.15]:40844 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756190Ab3HFMZV (ORCPT ); Tue, 6 Aug 2013 08:25:21 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9748CA51B7 for ; Tue, 6 Aug 2013 14:25:20 +0200 (CEST) Received: by ds.suse.cz (Postfix, from userid 10065) id 3C0DFDA861; Tue, 6 Aug 2013 14:25:20 +0200 (CEST) Date: Tue, 6 Aug 2013 14:25:20 +0200 From: David Sterba To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/2] btrfs-progs: introduce command namespace for development features Message-ID: <79debec8a345c66dd0b02793de680e0438428ee0.1375791411.git.dsterba@suse.cz> Mail-Followup-To: David Sterba , linux-btrfs@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) 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, 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 We'd like to make it easier to preview a new feature and remove the burden to invent sane user interface (command name, placement, arguments, man) from the beginning. For this purpose the developer are free to use the 1st level namespace called '_'. It will be hidden from regular btrfs help output and the only way to get the commands is btrfs _ --help The commands appear as if they are in the 1st level, but have to be used from inside _, eg. btrfs _ newcommand Once the interface is stable, the command will be moved to the right place. Signed-off-by: David Sterba --- btrfs.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/btrfs.c b/btrfs.c index 4e93e13..dff0d70 100644 --- a/btrfs.c +++ b/btrfs.c @@ -239,6 +239,28 @@ static int handle_options(int *argc, char ***argv) return (*argv) - orig_argv; } +static const char * const devel_features_cmd_usage[] = { + "btrfs _ []", + NULL +}; + +const struct cmd_group devel_features_cmd_group = { + devel_features_cmd_usage, + "WARNING: this is a namespace for commands that are in development\n" + "and anything is subject to change. Once the user interface gets\n" + "stabilized, it'll be moved to the appropriate place.\n" + "NOTE: you have to call the commands as eg.\n" + "\tbtrfs _ newcommand --args\n", + { + { 0, 0, 0, 0, 0 } + } +}; + +int cmd_devel_features(int argc, char **argv) +{ + return handle_command_group(&devel_features_cmd_group, argc, argv); +} + const struct cmd_group btrfs_cmd_group = { btrfs_cmd_group_usage, btrfs_cmd_group_info, { { "subvolume", cmd_subvolume, NULL, &subvolume_cmd_group, 0 }, @@ -255,6 +277,8 @@ const struct cmd_group btrfs_cmd_group = { { "quota", cmd_quota, NULL, "a_cmd_group, 0 }, { "qgroup", cmd_qgroup, NULL, &qgroup_cmd_group, 0 }, { "replace", cmd_replace, NULL, &replace_cmd_group, 0 }, + { "_", cmd_devel_features, devel_features_cmd_usage, + &devel_features_cmd_group, 1 }, { "help", cmd_help, cmd_help_usage, NULL, 0 }, { "version", cmd_version, cmd_version_usage, NULL, 0 }, { 0, 0, 0, 0, 0 }