From patchwork Wed May 16 21:38:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 10404927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9E8F8601C8 for ; Wed, 16 May 2018 21:39:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C04F286E6 for ; Wed, 16 May 2018 21:39:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8122C28717; Wed, 16 May 2018 21:39:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D43B4286E6 for ; Wed, 16 May 2018 21:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752083AbeEPVjc (ORCPT ); Wed, 16 May 2018 17:39:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:52668 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbeEPVjF (ORCPT ); Wed, 16 May 2018 17:39:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0DD73AF5D for ; Wed, 16 May 2018 21:39:03 +0000 (UTC) Received: from starscream.home.jeffm.io (starscream-1.home.jeffm.io [192.168.1.254]) by mail.home.jeffm.io (Postfix) with ESMTPS id 064B981AD3EE; Wed, 16 May 2018 17:38:31 -0400 (EDT) Received: by starscream.home.jeffm.io (Postfix, from userid 1000) id ADC7E816B6; Wed, 16 May 2018 17:39:00 -0400 (EDT) From: jeffm@suse.com To: linux-btrfs@vger.kernel.org Cc: Jeff Mahoney Subject: [PATCH 10/18] btrfs-progs: reorder placement of help declarations for send/receive Date: Wed, 16 May 2018 17:38:43 -0400 Message-Id: <20180516213851.10196-11-jeffm@suse.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180516213851.10196-1-jeffm@suse.com> References: <20180516213851.10196-1-jeffm@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff Mahoney The usage definitions for send and receive follow the command definitions, which use them. This works because we declare them in commands.h. When we move to using cmd_struct as the entry point, these declarations will be removed, breaking the commands. Since that would be an otherwise unrelated change, this patch reorders them separately. Signed-off-by: Jeff Mahoney --- cmds-receive.c | 62 ++++++++++++++++++++++++++-------------------------- cmds-send.c | 69 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 66 insertions(+), 65 deletions(-) diff --git a/cmds-receive.c b/cmds-receive.c index 68123a31..b3709f36 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -1248,6 +1248,37 @@ out: return ret; } +const char * const cmd_receive_usage[] = { + "btrfs receive [options] \n" + "btrfs receive --dump [options]", + "Receive subvolumes from a stream", + "Receives one or more subvolumes that were previously", + "sent with btrfs send. The received subvolumes are stored", + "into MOUNT.", + "The receive will fail in case the receiving subvolume", + "already exists. It will also fail in case a previously", + "received subvolume has been changed after it was received.", + "After receiving a subvolume, it is immediately set to", + "read-only.", + "", + "-v increase verbosity about performed actions", + "-f FILE read the stream from FILE instead of stdin", + "-e terminate after receiving an marker in the stream.", + " Without this option the receiver side terminates only in case", + " of an error on end of file.", + "-C|--chroot confine the process to using chroot", + "-E|--max-errors NERR", + " terminate as soon as NERR errors occur while", + " stream processing commands from the stream.", + " Default value is 1. A value of 0 means no limit.", + "-m ROOTMOUNT the root mount point of the destination filesystem.", + " If /proc is not accessible, use this to tell us where", + " this file system is mounted.", + "--dump dump stream metadata, one line per operation,", + " does not require the MOUNT parameter", + NULL +}; + int cmd_receive(int argc, char **argv) { char *tomnt = NULL; @@ -1357,34 +1388,3 @@ out: return !!ret; } - -const char * const cmd_receive_usage[] = { - "btrfs receive [options] \n" - "btrfs receive --dump [options]", - "Receive subvolumes from a stream", - "Receives one or more subvolumes that were previously", - "sent with btrfs send. The received subvolumes are stored", - "into MOUNT.", - "The receive will fail in case the receiving subvolume", - "already exists. It will also fail in case a previously", - "received subvolume has been changed after it was received.", - "After receiving a subvolume, it is immediately set to", - "read-only.", - "", - "-v increase verbosity about performed actions", - "-f FILE read the stream from FILE instead of stdin", - "-e terminate after receiving an marker in the stream.", - " Without this option the receiver side terminates only in case", - " of an error on end of file.", - "-C|--chroot confine the process to using chroot", - "-E|--max-errors NERR", - " terminate as soon as NERR errors occur while", - " stream processing commands from the stream.", - " Default value is 1. A value of 0 means no limit.", - "-m ROOTMOUNT the root mount point of the destination filesystem.", - " If /proc is not accessible, use this to tell us where", - " this file system is mounted.", - "--dump dump stream metadata, one line per operation,", - " does not require the MOUNT parameter", - NULL -}; diff --git a/cmds-send.c b/cmds-send.c index c5ecdaa1..8365e9c9 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -489,6 +489,41 @@ static void free_send_info(struct btrfs_send *sctx) subvol_uuid_search_finit(&sctx->sus); } + +const char * const cmd_send_usage[] = { + "btrfs send [-ve] [-p ] [-c ] [-f ] [...]", + "Send the subvolume(s) to stdout.", + "Sends the subvolume(s) specified by to stdout.", + " should be read-only here.", + "By default, this will send the whole subvolume. To do an incremental", + "send, use '-p '. If you want to allow btrfs to clone from", + "any additional local snapshots, use '-c ' (multiple times", + "where applicable). You must not specify clone sources unless you", + "guarantee that these snapshots are exactly in the same state on both", + "sides, the sender and the receiver. It is allowed to omit the", + "'-p ' option when '-c ' options are given, in", + "which case 'btrfs send' will determine a suitable parent among the", + "clone sources itself.", + "\n", + "-e If sending multiple subvols at once, use the new", + " format and omit the end-cmd between the subvols.", + "-p Send an incremental stream from to", + " .", + "-c Use this snapshot as a clone source for an ", + " incremental send (multiple allowed)", + "-f Output is normally written to stdout. To write to", + " a file, use this option. An alternative would be to", + " use pipes.", + "--no-data send in NO_FILE_DATA mode, Note: the output stream", + " does not contain any file data and thus cannot be used", + " to transfer changes. This mode is faster and useful to", + " show the differences in metadata.", + "-v|--verbose enable verbose output to stderr, each occurrence of", + " this option increases verbosity", + "-q|--quiet suppress all messages, except errors", + NULL +}; + int cmd_send(int argc, char **argv) { char *subvol = NULL; @@ -774,37 +809,3 @@ out: free_send_info(&send); return !!ret; } - -const char * const cmd_send_usage[] = { - "btrfs send [-ve] [-p ] [-c ] [-f ] [...]", - "Send the subvolume(s) to stdout.", - "Sends the subvolume(s) specified by to stdout.", - " should be read-only here.", - "By default, this will send the whole subvolume. To do an incremental", - "send, use '-p '. If you want to allow btrfs to clone from", - "any additional local snapshots, use '-c ' (multiple times", - "where applicable). You must not specify clone sources unless you", - "guarantee that these snapshots are exactly in the same state on both", - "sides, the sender and the receiver. It is allowed to omit the", - "'-p ' option when '-c ' options are given, in", - "which case 'btrfs send' will determine a suitable parent among the", - "clone sources itself.", - "\n", - "-e If sending multiple subvols at once, use the new", - " format and omit the end-cmd between the subvols.", - "-p Send an incremental stream from to", - " .", - "-c Use this snapshot as a clone source for an ", - " incremental send (multiple allowed)", - "-f Output is normally written to stdout. To write to", - " a file, use this option. An alternative would be to", - " use pipes.", - "--no-data send in NO_FILE_DATA mode, Note: the output stream", - " does not contain any file data and thus cannot be used", - " to transfer changes. This mode is faster and useful to", - " show the differences in metadata.", - "-v|--verbose enable verbose output to stderr, each occurrence of", - " this option increases verbosity", - "-q|--quiet suppress all messages, except errors", - NULL -};