git: 5573404166b0 - stable/13 - bhyve: rename 'user_dev' with 'devices'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Aug 2023 07:18:44 UTC
The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=5573404166b090ccf8556888efd9657657b54032 commit 5573404166b090ccf8556888efd9657657b54032 Author: Vitaliy Gusev <gusev.vitaliy@gmail.com> AuthorDate: 2023-05-15 14:28:14 +0000 Commit: Corvin Köhne <corvink@FreeBSD.org> CommitDate: 2023-08-18 07:04:25 +0000 bhyve: rename 'user_dev' with 'devices' Bhyve don't use 'user' specifier for emulated devices. And using 'user' adds duality. Reviewed by: corvink, rew MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D40106 (cherry picked from commit b10d65a420f068bccf6aaf2942157a5347211dc5) --- usr.sbin/bhyve/bhyverun.c | 6 +++--- usr.sbin/bhyve/snapshot.c | 23 +++++++++++------------ usr.sbin/bhyve/snapshot.h | 6 +++--- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index 63ca9439d6e6..4db8274335cd 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -1520,7 +1520,7 @@ main(int argc, char *argv[]) #ifdef BHYVE_SNAPSHOT if (restore_file != NULL) { fprintf(stdout, "Pausing pci devs...\r\n"); - if (vm_pause_user_devs() != 0) { + if (vm_pause_devices() != 0) { fprintf(stderr, "Failed to pause PCI device state.\n"); exit(1); } @@ -1532,7 +1532,7 @@ main(int argc, char *argv[]) } fprintf(stdout, "Restoring pci devs...\r\n"); - if (vm_restore_user_devs(ctx, &rstate) != 0) { + if (vm_restore_devices(ctx, &rstate) != 0) { fprintf(stderr, "Failed to restore PCI device state.\n"); exit(1); } @@ -1544,7 +1544,7 @@ main(int argc, char *argv[]) } fprintf(stdout, "Resuming pci devs...\r\n"); - if (vm_resume_user_devs() != 0) { + if (vm_resume_devices() != 0) { fprintf(stderr, "Failed to resume PCI device state.\n"); exit(1); } diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 5f9ef2053990..451839944bd6 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -926,7 +926,7 @@ vm_restore_kern_structs(struct vmctx *ctx, struct restore_state *rstate) } static int -vm_restore_user_dev(struct vmctx *ctx, struct restore_state *rstate, +vm_restore_device(struct vmctx *ctx, struct restore_state *rstate, const struct vm_snapshot_dev_info *info) { void *dev_ptr; @@ -971,15 +971,14 @@ vm_restore_user_dev(struct vmctx *ctx, struct restore_state *rstate, return (0); } - int -vm_restore_user_devs(struct vmctx *ctx, struct restore_state *rstate) +vm_restore_devices(struct vmctx *ctx, struct restore_state *rstate) { size_t i; int ret; for (i = 0; i < nitems(snapshot_devs); i++) { - ret = vm_restore_user_dev(ctx, rstate, &snapshot_devs[i]); + ret = vm_restore_device(ctx, rstate, &snapshot_devs[i]); if (ret != 0) return (ret); } @@ -988,7 +987,7 @@ vm_restore_user_devs(struct vmctx *ctx, struct restore_state *rstate) } int -vm_pause_user_devs(void) +vm_pause_devices(void) { const struct vm_snapshot_dev_info *info; size_t i; @@ -1008,7 +1007,7 @@ vm_pause_user_devs(void) } int -vm_resume_user_devs(void) +vm_resume_devices(void) { const struct vm_snapshot_dev_info *info; size_t i; @@ -1163,7 +1162,7 @@ vm_snapshot_dev_write_data(int data_fd, xo_handle_t *xop, const char *array_key, } static int -vm_snapshot_user_dev(const struct vm_snapshot_dev_info *info, +vm_snapshot_device(const struct vm_snapshot_dev_info *info, int data_fd, xo_handle_t *xop, struct vm_snapshot_meta *meta, off_t *offset) { @@ -1185,7 +1184,7 @@ vm_snapshot_user_dev(const struct vm_snapshot_dev_info *info, } static int -vm_snapshot_user_devs(struct vmctx *ctx, int data_fd, xo_handle_t *xop) +vm_snapshot_devices(struct vmctx *ctx, int data_fd, xo_handle_t *xop) { int ret; off_t offset; @@ -1227,7 +1226,7 @@ vm_snapshot_user_devs(struct vmctx *ctx, int data_fd, xo_handle_t *xop) meta->buffer.buf = meta->buffer.buf_start; meta->buffer.buf_rem = meta->buffer.buf_size; - ret = vm_snapshot_user_dev(&snapshot_devs[i], data_fd, xop, + ret = vm_snapshot_device(&snapshot_devs[i], data_fd, xop, meta, &offset); if (ret != 0) goto snapshot_err; @@ -1365,7 +1364,7 @@ vm_checkpoint(struct vmctx *ctx, const char *checkpoint_file, bool stop_vm) vm_vcpu_pause(ctx); - ret = vm_pause_user_devs(); + ret = vm_pause_devices(); if (ret != 0) { fprintf(stderr, "Could not pause devices\r\n"); error = ret; @@ -1394,7 +1393,7 @@ vm_checkpoint(struct vmctx *ctx, const char *checkpoint_file, bool stop_vm) goto done; } - ret = vm_snapshot_user_devs(ctx, kdata_fd, xop); + ret = vm_snapshot_devices(ctx, kdata_fd, xop); if (ret != 0) { fprintf(stderr, "Failed to snapshot device state.\n"); error = -1; @@ -1409,7 +1408,7 @@ vm_checkpoint(struct vmctx *ctx, const char *checkpoint_file, bool stop_vm) } done: - ret = vm_resume_user_devs(); + ret = vm_resume_devices(); if (ret != 0) fprintf(stderr, "Could not resume devices\r\n"); vm_vcpu_resume(ctx); diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h index 9bf881fded92..5f98be875544 100644 --- a/usr.sbin/bhyve/snapshot.h +++ b/usr.sbin/bhyve/snapshot.h @@ -95,9 +95,9 @@ void checkpoint_cpu_suspend(int vcpu); int restore_vm_mem(struct vmctx *ctx, struct restore_state *rstate); int vm_restore_kern_structs(struct vmctx *ctx, struct restore_state *rstate); -int vm_restore_user_devs(struct vmctx *ctx, struct restore_state *rstate); -int vm_pause_user_devs(void); -int vm_resume_user_devs(void); +int vm_restore_devices(struct vmctx *ctx, struct restore_state *rstate); +int vm_pause_devices(void); +int vm_resume_devices(void); int get_checkpoint_msg(int conn_fd, struct vmctx *ctx); void *checkpoint_thread(void *param);