From: Johannes Thumshirn <jth@kernel.org>
To: David Sterba <dsterba@suse.cz>
Cc: "linux-btrfs @ vger . kernel . org" <linux-btrfs@vger.kernel.org>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [PATCH 5/5] btrfs-progs: add auth key to check
Date: Tue, 28 Apr 2020 13:11:08 +0200 [thread overview]
Message-ID: <20200428111109.5687-6-jth@kernel.org> (raw)
In-Reply-To: <20200428111109.5687-1-jth@kernel.org>
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Add auth-key option for btrfs check so we can check an authenticated
file-system.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
check/main.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/check/main.c b/check/main.c
index 21b37e66..bb848edb 100644
--- a/check/main.c
+++ b/check/main.c
@@ -9937,6 +9937,7 @@ static const char * const cmd_check_usage[] = {
" --clear-space-cache v1|v2 clear space cache for v1 or v2",
" check and reporting options:",
" --check-data-csum verify checksums of data blocks",
+ " --auth-key key for authenticated file-system",
" -Q|--qgroup-report print a report on qgroup consistency",
" -E|--subvol-extents <subvolid>",
" print subvolume extents and sharing state",
@@ -9965,6 +9966,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
int qgroup_report_ret;
unsigned ctree_flags = OPEN_CTREE_EXCLUSIVE;
int force = 0;
+ char *auth_key = NULL;
while(1) {
int c;
@@ -9972,7 +9974,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
GETOPT_VAL_INIT_EXTENT, GETOPT_VAL_CHECK_CSUM,
GETOPT_VAL_READONLY, GETOPT_VAL_CHUNK_TREE,
GETOPT_VAL_MODE, GETOPT_VAL_CLEAR_SPACE_CACHE,
- GETOPT_VAL_FORCE };
+ GETOPT_VAL_FORCE, GETOPT_VAL_AUTH_KEY };
static const struct option long_options[] = {
{ "super", required_argument, NULL, 's' },
{ "repair", no_argument, NULL, GETOPT_VAL_REPAIR },
@@ -9995,6 +9997,8 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
{ "clear-space-cache", required_argument, NULL,
GETOPT_VAL_CLEAR_SPACE_CACHE},
{ "force", no_argument, NULL, GETOPT_VAL_FORCE },
+ { "auth-key", required_argument, NULL,
+ GETOPT_VAL_AUTH_KEY },
{ NULL, 0, NULL, 0}
};
@@ -10082,6 +10086,9 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
case GETOPT_VAL_FORCE:
force = 1;
break;
+ case GETOPT_VAL_AUTH_KEY:
+ auth_key = strdup(optarg);
+ break;
}
}
@@ -10162,7 +10169,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv)
ctree_flags |= OPEN_CTREE_PARTIAL;
info = open_ctree_fs_info(argv[optind], bytenr, tree_root_bytenr,
- chunk_root_bytenr, ctree_flags, NULL);
+ chunk_root_bytenr, ctree_flags, auth_key);
if (!info) {
error("cannot open file system");
ret = -EIO;
@@ -10508,6 +10515,8 @@ err_out:
if (ctx.progress_enabled)
task_deinit(ctx.info);
+ free(auth_key);
+
return err;
}
DEFINE_SIMPLE_COMMAND(check, "check");
--
2.16.4
next prev parent reply other threads:[~2020-04-28 11:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 11:11 [PATCH 0/5] btrfs-progs: support creating authenticated file-systems Johannes Thumshirn
2020-04-28 11:11 ` [PATCH 1/5] btrfs-progs: pass in fs_info to btrfs_csum_data Johannes Thumshirn
2020-04-28 11:11 ` [PATCH 2/5] btrfs-progs: add auth_key argument to open_ctree_fs_info Johannes Thumshirn
2020-04-28 11:11 ` [PATCH 3/5] btrfs-progs: Add HMAC(SHA256) support Johannes Thumshirn
2020-04-29 11:45 ` Johannes Thumshirn
2020-04-28 11:11 ` [PATCH 4/5] btrfs-progs: add --auth-key to dump-super Johannes Thumshirn
2020-04-28 11:11 ` Johannes Thumshirn [this message]
2020-04-28 11:11 ` [PATCH 0/5] btrfs-progs: support creating authenticated file-systems Johannes Thumshirn
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=20200428111109.5687-6-jth@kernel.org \
--to=jth@kernel.org \
--cc=dsterba@suse.cz \
--cc=johannes.thumshirn@wdc.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.