git: d656ce199d72 - main - bhyve/snapshot: rename and bump size of MAX_SNAPSHOT_VMNAME

Robert Wing rew at FreeBSD.org
Sat Feb 27 21:45:47 UTC 2021


The branch main has been updated by rew:

URL: https://cgit.FreeBSD.org/src/commit/?id=d656ce199d72f1aeeef1b2e28b4a284c968a8d03

commit d656ce199d72f1aeeef1b2e28b4a284c968a8d03
Author:     Robert Wing <rew at FreeBSD.org>
AuthorDate: 2021-02-27 21:07:35 +0000
Commit:     Robert Wing <rew at FreeBSD.org>
CommitDate: 2021-02-27 21:07:35 +0000

    bhyve/snapshot: rename and bump size of MAX_SNAPSHOT_VMNAME
    
    MAX_SNAPSHOT_VMNAME is a macro used to set the size of a character
    buffer that stores a filename or the path to a file - this file is used
    by the save/restore feature.
    
    Since the file doesn't have anything to do with a vm name, rename
    MAX_SNAPSHOT_VMNAME to MAX_SNAPSHOT_FILENAME. Bump the size to PATH_MAX
    while here.
    
    Reviewed by:    jhb
    Differential Revision:  https://reviews.freebsd.org/D28879
---
 usr.sbin/bhyve/snapshot.h    | 4 ++--
 usr.sbin/bhyvectl/bhyvectl.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h
index 62b2083b9830..8a6ee67ef19d 100644
--- a/usr.sbin/bhyve/snapshot.h
+++ b/usr.sbin/bhyve/snapshot.h
@@ -43,7 +43,7 @@
 #include <ucl.h>
 
 #define BHYVE_RUN_DIR "/var/run/bhyve/"
-#define MAX_SNAPSHOT_VMNAME 100
+#define MAX_SNAPSHOT_FILENAME PATH_MAX
 
 struct vmctx;
 
@@ -67,7 +67,7 @@ enum ipc_opcode {
 
 struct checkpoint_op {
 	unsigned int op;
-	char snapshot_filename[MAX_SNAPSHOT_VMNAME];
+	char snapshot_filename[MAX_SNAPSHOT_FILENAME];
 };
 
 struct checkpoint_thread_info {
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c
index f9a790f5402e..68cc958e66ec 100644
--- a/usr.sbin/bhyvectl/bhyvectl.c
+++ b/usr.sbin/bhyvectl/bhyvectl.c
@@ -1739,7 +1739,7 @@ snapshot_request(struct vmctx *ctx, const char *file, enum ipc_opcode code)
 	struct checkpoint_op op;
 
 	op.op = code;
-	strlcpy(op.snapshot_filename, file, MAX_SNAPSHOT_VMNAME);
+	strlcpy(op.snapshot_filename, file, MAX_SNAPSHOT_FILENAME);
 
 	return (send_checkpoint_op_req(ctx, &op));
 }


More information about the dev-commits-src-all mailing list