migration: add cpr_walk_fd
Add a helper to walk all CPR fd's and run a callback for each. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Peter Xu <peterx@redhat.com> Link: https://lore.kernel.org/r/1759332851-370353-3-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
dc79c7d5e1
commit
a9f9eee58b
2 changed files with 16 additions and 0 deletions
|
|
@ -34,6 +34,9 @@ void cpr_resave_fd(const char *name, int id, int fd);
|
|||
int cpr_open_fd(const char *path, int flags, const char *name, int id,
|
||||
Error **errp);
|
||||
|
||||
typedef bool (*cpr_walk_fd_cb)(int fd);
|
||||
bool cpr_walk_fd(cpr_walk_fd_cb cb);
|
||||
|
||||
MigMode cpr_get_incoming_mode(void);
|
||||
void cpr_set_incoming_mode(MigMode mode);
|
||||
bool cpr_is_incoming(void);
|
||||
|
|
|
|||
|
|
@ -122,6 +122,19 @@ int cpr_open_fd(const char *path, int flags, const char *name, int id,
|
|||
return fd;
|
||||
}
|
||||
|
||||
bool cpr_walk_fd(cpr_walk_fd_cb cb)
|
||||
{
|
||||
CprFd *elem;
|
||||
|
||||
QLIST_FOREACH(elem, &cpr_state.fds, next) {
|
||||
g_assert(elem->fd >= 0);
|
||||
if (!cb(elem->fd)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
static const VMStateDescription vmstate_cpr_state = {
|
||||
.name = CPR_STATE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue