public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Omar Sandoval <osandov@fb.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: alias btrfs device delete to btrfs device remove
Date: Wed, 24 Jun 2015 17:49:25 +0200	[thread overview]
Message-ID: <20150624154925.GA726@suse.cz> (raw)
In-Reply-To: <20150623213006.GA20385@huxley.DHCP.TheFacebook.com>

On Tue, Jun 23, 2015 at 02:30:06PM -0700, Omar Sandoval wrote:
> > No need to introduce the wrappers, it's enough to add an alternative
> > usage string and the callback function will be the same. Also please
> > keep the aliased entries next to each other.
> 
> So the reason I did that way is that this:
> 
> static int cmd_rm_dev(int argc, char **argv)
> {
> 	char	*mntpnt;
> 	int	i, fdmnt, ret=0, e;
> 	DIR	*dirstream = NULL;
> 
> 	if (check_argc_min(argc, 3))
> 		usage(cmd_rm_dev_usage);
> 
> would use the same usage string for both commands. E.g., if you do
> "btrfs device delete", the usage string would say
> "btrfs device remove...". That's a small cosmetic issue, but what do you
> think?

Ah right, I forgot about the separate usage string. We'll have to pass
it to the callback somehow in general, as it is printed eg. in the
'default:' branch of the geopt switch loop. The alias wrappers are
probably inevitable:

{ "delete", cmd_device_delete, cmd_device_delete_usage, NULL, 0 },
{ "remove", cmd_device_remove, cmd_device_remove_usage, NULL, 0 },

int cmd_device_delete(int argc, char **argv) {
	return _cmd_device_delete(argc, argv, cmd_device_delete_usage);
}

int cmd_device_remove(int argc, char **argv) {
	return _cmd_device_delete(argc, argv, cmd_device_remove_usage);
}

This follows a pattern so we can add a macro wrapper eventually if this
proves to be the best option.

      reply	other threads:[~2015-06-24 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18 22:07 [PATCH] btrfs-progs: alias btrfs device delete to btrfs device remove Omar Sandoval
2015-06-23 15:40 ` David Sterba
2015-06-23 21:30   ` Omar Sandoval
2015-06-24 15:49     ` David Sterba [this message]

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=20150624154925.GA726@suse.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=osandov@fb.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox