Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 28f331b

Browse filesBrowse files
migration: added api to get access to internal buffer
Signed-off-by: Vitaly Chipounov <vitaly@cyberhaven.io>
1 parent baba4c6 commit 28f331b
Copy full SHA for 28f331b

File tree

Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed

‎migration/qemu-file.c

Copy file name to clipboardExpand all lines: migration/qemu-file.c
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,15 @@ void qemu_fflush(QEMUFile *f)
202202
f->iovcnt = 0;
203203
}
204204

205+
void *qemu_file_get_internal_storage(QEMUFile *f, size_t *size)
206+
{
207+
if (f->ops->get_internal_storage) {
208+
return f->ops->get_internal_storage(f->opaque, size);
209+
}
210+
211+
return NULL;
212+
}
213+
205214
void ram_control_before_iterate(QEMUFile *f, uint64_t flags)
206215
{
207216
int ret = 0;

‎migration/qemu-file.h

Copy file name to clipboardExpand all lines: migration/qemu-file.h
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,21 @@ typedef QEMUFile *(QEMURetPathFunc)(void *opaque);
9999
*/
100100
typedef int (QEMUFileShutdownFunc)(void *opaque, bool rd, bool wr);
101101

102+
/*
103+
* Gets the internal storage buffer of the file object.
104+
* Returns NULL if the command is not supported or there is
105+
* no storage.
106+
*/
107+
typedef void* (QEMUFileGetStorageFunc)(void *opaque, size_t *size);
108+
102109
typedef struct QEMUFileOps {
103110
QEMUFileGetBufferFunc *get_buffer;
104111
QEMUFileCloseFunc *close;
105112
QEMUFileSetBlocking *set_blocking;
106113
QEMUFileWritevBufferFunc *writev_buffer;
107114
QEMURetPathFunc *get_return_path;
108115
QEMUFileShutdownFunc *shut_down;
116+
QEMUFileGetStorageFunc *get_internal_storage;
109117
} QEMUFileOps;
110118

111119
typedef struct QEMUFileHooks {
@@ -156,6 +164,8 @@ QEMUFile *qemu_file_get_return_path(QEMUFile *f);
156164
void qemu_fflush(QEMUFile *f);
157165
void qemu_file_set_blocking(QEMUFile *f, bool block);
158166

167+
void *qemu_file_get_internal_storage(QEMUFile *f, size_t *size);
168+
159169
size_t qemu_get_counted_string(QEMUFile *f, char buf[256]);
160170

161171
void ram_control_before_iterate(QEMUFile *f, uint64_t flags);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.