Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102850179
D43754.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D43754.diff
View Options
diff --git a/sys/amd64/include/vmm_snapshot.h b/sys/amd64/include/vmm_snapshot.h
--- a/sys/amd64/include/vmm_snapshot.h
+++ b/sys/amd64/include/vmm_snapshot.h
@@ -98,8 +98,6 @@
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_buf_cmp(void *data, size_t data_size,
- struct vm_snapshot_meta *meta);
#define SNAPSHOT_BUF_OR_LEAVE(DATA, LEN, META, RES, LABEL) \
do { \
@@ -113,6 +111,10 @@
#define SNAPSHOT_VAR_OR_LEAVE(DATA, META, RES, LABEL) \
SNAPSHOT_BUF_OR_LEAVE(&(DATA), sizeof(DATA), (META), (RES), LABEL)
+#ifndef _KERNEL
+int vm_snapshot_buf_cmp(void *data, size_t data_size,
+ struct vm_snapshot_meta *meta);
+
/* compare the value in the meta buffer with the data */
#define SNAPSHOT_BUF_CMP_OR_LEAVE(DATA, LEN, META, RES, LABEL) \
do { \
@@ -126,4 +128,5 @@
#define SNAPSHOT_VAR_CMP_OR_LEAVE(DATA, META, RES, LABEL) \
SNAPSHOT_BUF_CMP_OR_LEAVE(&(DATA), sizeof(DATA), (META), (RES), LABEL)
+#endif /* _KERNEL */
#endif
diff --git a/sys/amd64/vmm/vmm_snapshot.c b/sys/amd64/vmm/vmm_snapshot.c
--- a/sys/amd64/vmm/vmm_snapshot.c
+++ b/sys/amd64/vmm/vmm_snapshot.c
@@ -57,7 +57,7 @@
vm_snapshot_buf(void *data, size_t data_size, struct vm_snapshot_meta *meta)
{
struct vm_snapshot_buffer *buffer;
- int op;
+ int op, error;
buffer = &meta->buffer;
op = meta->op;
@@ -68,11 +68,14 @@
}
if (op == VM_SNAPSHOT_SAVE)
- copyout(data, buffer->buf, data_size);
+ error = copyout(data, buffer->buf, data_size);
else if (op == VM_SNAPSHOT_RESTORE)
- copyin(buffer->buf, data, data_size);
+ error = copyin(buffer->buf, data, data_size);
else
- return (EINVAL);
+ error = EINVAL;
+
+ if (error)
+ return (error);
buffer->buf += data_size;
buffer->buf_rem -= data_size;
@@ -98,36 +101,3 @@
return (length);
}
-
-int
-vm_snapshot_buf_cmp(void *data, size_t data_size, struct vm_snapshot_meta *meta)
-{
- struct vm_snapshot_buffer *buffer;
- int op;
- int ret;
-
- buffer = &meta->buffer;
- op = meta->op;
-
- if (buffer->buf_rem < data_size) {
- printf("%s: buffer too small\r\n", __func__);
- ret = E2BIG;
- goto done;
- }
-
- if (op == VM_SNAPSHOT_SAVE) {
- ret = 0;
- copyout(data, buffer->buf, data_size);
- } else if (op == VM_SNAPSHOT_RESTORE) {
- ret = memcmp(data, buffer->buf, data_size);
- } else {
- ret = EINVAL;
- goto done;
- }
-
- buffer->buf += data_size;
- buffer->buf_rem -= data_size;
-
-done:
- return (ret);
-}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 11:43 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14706701
Default Alt Text
D43754.diff (2 KB)
Attached To
Mode
D43754: vmm: Fix compiling error with BHYVE_SNAPSHOT
Attached
Detach File
Event Timeline
Log In to Comment