From: Goffredo Baroncelli <kreijack@gmail.com>
To: Ian Kumlien <pomac@demius.net>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/6] Btrfs-progs: add btrfsck functionality to btrfs
Date: Fri, 08 Feb 2013 18:39:18 +0100 [thread overview]
Message-ID: <51153846.7020304@gmail.com> (raw)
In-Reply-To: <1360283822-23452-3-git-send-email-pomac@demius.net>
H Iam,
On 02/08/2013 01:36 AM, Ian Kumlien wrote:
> This patch includes the functionality of btrfs, it's
> found as "btrfs check" however it makes the binary
> behave differently depending on what it's run as.
[...]
>
> +static int cmd_dummy(int argc, char **argv)
> +{
> + return 0;
I think we should warn that fsck.btrfs does nothing. Something like:
+ fprintf(stderr, "WARNING: fsck.btrfs does nothing. "
"Try 'btrfs check'\n");
> +}
> +
> +/* change behaviour depending on what we're called */
> +const struct cmd_group function_cmd_group = {
> + NULL, NULL,
> + {
> + { "btrfsck", cmd_check, NULL, NULL, 0 },
> + { "fsck.btrfs", cmd_dummy, NULL, NULL, 0 },
> + { 0, 0, 0, 0, 0 }
> + },
> +};
> +
> int main(int argc, char **argv)
> {
> const struct cmd_struct *cmd;
> + char *called_as = strrchr(argv[0], '/');
> + if (called_as)
> + argv[0] = ++called_as;
>
> crc32c_optimization_init();
>
> - argc--;
> - argv++;
> - handle_options(&argc, &argv);
> - if (argc > 0) {
> - if (!prefixcmp(argv[0], "--"))
> - argv[0] += 2;
> - } else {
> - usage_command_group(&btrfs_cmd_group, 0, 0);
> - exit(1);
> - }
> + /* if we have cmd, we're started as a sub command */
> + if (parse_one_exact_token(argv[0], &function_cmd_group, &cmd) < 0)
> + {
> + argc--;
> + argv++;
>
> - cmd = parse_command_token(argv[0], &btrfs_cmd_group);
> + handle_options(&argc, &argv);
> + if (argc > 0) {
> + if (!prefixcmp(argv[0], "--"))
> + argv[0] += 2;
I can't understand the reason to skip '--' ? But this question is not
related to your patch...
> + } else {
> + usage_command_group(&btrfs_cmd_group, 0, 0);
[...]
--
gpg @keyserver.linux.it: Goffredo Baroncelli (kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5
next prev parent reply other threads:[~2013-02-08 17:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 0:36 Btrfs-progs: Merge btrfs-restore, btrfsck, btrfs-select-super, btrfs-dump-super and btrfs-debug-tree in to btrfs Ian Kumlien
2013-02-08 0:36 ` [PATCH 1/6] Btrfs-progs: Rename btrfsck.c -> cmds-check.c Ian Kumlien
2013-02-08 0:36 ` [PATCH 2/6] Btrfs-progs: add btrfsck functionality to btrfs Ian Kumlien
2013-02-08 17:39 ` Goffredo Baroncelli [this message]
2013-02-08 18:17 ` Ian Kumlien
2013-02-08 23:07 ` David Sterba
2013-02-08 23:37 ` Ian Kumlien
2013-02-12 16:39 ` David Sterba
2013-02-12 17:37 ` Filipe Brandenburger
2013-02-12 18:01 ` Goffredo Baroncelli
2013-02-12 22:52 ` David Sterba
2013-02-12 23:07 ` Goffredo Baroncelli
2013-06-02 15:47 ` Dieter Ries
2013-11-13 17:13 ` David Sterba
2013-11-14 9:25 ` Ilya Dryomov
2013-11-14 12:49 ` David Sterba
2013-11-14 12:56 ` Ian Kumlien
2013-02-08 0:36 ` [PATCH 3/6] Btrfs-progs: move btrfs-select-super.c Ian Kumlien
2013-02-08 0:37 ` [PATCH 4/6] Btrfs-progs: move debug-tree.c -> cmds-rescue-debug-tree.c Ian Kumlien
2013-02-08 0:37 ` [PATCH 5/6] Btrfs-progs: restore.c -> cmds-restore.c Ian Kumlien
2013-02-08 0:37 ` [PATCH 6/6] Btrfs-progs: add the rescue section to btrfs Ian Kumlien
2013-02-08 17:39 ` Goffredo Baroncelli
2013-02-08 18:07 ` Ian Kumlien
2013-02-08 19:57 ` Ilya Dryomov
2013-02-08 20:48 ` Hugo Mills
2013-02-08 22:30 ` David Sterba
2013-02-12 15:26 ` David Sterba
2013-02-08 17:40 ` Btrfs-progs: Merge btrfs-restore, btrfsck, btrfs-select-super, btrfs-dump-super and btrfs-debug-tree in " Goffredo Baroncelli
2013-02-08 18:05 ` Ian Kumlien
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=51153846.7020304@gmail.com \
--to=kreijack@gmail.com \
--cc=kreijack@inwind.it \
--cc=linux-btrfs@vger.kernel.org \
--cc=pomac@demius.net \
/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;
as well as URLs for NNTP newsgroup(s).