Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/freebsd-src.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2022-11-11 18:02:26 +0300
committerMark Johnston <markj@FreeBSD.org>2022-11-11 18:02:26 +0300
commit8b1adff8bcbdf0e58878431c6ed5a14553178d4d (patch)
tree3a17e509e34eab35818dddc53184d94a109c21b6
parent593200c23b57ea6977bf5084b91fc5c63dacbb80 (diff)
bhyve: Drop volatile qualifiers from snapshot code
They accomplish nothing since the qualifier is casted away in calls to memcpy() and copyin()/copyout(). No functional change intended. MFC after: 2 weeks Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D37292
-rw-r--r--sys/amd64/include/vmm_snapshot.h10
-rw-r--r--sys/amd64/vmm/vmm_snapshot.c17
-rw-r--r--usr.sbin/bhyve/snapshot.c14
3 files changed, 17 insertions, 24 deletions
diff --git a/sys/amd64/include/vmm_snapshot.h b/sys/amd64/include/vmm_snapshot.h
index 8d1ecc1db4b1..d08f980e7988 100644
--- a/sys/amd64/include/vmm_snapshot.h
+++ b/sys/amd64/include/vmm_snapshot.h
@@ -101,13 +101,13 @@ struct vm_snapshot_meta {
};
void vm_snapshot_buf_err(const char *bufname, const enum vm_snapshot_op op);
-int vm_snapshot_buf(volatile void *data, size_t data_size,
- struct vm_snapshot_meta *meta);
+int vm_snapshot_buf(void *data, size_t data_size,
+ struct vm_snapshot_meta *meta);
size_t vm_get_snapshot_size(struct vm_snapshot_meta *meta);
int vm_snapshot_guest2host_addr(void **addrp, size_t len, bool restore_null,
- struct vm_snapshot_meta *meta);
-int vm_snapshot_buf_cmp(volatile void *data, size_t data_size,
- struct vm_snapshot_meta *meta);
+ struct vm_snapshot_meta *meta);
+int vm_snapshot_buf_cmp(void *data, size_t data_size,
+ struct vm_snapshot_meta *meta);
#define SNAPSHOT_BUF_OR_LEAVE(DATA, LEN, META, RES, LABEL) \
do { \
diff --git a/sys/amd64/vmm/vmm_snapshot.c b/sys/amd64/vmm/vmm_snapshot.c
index c77bb05f76b7..1e5f57028523 100644
--- a/sys/amd64/vmm/vmm_snapshot.c
+++ b/sys/amd64/vmm/vmm_snapshot.c
@@ -57,14 +57,11 @@ vm_snapshot_buf_err(const char *bufname, const enum vm_snapshot_op op)
}
int
-vm_snapshot_buf(volatile void *data, size_t data_size,
- struct vm_snapshot_meta *meta)
+vm_snapshot_buf(void *data, size_t data_size, struct vm_snapshot_meta *meta)
{
struct vm_snapshot_buffer *buffer;
int op;
- void *nv_data;
- nv_data = __DEVOLATILE(void *, data);
buffer = &meta->buffer;
op = meta->op;
@@ -74,9 +71,9 @@ vm_snapshot_buf(volatile void *data, size_t data_size,
}
if (op == VM_SNAPSHOT_SAVE)
- copyout(nv_data, buffer->buf, data_size);
+ copyout(data, buffer->buf, data_size);
else if (op == VM_SNAPSHOT_RESTORE)
- copyin(buffer->buf, nv_data, data_size);
+ copyin(buffer->buf, data, data_size);
else
return (EINVAL);
@@ -106,13 +103,11 @@ vm_get_snapshot_size(struct vm_snapshot_meta *meta)
}
int
-vm_snapshot_buf_cmp(volatile void *data, size_t data_size,
- struct vm_snapshot_meta *meta)
+vm_snapshot_buf_cmp(void *data, size_t data_size, struct vm_snapshot_meta *meta)
{
struct vm_snapshot_buffer *buffer;
int op;
int ret;
- void *_data = *(void **)(void *)&data;
buffer = &meta->buffer;
op = meta->op;
@@ -125,9 +120,9 @@ vm_snapshot_buf_cmp(volatile void *data, size_t data_size,
if (op == VM_SNAPSHOT_SAVE) {
ret = 0;
- copyout(_data, buffer->buf, data_size);
+ copyout(data, buffer->buf, data_size);
} else if (op == VM_SNAPSHOT_RESTORE) {
- ret = memcmp(_data, buffer->buf, data_size);
+ ret = memcmp(data, buffer->buf, data_size);
} else {
ret = EINVAL;
goto done;
diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c
index 0c7267316a17..6f4e3c1f91a2 100644
--- a/usr.sbin/bhyve/snapshot.c
+++ b/usr.sbin/bhyve/snapshot.c
@@ -1584,8 +1584,7 @@ vm_snapshot_buf_err(const char *bufname, const enum vm_snapshot_op op)
}
int
-vm_snapshot_buf(volatile void *data, size_t data_size,
- struct vm_snapshot_meta *meta)
+vm_snapshot_buf(void *data, size_t data_size, struct vm_snapshot_meta *meta)
{
struct vm_snapshot_buffer *buffer;
int op;
@@ -1599,9 +1598,9 @@ vm_snapshot_buf(volatile void *data, size_t data_size,
}
if (op == VM_SNAPSHOT_SAVE)
- memcpy(buffer->buf, (uint8_t *) data, data_size);
+ memcpy(buffer->buf, data, data_size);
else if (op == VM_SNAPSHOT_RESTORE)
- memcpy((uint8_t *) data, buffer->buf, data_size);
+ memcpy(data, buffer->buf, data_size);
else
return (EINVAL);
@@ -1667,8 +1666,7 @@ done:
}
int
-vm_snapshot_buf_cmp(volatile void *data, size_t data_size,
- struct vm_snapshot_meta *meta)
+vm_snapshot_buf_cmp(void *data, size_t data_size, struct vm_snapshot_meta *meta)
{
struct vm_snapshot_buffer *buffer;
int op;
@@ -1685,9 +1683,9 @@ vm_snapshot_buf_cmp(volatile void *data, size_t data_size,
if (op == VM_SNAPSHOT_SAVE) {
ret = 0;
- memcpy(buffer->buf, (uint8_t *) data, data_size);
+ memcpy(buffer->buf, data, data_size);
} else if (op == VM_SNAPSHOT_RESTORE) {
- ret = memcmp((uint8_t *) data, buffer->buf, data_size);
+ ret = memcmp(data, buffer->buf, data_size);
} else {
ret = EINVAL;
goto done;