All of lore.kernel.org
 help / color / mirror / Atom feed
From: jeffm@suse.com
To: linux-btrfs@vger.kernel.org
Cc: Jeff Mahoney <jeffm@suse.com>
Subject: [PATCH 11/18] btrfs-progs: filesystem balance: split out special handling
Date: Wed, 16 May 2018 17:38:44 -0400	[thread overview]
Message-ID: <20180516213851.10196-12-jeffm@suse.com> (raw)
In-Reply-To: <20180516213851.10196-1-jeffm@suse.com>

From: Jeff Mahoney <jeffm@suse.com>

In preparation to use cmd_struct as the command entry point, we need
to split out the 'filesystem balance' handling to not call cmd_balance
directly.  The reason is that the flags that indicate a command is
hidden are a part of cmd_struct and so we can use a cmd_struct as a
direct alias in another command group and ALSO have it be hidden
without declaring another cmd_struct.

This change has no immediate impact since cmd_balance will still
use its usage information directly from cmds-balance.c.  It will
take effect once we start passing cmd_structs around for usage
information.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 cmds-filesystem.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 30a50bf5..01d639e3 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -1177,6 +1177,18 @@ static int cmd_filesystem_label(int argc, char **argv)
 	}
 }
 
+static const char * const cmd_filesystem_balance_usage[] = {
+	"btrfs filesystem balance [args...] (alias of \"btrfs balance\")",
+	"Please see \"btrfs balance --help\" for more information.",
+	NULL
+};
+
+/* Compatible old "btrfs filesystem balance" command */
+static int cmd_filesystem_balance(int argc, char **argv)
+{
+	return cmd_balance(argc, argv);
+}
+
 static const char filesystem_cmd_group_info[] =
 "overall filesystem tasks and information";
 
@@ -1190,8 +1202,9 @@ const struct cmd_group filesystem_cmd_group = {
 			0 },
 		{ "defragment", cmd_filesystem_defrag,
 			cmd_filesystem_defrag_usage, NULL, 0 },
-		{ "balance", cmd_balance, NULL, &balance_cmd_group,
-			CMD_HIDDEN },
+		{ "balance", cmd_filesystem_balance,
+		   cmd_filesystem_balance_usage, &balance_cmd_group,
+		   CMD_HIDDEN },
 		{ "resize", cmd_filesystem_resize, cmd_filesystem_resize_usage,
 			NULL, 0 },
 		{ "label", cmd_filesystem_label, cmd_filesystem_label_usage,
-- 
2.15.1


  parent reply	other threads:[~2018-05-16 21:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 21:38 [PATCH v3 00/18] btrfs-progs: qgroups-usability jeffm
2018-05-16 21:38 ` [PATCH 01/18] btrfs-progs: quota: Add -W option to rescan to wait without starting rescan jeffm
2018-05-16 21:38 ` [PATCH 02/18] btrfs-progs: qgroups: fix misleading index check jeffm
2018-05-16 21:38 ` [PATCH 03/18] btrfs-progs: constify pathnames passed as arguments jeffm
2018-05-16 21:38 ` [PATCH 04/18] btrfs-progs: btrfs-list: add rb_entry helpers for root_info jeffm
2018-05-16 21:38 ` [PATCH 05/18] btrfs-progs: qgroups: add pathname to show output jeffm
2018-05-18  4:55   ` Misono Tomohiro
2018-05-16 21:38 ` [PATCH 06/18] btrfs-progs: qgroups: introduce and use info and limit structures jeffm
2018-05-16 21:38 ` [PATCH 07/18] btrfs-progs: qgroups: introduce btrfs_qgroup_query jeffm
2018-05-16 21:38 ` [PATCH 08/18] btrfs-progs: subvolume: add quota info to btrfs sub show jeffm
2018-05-16 21:38 ` [PATCH 09/18] btrfs-progs: help: convert ints used as bools to bool jeffm
2018-05-16 21:38 ` [PATCH 10/18] btrfs-progs: reorder placement of help declarations for send/receive jeffm
2018-05-16 21:38 ` jeffm [this message]
2018-05-16 21:38 ` [PATCH 12/18] btrfs-progs: use cmd_struct as command entry point jeffm
2018-05-16 21:38 ` [PATCH 13/18] btrfs-progs: pass cmd_struct to command callback function jeffm
2018-05-16 21:38 ` [PATCH 14/18] btrfs-progs: pass cmd_struct to clean_args_no_options{,_relaxed} jeffm
2018-05-16 21:38 ` [PATCH 15/18] btrfs-progs: pass cmd_struct to usage() jeffm
2018-05-16 21:38 ` [PATCH 16/18] btrfs-progs: add support for output formats jeffm
2018-05-16 21:38 ` [PATCH 17/18] btrfs-progs: handle command groups directly for common case jeffm
2018-05-16 21:38 ` [PATCH 18/18] btrfs-progs: qgroups: don't print dead qgroups jeffm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180516213851.10196-12-jeffm@suse.com \
    --to=jeffm@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.