@@ -19,6 +19,7 @@ typedef int (*cpr_walk_fd_cb)(int fd);
void cpr_save_fd(const char *name, int id, int fd);
void cpr_delete_fd(const char *name, int id);
int cpr_find_fd(const char *name, int id);
+int cpr_find_fd_any(const char *name, int *id_p);
int cpr_walk_fd(cpr_walk_fd_cb cb);
void cpr_resave_fd(const char *name, int id, int fd);
@@ -109,6 +109,21 @@ int cpr_find_fd(const char *name, int id)
return fd;
}
+int cpr_find_fd_any(const char *name, int *id_p)
+{
+ CprFd *elem;
+
+ QLIST_FOREACH(elem, &cpr_state.fds, next) {
+ if (!strcmp(elem->name, name)) {
+ trace_cpr_find_fd(name, elem->id, elem->fd);
+ *id_p = elem->id;
+ return elem->fd;
+ }
+ }
+ trace_cpr_find_fd(name, -1, -1);
+ return -1;
+}
+
int cpr_walk_fd(cpr_walk_fd_cb cb)
{
CprFd *elem;
Add a function for finding a CPR fd by name, for any value of id, and return the id. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> --- include/migration/cpr.h | 1 + migration/cpr.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+)