[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 18/19] tools/vhost-user-rpmb: allow setting of the write_coun
From: |
Alex Bennée |
Subject: |
[RFC PATCH 18/19] tools/vhost-user-rpmb: allow setting of the write_count |
Date: |
Fri, 25 Sep 2020 13:51:46 +0100 |
This is mostly useful for testing. Practically all guest operations
will probe the write count before any write transaction.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
tools/vhost-user-rpmb/main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/vhost-user-rpmb/main.c b/tools/vhost-user-rpmb/main.c
index 34607ad19429..c798a6f66cd2 100644
--- a/tools/vhost-user-rpmb/main.c
+++ b/tools/vhost-user-rpmb/main.c
@@ -39,6 +39,7 @@
static gchar *socket_path;
static char *flash_path;
static char *key_path;
+static gint initial_counter;
static gint socket_fd = -1;
static gboolean print_cap;
static gboolean verbose;
@@ -49,6 +50,7 @@ static GOptionEntry options[] =
{
{ "socket-path", 0, 0, G_OPTION_ARG_FILENAME, &socket_path, "Location of
vhost-user Unix domain socket, incompatible with --fd", "PATH" },
{ "flash-path", 0, 0, G_OPTION_ARG_FILENAME, &flash_path, "Location of raw
flash image file", "PATH" },
+ { "initial-counter", 0, 0, G_OPTION_ARG_INT, &initial_counter, "Set
initial value of write counter", NULL},
{ "key-path", 0, 0, G_OPTION_ARG_FILENAME, &key_path, "Location of
persistent keyfile", "KEY"},
{ "key-set", 0, 0, G_OPTION_ARG_NONE, &key_set, "Is the key already
programmed", NULL},
{ "fd", 0, 0, G_OPTION_ARG_INT, &socket_fd, "Specify the file-descriptor
of the backend, incompatible with --socket-path", "FD" },
@@ -797,6 +799,10 @@ int main(int argc, char *argv[])
vrpmb_set_key(&rpmb, key_path);
}
+ if (initial_counter) {
+ rpmb.write_count = initial_counter;
+ }
+
if (!socket_path && socket_fd < 0) {
g_printerr("Please specify either --fd or --socket-path\n");
exit(EXIT_FAILURE);
--
2.20.1
- [RFC PATCH 06/19] tools/vhost-user-rpmb: add boilerplate and initial main, (continued)
- [RFC PATCH 06/19] tools/vhost-user-rpmb: add boilerplate and initial main, Alex Bennée, 2020/09/25
- [RFC PATCH 07/19] tools/vhost-user-rpmb: implement --print-capabilities, Alex Bennée, 2020/09/25
- [RFC PATCH 08/19] tools/vhost-user-rpmb: connect to fd and instantiate basic run loop, Alex Bennée, 2020/09/25
- [RFC PATCH 09/19] tools/vhost-user-rpmb: add a --verbose/debug flags for logging, Alex Bennée, 2020/09/25
- [RFC PATCH 11/19] tools/vhost-user-rpmb: add --flash-path for backing store, Alex Bennée, 2020/09/25
- [RFC PATCH 12/19] tools/vhost-user-rpmb: import hmac_sha256 functions, Alex Bennée, 2020/09/25
- [RFC PATCH 10/19] tools/vhost-user-rpmb: handle shutdown and SIGINT/SIGHUP cleanly, Alex Bennée, 2020/09/25
- [RFC PATCH 17/19] tools/vhost-user-rpmb: add key persistence, Alex Bennée, 2020/09/25
- [RFC PATCH 15/19] tools/vhost-user-rpmb: implement VIRTIO_RPMB_REQ_DATA_WRITE, Alex Bennée, 2020/09/25
- [RFC PATCH 16/19] tools/vhost-user-rpmb: implement VIRTIO_RPMB_REQ_DATA_READ, Alex Bennée, 2020/09/25
- [RFC PATCH 18/19] tools/vhost-user-rpmb: allow setting of the write_count,
Alex Bennée <=
- [RFC PATCH 13/19] tools/vhost-user-rpmb: implement the PROGRAM_KEY handshake, Alex Bennée, 2020/09/25
- [RFC PATCH 19/19] docs: add a man page for vhost-user-rpmb, Alex Bennée, 2020/09/25
- [RFC PATCH 14/19] tools/vhost-user-rpmb: implement VIRTIO_RPMB_REQ_GET_WRITE_COUNTER, Alex Bennée, 2020/09/25
- Re: [RFC PATCH 00/19] vhost-user-rpmb (Replay Protected Memory Block), no-reply, 2020/09/25