[CRIU] [PATCH 04/15] img: Rename fdset -> imgset

Pavel Emelyanov xemul at parallels.com
Mon Sep 29 01:47:37 PDT 2014


Since we're going to switch from int-fd-s to class-image
soon the fdset name will not fit into the new terminology.

This patch is

 sed -e 's/fdset/imgset/g' -i *
 sed -e 's/imgset_fd/img_from_set/g' -i *
 git mv include/fdset.h include/imgset.h

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 cgroup.c                   |  4 +--
 cr-dump.c                  | 66 +++++++++++++++++++-------------------
 cr-show.c                  | 22 ++++++-------
 eventfd.c                  |  4 +--
 eventpoll.c                |  4 +--
 fifo.c                     |  4 +--
 file-lock.c                |  4 +--
 files-ext.c                |  4 +--
 files-reg.c                | 12 +++----
 files.c                    |  2 +-
 fsnotify.c                 |  6 ++--
 image-desc.c               |  2 +-
 image.c                    | 80 +++++++++++++++++++++++-----------------------
 include/fdset.h            | 36 ---------------------
 include/fifo.h             |  2 +-
 include/files-reg.h        |  2 +-
 include/files.h            |  2 +-
 include/image-desc.h       |  2 +-
 include/imgset.h           | 36 +++++++++++++++++++++
 include/mount.h            |  2 +-
 include/net.h              |  4 +--
 include/parasite-syscall.h |  4 +--
 include/signalfd.h         |  2 +-
 include/sk-packet.h        |  2 +-
 include/sockets.h          |  2 +-
 include/tun.h              |  2 +-
 ipc_ns.c                   | 22 ++++++-------
 namespaces.c               | 30 ++++++++---------
 net.c                      | 40 +++++++++++------------
 parasite-syscall.c         |  6 ++--
 pipes.c                    |  6 ++--
 signalfd.c                 |  4 +--
 sk-inet.c                  |  4 +--
 sk-netlink.c               |  4 +--
 sk-packet.c                |  4 +--
 sk-queue.c                 |  6 ++--
 sk-unix.c                  |  6 ++--
 timerfd.c                  |  4 +--
 tty.c                      |  8 ++---
 tun.c                      |  6 ++--
 40 files changed, 231 insertions(+), 231 deletions(-)
 delete mode 100644 include/fdset.h
 create mode 100644 include/imgset.h

diff --git a/cgroup.c b/cgroup.c
index 73d409f..38db4bb 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -14,7 +14,7 @@
 #include "pstree.h"
 #include "proc_parse.h"
 #include "util.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "util-pie.h"
 #include "protobuf.h"
 #include "protobuf/core.pb-c.h"
@@ -828,7 +828,7 @@ int dump_cgroups(void)
 		return -1;
 
 	pr_info("Writing CG image\n");
-	return pb_write_one(fdset_fd(glob_fdset, CR_FD_CGROUP), &cg, PB_CGROUP);
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_CGROUP), &cg, PB_CGROUP);
 }
 
 static int ctrl_dir_and_opt(CgControllerEntry *ctl, char *dir, int ds,
diff --git a/cr-dump.c b/cr-dump.c
index d00c158..c620aac 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -31,7 +31,7 @@
 
 #include "asm/types.h"
 #include "list.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "file-ids.h"
 #include "kcmp-ids.h"
 #include "compiler.h"
@@ -211,7 +211,7 @@ static int dump_sched_info(int pid, ThreadCoreEntry *tc)
 	return 0;
 }
 
-struct cr_fdset *glob_fdset;
+struct cr_imgset *glob_imgset;
 
 static int collect_fds(pid_t pid, struct parasite_drain_fd *dfds)
 {
@@ -292,7 +292,7 @@ static int dump_task_exe_link(pid_t pid, MmEntry *mm)
 	return ret;
 }
 
-static int dump_task_fs(pid_t pid, struct parasite_dump_misc *misc, struct cr_fdset *fdset)
+static int dump_task_fs(pid_t pid, struct parasite_dump_misc *misc, struct cr_imgset *imgset)
 {
 	struct fd_parms p;
 	FsEntry fe = FS_ENTRY__INIT;
@@ -334,7 +334,7 @@ static int dump_task_fs(pid_t pid, struct parasite_dump_misc *misc, struct cr_fd
 	pr_info("Dumping task cwd id %#x root id %#x\n",
 			fe.cwd_id, fe.root_id);
 
-	return pb_write_one(fdset_fd(fdset, CR_FD_FS), &fe, PB_FS);
+	return pb_write_one(img_from_set(imgset, CR_FD_FS), &fe, PB_FS);
 }
 
 static inline u_int64_t encode_rlim(unsigned long val)
@@ -362,7 +362,7 @@ static int dump_task_rlimits(int pid, TaskRlimitsEntry *rls)
 }
 
 static int dump_filemap(pid_t pid, struct vma_area *vma_area,
-		const struct cr_fdset *fdset)
+		const struct cr_imgset *imgset)
 {
 	struct fd_parms p = FD_PARMS_INIT;
 	VmaEntry *vma = vma_area->e;
@@ -441,7 +441,7 @@ err:
 static int dump_task_mm(pid_t pid, const struct proc_pid_stat *stat,
 		const struct parasite_dump_misc *misc,
 		const struct vm_area_list *vma_area_list,
-		const struct cr_fdset *fdset)
+		const struct cr_imgset *imgset)
 {
 	MmEntry mme = MM_ENTRY__INIT;
 	struct vma_area *vma_area;
@@ -469,7 +469,7 @@ static int dump_task_mm(pid_t pid, const struct proc_pid_stat *stat,
 			ret = add_shmem_area(pid, vma);
 		else if (vma_entry_is(vma, VMA_FILE_PRIVATE) ||
 				vma_entry_is(vma, VMA_FILE_SHARED))
-			ret = dump_filemap(pid, vma_area, fdset);
+			ret = dump_filemap(pid, vma_area, imgset);
 		else if (vma_entry_is(vma, VMA_AREA_SOCKET))
 			ret = dump_socket_map(vma_area);
 		else
@@ -508,14 +508,14 @@ static int dump_task_mm(pid_t pid, const struct proc_pid_stat *stat,
 	if (dump_task_exe_link(pid, &mme))
 		goto err;
 
-	ret = pb_write_one(fdset_fd(fdset, CR_FD_MM), &mme, PB_MM);
+	ret = pb_write_one(img_from_set(imgset, CR_FD_MM), &mme, PB_MM);
 	xfree(mme.mm_saved_auxv);
 err:
 	return ret;
 }
 
 static int dump_task_creds(struct parasite_ctl *ctl,
-			   const struct cr_fdset *fds,
+			   const struct cr_imgset *fds,
 			   struct proc_status_creds *cr)
 {
 	CredsEntry ce = CREDS_ENTRY__INIT;
@@ -536,7 +536,7 @@ static int dump_task_creds(struct parasite_ctl *ctl,
 	if (parasite_dump_creds(ctl, &ce) < 0)
 		return -1;
 
-	return pb_write_one(fdset_fd(fds, CR_FD_CREDS), &ce, PB_CREDS);
+	return pb_write_one(img_from_set(fds, CR_FD_CREDS), &ce, PB_CREDS);
 }
 
 static int get_task_futex_robust_list(pid_t pid, ThreadCoreEntry *info)
@@ -674,9 +674,9 @@ err:
 	return -1;
 }
 
-static int dump_task_ids(struct pstree_item *item, const struct cr_fdset *cr_fdset)
+static int dump_task_ids(struct pstree_item *item, const struct cr_imgset *cr_imgset)
 {
-	return pb_write_one(fdset_fd(cr_fdset, CR_FD_IDS), item->ids, PB_IDS);
+	return pb_write_one(img_from_set(cr_imgset, CR_FD_IDS), item->ids, PB_IDS);
 }
 
 int dump_thread_core(int pid, CoreEntry *core, const struct parasite_dump_thread *ti)
@@ -704,9 +704,9 @@ int dump_thread_core(int pid, CoreEntry *core, const struct parasite_dump_thread
 static int dump_task_core_all(struct pstree_item *item,
 		const struct proc_pid_stat *stat,
 		const struct parasite_dump_misc *misc,
-		const struct cr_fdset *cr_fdset)
+		const struct cr_imgset *cr_imgset)
 {
-	int fd_core = fdset_fd(cr_fdset, CR_FD_CORE);
+	int fd_core = img_from_set(cr_imgset, CR_FD_CORE);
 	CoreEntry *core = item->core[0];
 	pid_t pid = item->pid.real;
 	int ret = -1;
@@ -1455,7 +1455,7 @@ static int dump_one_task(struct pstree_item *item)
 	struct parasite_ctl *parasite_ctl;
 	int ret = -1;
 	struct parasite_dump_misc misc;
-	struct cr_fdset *cr_fdset = NULL;
+	struct cr_imgset *cr_imgset = NULL;
 	struct parasite_drain_fd *dfds = NULL;
 	struct proc_posix_timers_stat proc_args;
 	struct proc_status_creds cr;
@@ -1531,11 +1531,11 @@ static int dump_one_task(struct pstree_item *item)
 		pfd = parasite_get_proc_fd_seized(parasite_ctl);
 		if (pfd < 0) {
 			pr_err("Can't get proc fd (pid: %d)\n", pid);
-			goto err_cure_fdset;
+			goto err_cure_imgset;
 		}
 
 		if (install_service_fd(CR_PROC_FD_OFF, pfd) < 0)
-			goto err_cure_fdset;
+			goto err_cure_imgset;
 
 		close(pfd);
 	}
@@ -1543,13 +1543,13 @@ static int dump_one_task(struct pstree_item *item)
 	ret = parasite_fixup_vdso(parasite_ctl, pid, &vmas);
 	if (ret) {
 		pr_err("Can't fixup vdso VMAs (pid: %d)\n", pid);
-		goto err_cure_fdset;
+		goto err_cure_imgset;
 	}
 
 	ret = parasite_dump_misc_seized(parasite_ctl, &misc);
 	if (ret) {
 		pr_err("Can't dump misc (pid: %d)\n", pid);
-		goto err_cure_fdset;
+		goto err_cure_imgset;
 	}
 
 	parasite_ctl->pid.virt = item->pid.virt = misc.pid;
@@ -1567,11 +1567,11 @@ static int dump_one_task(struct pstree_item *item)
 	}
 
 	ret = -1;
-	cr_fdset = cr_task_fdset_open(item->pid.virt, O_DUMP);
-	if (!cr_fdset)
+	cr_imgset = cr_task_imgset_open(item->pid.virt, O_DUMP);
+	if (!cr_imgset)
 		goto err_cure;
 
-	ret = dump_task_ids(item, cr_fdset);
+	ret = dump_task_ids(item, cr_imgset);
 	if (ret) {
 		pr_err("Dump ids (pid: %d) failed with %d\n", pid, ret);
 		goto err_cure;
@@ -1589,7 +1589,7 @@ static int dump_one_task(struct pstree_item *item)
 	if (ret)
 		goto err_cure;
 
-	ret = parasite_dump_sigacts_seized(parasite_ctl, cr_fdset);
+	ret = parasite_dump_sigacts_seized(parasite_ctl, cr_imgset);
 	if (ret) {
 		pr_err("Can't dump sigactions (pid: %d) with parasite\n", pid);
 		goto err_cure;
@@ -1607,7 +1607,7 @@ static int dump_one_task(struct pstree_item *item)
 		goto err_cure;
 	}
 
-	ret = dump_task_core_all(item, &pps_buf, &misc, cr_fdset);
+	ret = dump_task_core_all(item, &pps_buf, &misc, cr_imgset);
 	if (ret) {
 		pr_err("Dump core (pid: %d) failed with %d\n", pid, ret);
 		goto err_cure;
@@ -1619,7 +1619,7 @@ static int dump_one_task(struct pstree_item *item)
 		goto err_cure;
 	}
 
-	ret = dump_task_creds(parasite_ctl, cr_fdset, &cr);
+	ret = dump_task_creds(parasite_ctl, cr_imgset, &cr);
 	if (ret) {
 		pr_err("Dump creds (pid: %d) failed with %d\n", pid, ret);
 		goto err;
@@ -1631,19 +1631,19 @@ static int dump_one_task(struct pstree_item *item)
 		goto err;
 	}
 
-	ret = dump_task_mm(pid, &pps_buf, &misc, &vmas, cr_fdset);
+	ret = dump_task_mm(pid, &pps_buf, &misc, &vmas, cr_imgset);
 	if (ret) {
 		pr_err("Dump mappings (pid: %d) failed with %d\n", pid, ret);
 		goto err;
 	}
 
-	ret = dump_task_fs(pid, &misc, cr_fdset);
+	ret = dump_task_fs(pid, &misc, cr_imgset);
 	if (ret) {
 		pr_err("Dump fs (pid: %d) failed with %d\n", pid, ret);
 		goto err;
 	}
 
-	close_cr_fdset(&cr_fdset);
+	close_cr_imgset(&cr_imgset);
 err:
 	close_pid_proc();
 	free_mappings(&vmas);
@@ -1651,8 +1651,8 @@ err:
 	return ret;
 
 err_cure:
-	close_cr_fdset(&cr_fdset);
-err_cure_fdset:
+	close_cr_imgset(&cr_imgset);
+err_cure_imgset:
 	parasite_cure_seized(parasite_ctl);
 	goto err;
 }
@@ -1814,8 +1814,8 @@ int cr_dump_tasks(pid_t pid)
 	if (collect_sockets(pid))
 		goto err;
 
-	glob_fdset = cr_glob_fdset_open(O_DUMP);
-	if (!glob_fdset)
+	glob_imgset = cr_glob_imgset_open(O_DUMP);
+	if (!glob_imgset)
 		goto err;
 
 	for_each_pstree_item(item) {
@@ -1864,7 +1864,7 @@ err:
 	if (disconnect_from_page_server())
 		ret = -1;
 
-	close_cr_fdset(&glob_fdset);
+	close_cr_imgset(&glob_imgset);
 
 	cr_plugin_fini(CR_PLUGIN_STAGE__DUMP, ret);
 
diff --git a/cr-show.c b/cr-show.c
index 0e1a2c6..0de92ba 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -14,7 +14,7 @@
 
 #include "asm/types.h"
 #include "list.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "namespaces.h"
 #include "compiler.h"
 #include "cr_options.h"
@@ -403,17 +403,17 @@ out:
 static int cr_show_pstree_item(struct pstree_item *item)
 {
 	int ret = -1, i;
-	struct cr_fdset *cr_fdset = NULL;
+	struct cr_imgset *cr_imgset = NULL;
 	TaskKobjIdsEntry *ids;
 
-	cr_fdset = cr_task_fdset_open(item->pid.virt, O_SHOW);
-	if (!cr_fdset)
+	cr_imgset = cr_task_imgset_open(item->pid.virt, O_SHOW);
+	if (!cr_imgset)
 		goto out;
 
 	pr_msg("Task %d:\n", item->pid.virt);
 	pr_msg("----------------------------------------\n");
 
-	cr_parse_fd(fdset_fd(cr_fdset, CR_FD_CORE), CORE_MAGIC);
+	cr_parse_fd(img_from_set(cr_imgset, CR_FD_CORE), CORE_MAGIC);
 
 	if (item->nr_threads > 1) {
 		int fd_th;
@@ -440,26 +440,26 @@ static int cr_show_pstree_item(struct pstree_item *item)
 	for (i = _CR_FD_TASK_FROM + 1; i < _CR_FD_TASK_TO; i++)
 		if ((i != CR_FD_CORE) && (i != CR_FD_IDS)) {
 			pr_msg("* ");
-			pr_msg(fdset_template[i].fmt, item->pid.virt);
+			pr_msg(imgset_template[i].fmt, item->pid.virt);
 			pr_msg(":\n");
-			cr_parse_fd(fdset_fd(cr_fdset, i), fdset_template[i].magic);
+			cr_parse_fd(img_from_set(cr_imgset, i), imgset_template[i].magic);
 		}
 
 	i = open_image(CR_FD_RLIMIT, O_SHOW | O_OPT, item->pid.virt);
 	if (i >= 0) {
 		pr_msg("* ");
-		pr_msg(fdset_template[CR_FD_RLIMIT].fmt, item->pid.virt);
+		pr_msg(imgset_template[CR_FD_RLIMIT].fmt, item->pid.virt);
 		pr_msg(":\n");
 
 		cr_parse_fd(i, RLIMIT_MAGIC);
 		close(i);
 	}
 
-	if (pb_read_one(fdset_fd(cr_fdset, CR_FD_IDS), &ids, PB_IDS) > 0) {
+	if (pb_read_one(img_from_set(cr_imgset, CR_FD_IDS), &ids, PB_IDS) > 0) {
 		i = open_image(CR_FD_FDINFO, O_SHOW, ids->files_id);
 		if (i >= 0) {
 			pr_msg("* ");
-			pr_msg(fdset_template[CR_FD_FDINFO].fmt, ids->files_id);
+			pr_msg(imgset_template[CR_FD_FDINFO].fmt, ids->files_id);
 			pr_msg(":\n");
 
 			cr_parse_fd(i, FDINFO_MAGIC);
@@ -473,7 +473,7 @@ static int cr_show_pstree_item(struct pstree_item *item)
 
 	ret = 0;
 outc:
-	close_cr_fdset(&cr_fdset);
+	close_cr_imgset(&cr_imgset);
 out:
 	return ret;
 }
diff --git a/eventfd.c b/eventfd.c
index e975eec..21b5c9d 100644
--- a/eventfd.c
+++ b/eventfd.c
@@ -14,7 +14,7 @@
 
 #include "compiler.h"
 #include "asm/types.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "eventfd.h"
 #include "proc_parse.h"
 #include "image.h"
@@ -65,7 +65,7 @@ static int dump_eventfd_entry(union fdinfo_entries *e, void *arg)
 	e->efd.fown = (FownEntry *)&da->p->fown;
 
 	pr_info_eventfd("Dumping ", &e->efd);
-	return pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTFD_FILE),
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_EVENTFD_FILE),
 			&e->efd, PB_EVENTFD_FILE);
 }
 
diff --git a/eventpoll.c b/eventpoll.c
index 12a6f2f..3312938 100644
--- a/eventpoll.c
+++ b/eventpoll.c
@@ -14,7 +14,7 @@
 
 #include "compiler.h"
 #include "asm/types.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "rst_info.h"
 #include "eventpoll.h"
 #include "proc_parse.h"
@@ -99,7 +99,7 @@ static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p)
 	e.n_tfd = ep_list.n;
 
 	pr_info_eventpoll("Dumping ", &e);
-	ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTPOLL_FILE),
+	ret = pb_write_one(img_from_set(glob_imgset, CR_FD_EVENTPOLL_FILE),
 		     &e, PB_EVENTPOLL_FILE);
 out:
 	list_for_each_entry_safe(te, tmp, &ep_list.list, epl.node)
diff --git a/fifo.c b/fifo.c
index ad71088..af85088 100644
--- a/fifo.c
+++ b/fifo.c
@@ -4,7 +4,7 @@
 #include <fcntl.h>
 #include <stdlib.h>
 
-#include "fdset.h"
+#include "imgset.h"
 #include "image.h"
 #include "files.h"
 #include "files-reg.h"
@@ -41,7 +41,7 @@ static struct pipe_data_dump pd_fifo = { .img_type = CR_FD_FIFO_DATA, };
 
 static int dump_one_fifo(int lfd, u32 id, const struct fd_parms *p)
 {
-	int img = fdset_fd(glob_fdset, CR_FD_FIFO);
+	int img = img_from_set(glob_imgset, CR_FD_FIFO);
 	FifoEntry e = FIFO_ENTRY__INIT;
 
 	/*
diff --git a/file-lock.c b/file-lock.c
index b351f86..5fff77b 100644
--- a/file-lock.c
+++ b/file-lock.c
@@ -7,7 +7,7 @@
 #include <sys/stat.h>
 
 #include "cr_options.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "files.h"
 #include "fs-magic.h"
 #include "image.h"
@@ -74,7 +74,7 @@ static int dump_one_file_lock(FileLockEntry *fle)
 	pr_info("LOCK flag: %d,type: %d,pid: %d,fd: %d,start: %8"PRIx64",len: %8"PRIx64"\n",
 		fle->flag, fle->type, fle->pid,	fle->fd, fle->start, fle->len);
 
-	return pb_write_one(fdset_fd(glob_fdset, CR_FD_FILE_LOCKS),
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_FILE_LOCKS),
 			fle, PB_FILE_LOCK);
 }
 
diff --git a/files-ext.c b/files-ext.c
index a5ca594..e0b30e4 100644
--- a/files-ext.c
+++ b/files-ext.c
@@ -2,7 +2,7 @@
 
 #include <unistd.h>
 
-#include "fdset.h"
+#include "imgset.h"
 #include "files.h"
 #include "plugin.h"
 
@@ -22,7 +22,7 @@ static int dump_one_ext_file(int lfd, u32 id, const struct fd_parms *p)
 	xfe.id		= id;
 	xfe.fown	= (FownEntry *)&p->fown;
 
-	rfd = fdset_fd(glob_fdset, CR_FD_EXT_FILES);
+	rfd = img_from_set(glob_imgset, CR_FD_EXT_FILES);
 
 	return pb_write_one(rfd, &xfe, PB_EXT_FILE);
 }
diff --git a/files-reg.c b/files-reg.c
index 84121f1..0d9d76e 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -13,7 +13,7 @@
 #define SILLYNAME_SUFF_LEN (((unsigned)sizeof(u64) << 1) + ((unsigned)sizeof(unsigned int) << 1))
 
 #include "cr_options.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "file-ids.h"
 #include "mount.h"
 #include "files.h"
@@ -432,7 +432,7 @@ dump_entry:
 	rpe.has_remap_type = true;
 	rpe.remap_type = REMAP_TYPE__GHOST;
 
-	return pb_write_one(fdset_fd(glob_fdset, CR_FD_REMAP_FPATH),
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_REMAP_FPATH),
 			&rpe, PB_REMAP_FPATH);
 }
 
@@ -525,7 +525,7 @@ static int create_link_remap(char *path, int len, int lfd,
 	rlb->mnt_ns = nsid;
 	list_add(&rlb->list, &link_remaps);
 
-	return pb_write_one(fdset_fd(glob_fdset, CR_FD_REG_FILES), &rfe, PB_REG_FILE);
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_REG_FILES), &rfe, PB_REG_FILE);
 
 err2:
 	xfree(rlb);
@@ -546,7 +546,7 @@ static int dump_linked_remap(char *path, int len, const struct stat *ost,
 	rpe.orig_id = id;
 	rpe.remap_id = lid;
 
-	return pb_write_one(fdset_fd(glob_fdset, CR_FD_REMAP_FPATH),
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_REMAP_FPATH),
 			&rpe, PB_REMAP_FPATH);
 }
 
@@ -599,7 +599,7 @@ static int dump_dead_process_remap(pid_t pid, char *path, int len, const struct
 	rpe.has_remap_type = true;
 	rpe.remap_type = REMAP_TYPE__PROCFS;
 
-	return pb_write_one(fdset_fd(glob_fdset, CR_FD_REMAP_FPATH),
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_REMAP_FPATH),
 			&rpe, PB_REMAP_FPATH);
 }
 
@@ -799,7 +799,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
 		rfe.size = p->stat.st_size;
 	}
 
-	rfd = fdset_fd(glob_fdset, CR_FD_REG_FILES);
+	rfd = img_from_set(glob_imgset, CR_FD_REG_FILES);
 
 	return pb_write_one(rfd, &rfe, PB_REG_FILE);
 }
diff --git a/files.c b/files.c
index 39d9914..3e934c8 100644
--- a/files.c
+++ b/files.c
@@ -34,7 +34,7 @@
 #include "namespaces.h"
 #include "tun.h"
 #include "timerfd.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "fs-magic.h"
 #include "proc_parse.h"
 
diff --git a/fsnotify.c b/fsnotify.c
index ea58e8a..985edcf 100644
--- a/fsnotify.c
+++ b/fsnotify.c
@@ -24,7 +24,7 @@
 
 #include "compiler.h"
 #include "asm/types.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "fsnotify.h"
 #include "proc_parse.h"
 #include "syscall.h"
@@ -256,7 +256,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p)
 	ie.n_wd = wd_list.n;
 
 	pr_info("id 0x%08x flags 0x%08x\n", ie.id, ie.flags);
-	if (pb_write_one(fdset_fd(glob_fdset, CR_FD_INOTIFY_FILE), &ie, PB_INOTIFY_FILE))
+	if (pb_write_one(img_from_set(glob_imgset, CR_FD_INOTIFY_FILE), &ie, PB_INOTIFY_FILE))
 		goto free;
 
 	exit_code = 0;
@@ -372,7 +372,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
 	fe.faflags = wd_list.fsn_params.faflags;
 	fe.evflags = wd_list.fsn_params.evflags;
 
-	ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_FANOTIFY_FILE), &fe, PB_FANOTIFY_FILE);
+	ret = pb_write_one(img_from_set(glob_imgset, CR_FD_FANOTIFY_FILE), &fe, PB_FANOTIFY_FILE);
 free:
 	xfree(fe.mark);
 	list_for_each_entry_safe(we, tmp, &wd_list.list, ify.node)
diff --git a/image-desc.c b/image-desc.c
index 616cbe9..3ce7ab5 100644
--- a/image-desc.c
+++ b/image-desc.c
@@ -17,7 +17,7 @@
 		.magic	= _name##_MAGIC,	\
 	}
 
-struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = {
+struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX] = {
 	FD_ENTRY(INVENTORY,	"inventory"),
 	FD_ENTRY(FDINFO,	"fdinfo-%d"),
 	FD_ENTRY(PAGEMAP,	"pagemap-%ld"),
diff --git a/image.c b/image.c
index 66f1513..b9a8e4a 100644
--- a/image.c
+++ b/image.c
@@ -3,7 +3,7 @@
 #include <fcntl.h>
 #include "crtools.h"
 #include "cr_options.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "image.h"
 #include "pstree.h"
 #include "stats.h"
@@ -104,70 +104,70 @@ int write_img_inventory(void)
 void kill_inventory(void)
 {
 	unlinkat(get_service_fd(IMG_FD_OFF),
-			fdset_template[CR_FD_INVENTORY].fmt, 0);
+			imgset_template[CR_FD_INVENTORY].fmt, 0);
 }
 
-static struct cr_fdset *alloc_cr_fdset(int nr)
+static struct cr_imgset *alloc_cr_imgset(int nr)
 {
-	struct cr_fdset *cr_fdset;
+	struct cr_imgset *cr_imgset;
 	unsigned int i;
 
-	cr_fdset = xmalloc(sizeof(*cr_fdset));
-	if (cr_fdset == NULL)
+	cr_imgset = xmalloc(sizeof(*cr_imgset));
+	if (cr_imgset == NULL)
 		return NULL;
 
-	cr_fdset->_fds = xmalloc(nr * sizeof(int));
-	if (cr_fdset->_fds == NULL) {
-		xfree(cr_fdset);
+	cr_imgset->_imgs = xmalloc(nr * sizeof(int));
+	if (cr_imgset->_imgs == NULL) {
+		xfree(cr_imgset);
 		return NULL;
 	}
 
 	for (i = 0; i < nr; i++)
-		cr_fdset->_fds[i] = -1;
-	cr_fdset->fd_nr = nr;
-	return cr_fdset;
+		cr_imgset->_imgs[i] = -1;
+	cr_imgset->fd_nr = nr;
+	return cr_imgset;
 }
 
-static void __close_cr_fdset(struct cr_fdset *cr_fdset)
+static void __close_cr_imgset(struct cr_imgset *cr_imgset)
 {
 	unsigned int i;
 
-	if (!cr_fdset)
+	if (!cr_imgset)
 		return;
 
-	for (i = 0; i < cr_fdset->fd_nr; i++) {
-		if (cr_fdset->_fds[i] == -1)
+	for (i = 0; i < cr_imgset->fd_nr; i++) {
+		if (cr_imgset->_imgs[i] == -1)
 			continue;
-		close_safe(&cr_fdset->_fds[i]);
-		cr_fdset->_fds[i] = -1;
+		close_safe(&cr_imgset->_imgs[i]);
+		cr_imgset->_imgs[i] = -1;
 	}
 }
 
-void close_cr_fdset(struct cr_fdset **cr_fdset)
+void close_cr_imgset(struct cr_imgset **cr_imgset)
 {
-	if (!cr_fdset || !*cr_fdset)
+	if (!cr_imgset || !*cr_imgset)
 		return;
 
-	__close_cr_fdset(*cr_fdset);
+	__close_cr_imgset(*cr_imgset);
 
-	xfree((*cr_fdset)->_fds);
-	xfree(*cr_fdset);
-	*cr_fdset = NULL;
+	xfree((*cr_imgset)->_imgs);
+	xfree(*cr_imgset);
+	*cr_imgset = NULL;
 }
 
-struct cr_fdset *cr_fdset_open_range(int pid, int from, int to,
+struct cr_imgset *cr_imgset_open_range(int pid, int from, int to,
 			       unsigned long flags)
 {
-	struct cr_fdset *fdset;
+	struct cr_imgset *imgset;
 	unsigned int i;
 	int ret = -1;
 
-	fdset = alloc_cr_fdset(to - from);
-	if (!fdset)
+	imgset = alloc_cr_imgset(to - from);
+	if (!imgset)
 		goto err;
 
 	from++;
-	fdset->fd_off = from;
+	imgset->fd_off = from;
 	for (i = from; i < to; i++) {
 		ret = open_image(i, flags, pid);
 		if (ret < 0) {
@@ -177,24 +177,24 @@ struct cr_fdset *cr_fdset_open_range(int pid, int from, int to,
 			goto err;
 		}
 
-		fdset->_fds[i - from] = ret;
+		imgset->_imgs[i - from] = ret;
 	}
 
-	return fdset;
+	return imgset;
 
 err:
-	close_cr_fdset(&fdset);
+	close_cr_imgset(&imgset);
 	return NULL;
 }
 
-struct cr_fdset *cr_task_fdset_open(int pid, int mode)
+struct cr_imgset *cr_task_imgset_open(int pid, int mode)
 {
-	return cr_fdset_open(pid, TASK, mode);
+	return cr_imgset_open(pid, TASK, mode);
 }
 
-struct cr_fdset *cr_glob_fdset_open(int mode)
+struct cr_imgset *cr_glob_imgset_open(int mode)
 {
-	return cr_fdset_open(-1 /* ignored */, GLOB, mode);
+	return cr_imgset_open(-1 /* ignored */, GLOB, mode);
 }
 
 int open_image_at(int dfd, int type, unsigned long flags, ...)
@@ -207,7 +207,7 @@ int open_image_at(int dfd, int type, unsigned long flags, ...)
 	flags &= ~O_OPT;
 
 	va_start(args, flags);
-	vsnprintf(path, PATH_MAX, fdset_template[type].fmt, args);
+	vsnprintf(path, PATH_MAX, imgset_template[type].fmt, args);
 	va_end(args);
 
 	ret = openat(dfd, path, flags, CR_FD_PERM);
@@ -218,7 +218,7 @@ int open_image_at(int dfd, int type, unsigned long flags, ...)
 		goto err;
 	}
 
-	if (fdset_template[type].magic == RAW_IMAGE_MAGIC)
+	if (imgset_template[type].magic == RAW_IMAGE_MAGIC)
 		goto skip_magic;
 
 	if (flags == O_RDONLY) {
@@ -226,12 +226,12 @@ int open_image_at(int dfd, int type, unsigned long flags, ...)
 
 		if (read_img(ret, &magic) < 0)
 			goto err;
-		if (magic != fdset_template[type].magic) {
+		if (magic != imgset_template[type].magic) {
 			pr_err("Magic doesn't match for %s\n", path);
 			goto err;
 		}
 	} else {
-		if (write_img(ret, &fdset_template[type].magic))
+		if (write_img(ret, &imgset_template[type].magic))
 			goto err;
 	}
 
diff --git a/include/fdset.h b/include/fdset.h
deleted file mode 100644
index ad62d5e..0000000
--- a/include/fdset.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef __CR_FDSET_H__
-#define __CR_FDSET_H__
-
-#include "image-desc.h"
-#include "bug.h"
-
-struct cr_fdset {
-	int fd_off;
-	int fd_nr;
-	int *_fds;
-};
-
-static inline int fdset_fd(const struct cr_fdset *fdset, int type)
-{
-	int idx;
-
-	idx = type - fdset->fd_off;
-	BUG_ON(idx > fdset->fd_nr);
-
-	return fdset->_fds[idx];
-}
-
-extern struct cr_fdset *glob_fdset;
-
-extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
-
-extern struct cr_fdset *cr_task_fdset_open(int pid, int mode);
-extern struct cr_fdset *cr_fdset_open_range(int pid, int from, int to,
-					    unsigned long flags);
-#define cr_fdset_open(pid, type, flags) cr_fdset_open_range(pid, \
-		_CR_FD_##type##_FROM, _CR_FD_##type##_TO, flags)
-extern struct cr_fdset *cr_glob_fdset_open(int mode);
-
-extern void close_cr_fdset(struct cr_fdset **cr_fdset);
-
-#endif /* __CR_FDSET_H__ */
diff --git a/include/fifo.h b/include/fifo.h
index 1824346..7762654 100644
--- a/include/fifo.h
+++ b/include/fifo.h
@@ -2,7 +2,7 @@
 #define __CR_FIFO_H__
 
 struct fd_parms;
-struct cr_fdset;
+struct cr_imgset;
 
 extern const struct fdtype_ops fifo_dump_ops;
 extern struct collect_image_info fifo_cinfo;
diff --git a/include/files-reg.h b/include/files-reg.h
index bc5f5a7..d10f6ca 100644
--- a/include/files-reg.h
+++ b/include/files-reg.h
@@ -8,7 +8,7 @@
 #include "protobuf/regfile.pb-c.h"
 #include "protobuf/ghost-file.pb-c.h"
 
-struct cr_fdset;
+struct cr_imgset;
 struct fd_parms;
 
 struct file_remap {
diff --git a/include/files.h b/include/files.h
index 950b341..012a0ec 100644
--- a/include/files.h
+++ b/include/files.h
@@ -16,7 +16,7 @@
 
 struct pstree_item;
 struct file_desc;
-struct cr_fdset;
+struct cr_imgset;
 struct rst_info;
 struct parasite_ctl;
 
diff --git a/include/image-desc.h b/include/image-desc.h
index 9cfca29..2ad03df 100644
--- a/include/image-desc.h
+++ b/include/image-desc.h
@@ -103,6 +103,6 @@ struct cr_fd_desc_tmpl {
 	u32		magic;			/* magic in the header */
 };
 
-extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
+extern struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX];
 
 #endif /* __CR_IMAGE_DESC_H__ */
diff --git a/include/imgset.h b/include/imgset.h
new file mode 100644
index 0000000..13c6168
--- /dev/null
+++ b/include/imgset.h
@@ -0,0 +1,36 @@
+#ifndef __CR_IMGSET_H__
+#define __CR_IMGSET_H__
+
+#include "image-desc.h"
+#include "bug.h"
+
+struct cr_imgset {
+	int fd_off;
+	int fd_nr;
+	int *_imgs;
+};
+
+static inline int img_from_set(const struct cr_imgset *imgset, int type)
+{
+	int idx;
+
+	idx = type - imgset->fd_off;
+	BUG_ON(idx > imgset->fd_nr);
+
+	return imgset->_imgs[idx];
+}
+
+extern struct cr_imgset *glob_imgset;
+
+extern struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX];
+
+extern struct cr_imgset *cr_task_imgset_open(int pid, int mode);
+extern struct cr_imgset *cr_imgset_open_range(int pid, int from, int to,
+					    unsigned long flags);
+#define cr_imgset_open(pid, type, flags) cr_imgset_open_range(pid, \
+		_CR_FD_##type##_FROM, _CR_FD_##type##_TO, flags)
+extern struct cr_imgset *cr_glob_imgset_open(int mode);
+
+extern void close_cr_imgset(struct cr_imgset **cr_imgset);
+
+#endif /* __CR_IMGSET_H__ */
diff --git a/include/mount.h b/include/mount.h
index e8989e7..f3d31e6 100644
--- a/include/mount.h
+++ b/include/mount.h
@@ -14,7 +14,7 @@ struct proc_mountinfo;
 extern int open_mount(unsigned int s_dev);
 extern struct fstype *find_fstype_by_name(char *fst);
 
-struct cr_fdset;
+struct cr_imgset;
 extern struct mount_info * collect_mntinfo(struct ns_id *ns);
 extern int prepare_mnt_ns(void);
 
diff --git a/include/net.h b/include/net.h
index a9f0d46..be9d81e 100644
--- a/include/net.h
+++ b/include/net.h
@@ -3,7 +3,7 @@
 
 #include "list.h"
 
-struct cr_fdset;
+struct cr_imgset;
 extern int dump_net_ns(int pid, int ns_id);
 extern int prepare_net_ns(int pid);
 extern int netns_pre_create(void);
@@ -20,7 +20,7 @@ extern void network_unlock(void);
 extern struct ns_desc net_ns_desc;
 
 #include "protobuf/netdev.pb-c.h"
-extern int write_netdev_img(NetDeviceEntry *nde, struct cr_fdset *fds);
+extern int write_netdev_img(NetDeviceEntry *nde, struct cr_imgset *fds);
 extern int read_ns_sys_file(char *path, char *buf, int len);
 extern int restore_link_parms(NetDeviceEntry *nde, int nlsk);
 
diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
index 62d0ba4..67840fc 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -16,7 +16,7 @@ struct pstree_item;
 struct _CredsEntry;
 struct _CoreEntry;
 struct list_head;
-struct cr_fdset;
+struct cr_imgset;
 struct fd_opts;
 struct pid;
 
@@ -57,7 +57,7 @@ struct parasite_ctl {
 	struct page_pipe	*mem_pp;
 };
 
-extern int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_fdset);
+extern int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_imgset *cr_imgset);
 extern int parasite_dump_itimers_seized(struct parasite_ctl *ctl, struct pstree_item *);
 
 struct proc_posix_timers_stat;
diff --git a/include/signalfd.h b/include/signalfd.h
index a29b9be..c7af819 100644
--- a/include/signalfd.h
+++ b/include/signalfd.h
@@ -1,7 +1,7 @@
 #ifndef __CR_SIGNALFD_H__
 #define __CR_SIGNALFD_H__
 
-struct cr_fdset;
+struct cr_imgset;
 struct fd_parms;
 extern int is_signalfd_link(char *link);
 extern const struct fdtype_ops signalfd_dump_ops;
diff --git a/include/sk-packet.h b/include/sk-packet.h
index 607e7a9..6c4398c 100644
--- a/include/sk-packet.h
+++ b/include/sk-packet.h
@@ -5,7 +5,7 @@
 #define PACKET_TIMESTAMP	17
 #endif
 
-struct cr_fdset;
+struct cr_imgset;
 struct fd_parms;
 struct vma_area;
 
diff --git a/include/sockets.h b/include/sockets.h
index 34ae0ac..34fb167 100644
--- a/include/sockets.h
+++ b/include/sockets.h
@@ -12,7 +12,7 @@ struct fdinfo_list_entry;
 struct sk_opts_entry;
 struct file_desc;
 struct fd_parms;
-struct cr_fdset;
+struct cr_imgset;
 struct nlmsghdr;
 
 struct socket_desc {
diff --git a/include/tun.h b/include/tun.h
index 9495435..5dbabec 100644
--- a/include/tun.h
+++ b/include/tun.h
@@ -8,7 +8,7 @@
 #include "protobuf/netdev.pb-c.h"
 
 extern const struct fdtype_ops tunfile_dump_ops;
-extern int dump_tun_link(NetDeviceEntry *nde, struct cr_fdset *fds);
+extern int dump_tun_link(NetDeviceEntry *nde, struct cr_imgset *fds);
 extern int restore_one_tun(NetDeviceEntry *nde, int nlsk);
 extern struct collect_image_info tunfile_cinfo;
 extern int check_tun(void);
diff --git a/ipc_ns.c b/ipc_ns.c
index 7dc4cbd..7ad04a4 100644
--- a/ipc_ns.c
+++ b/ipc_ns.c
@@ -9,7 +9,7 @@
 
 #include "util.h"
 #include "cr_options.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "syscall.h"
 #include "namespaces.h"
 #include "sysctl.h"
@@ -437,20 +437,20 @@ err:
 	return ret;
 }
 
-static int dump_ipc_data(const struct cr_fdset *fdset)
+static int dump_ipc_data(const struct cr_imgset *imgset)
 {
 	int ret;
 
-	ret = dump_ipc_var(fdset_fd(fdset, CR_FD_IPC_VAR));
+	ret = dump_ipc_var(img_from_set(imgset, CR_FD_IPC_VAR));
 	if (ret < 0)
 		return ret;
-	ret = dump_ipc_shm(fdset_fd(fdset, CR_FD_IPCNS_SHM));
+	ret = dump_ipc_shm(img_from_set(imgset, CR_FD_IPCNS_SHM));
 	if (ret < 0)
 		return ret;
-	ret = dump_ipc_msg(fdset_fd(fdset, CR_FD_IPCNS_MSG));
+	ret = dump_ipc_msg(img_from_set(imgset, CR_FD_IPCNS_MSG));
 	if (ret < 0)
 		return ret;
-	ret = dump_ipc_sem(fdset_fd(fdset, CR_FD_IPCNS_SEM));
+	ret = dump_ipc_sem(img_from_set(imgset, CR_FD_IPCNS_SEM));
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -459,24 +459,24 @@ static int dump_ipc_data(const struct cr_fdset *fdset)
 int dump_ipc_ns(int ns_pid, int ns_id)
 {
 	int ret;
-	struct cr_fdset *fdset;
+	struct cr_imgset *imgset;
 
-	fdset = cr_fdset_open(ns_id, IPCNS, O_DUMP);
-	if (fdset == NULL)
+	imgset = cr_imgset_open(ns_id, IPCNS, O_DUMP);
+	if (imgset == NULL)
 		return -1;
 
 	ret = switch_ns(ns_pid, &ipc_ns_desc, NULL);
 	if (ret < 0)
 		goto err;
 
-	ret = dump_ipc_data(fdset);
+	ret = dump_ipc_data(imgset);
 	if (ret < 0) {
 		pr_err("Failed to write IPC namespace data\n");
 		goto err;
 	}
 
 err:
-	close_cr_fdset(&fdset);
+	close_cr_imgset(&imgset);
 	return ret < 0 ? -1 : 0;
 }
 
diff --git a/namespaces.c b/namespaces.c
index 22809b9..5d3ff99 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -4,7 +4,7 @@
 #include <stdlib.h>
 #include "cr-show.h"
 #include "util.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "syscall.h"
 #include "uts_ns.h"
 #include "ipc_ns.h"
@@ -239,7 +239,7 @@ static unsigned int get_ns_id(int pid, struct ns_desc *nd)
 
 int dump_one_ns_file(int lfd, u32 id, const struct fd_parms *p)
 {
-	int fd = fdset_fd(glob_fdset, CR_FD_NS_FILES);
+	int fd = img_from_set(glob_imgset, CR_FD_NS_FILES);
 	NsFileEntry nfe = NS_FILE_ENTRY__INIT;
 	struct fd_link *link = p->link;
 	unsigned int nsid;
@@ -556,7 +556,7 @@ int prepare_namespace(struct pstree_item *item, unsigned long clone_flags)
 
 int try_show_namespaces(int ns_pid)
 {
-	struct cr_fdset *fdset;
+	struct cr_imgset *imgset;
 	int i, fd, ret;
 	TaskKobjIdsEntry *ids;
 
@@ -570,45 +570,45 @@ int try_show_namespaces(int ns_pid)
 	if (ret < 0)
 		return -1;
 
-	fdset = cr_fdset_open(ids->net_ns_id, NETNS, O_SHOW);
-	if (fdset) {
+	imgset = cr_imgset_open(ids->net_ns_id, NETNS, O_SHOW);
+	if (imgset) {
 		pr_msg("-------------------NETNS---------------------\n");
 		for (i = _CR_FD_NETNS_FROM + 1; i < _CR_FD_NETNS_TO; i++) {
 			int fd;
 
-			fd = fdset_fd(fdset, i);
+			fd = img_from_set(imgset, i);
 			if (fd == -1)
 				continue;
 
-			cr_parse_fd(fd, fdset_template[i].magic);
+			cr_parse_fd(fd, imgset_template[i].magic);
 		}
-		close_cr_fdset(&fdset);
+		close_cr_imgset(&imgset);
 	}
 
-	fdset = cr_fdset_open(ids->ipc_ns_id, IPCNS, O_SHOW);
-	if (fdset) {
+	imgset = cr_imgset_open(ids->ipc_ns_id, IPCNS, O_SHOW);
+	if (imgset) {
 		pr_msg("-------------------IPCNS---------------------\n");
 		for (i = _CR_FD_IPCNS_FROM + 1; i < _CR_FD_IPCNS_TO; i++) {
-			fd = fdset_fd(fdset, i);
+			fd = img_from_set(imgset, i);
 			if (fd == -1)
 				continue;
 
-			cr_parse_fd(fd, fdset_template[i].magic);
+			cr_parse_fd(fd, imgset_template[i].magic);
 		}
-		close_cr_fdset(&fdset);
+		close_cr_imgset(&imgset);
 	}
 
 	fd = open_image(CR_FD_UTSNS, O_SHOW, ids->uts_ns_id);
 	if (fd >= 0) {
 		pr_msg("-------------------UTSNS---------------------\n");
-		cr_parse_fd(fd, fdset_template[CR_FD_UTSNS].magic);
+		cr_parse_fd(fd, imgset_template[CR_FD_UTSNS].magic);
 		close(fd);
 	}
 
 	fd = open_image(CR_FD_MNTS, O_SHOW, ids->mnt_ns_id);
 	if (fd > 0) {
 		pr_msg("-------------------MNTNS---------------------\n");
-		cr_parse_fd(fd, fdset_template[CR_FD_MNTS].magic);
+		cr_parse_fd(fd, imgset_template[CR_FD_MNTS].magic);
 		close(fd);
 	}
 
diff --git a/net.c b/net.c
index 543f24c..d0010d8 100644
--- a/net.c
+++ b/net.c
@@ -8,7 +8,7 @@
 #include <sched.h>
 #include <sys/mount.h>
 
-#include "fdset.h"
+#include "imgset.h"
 #include "syscall-types.h"
 #include "namespaces.h"
 #include "net.h"
@@ -47,14 +47,14 @@ int read_ns_sys_file(char *path, char *buf, int len)
 	return rlen;
 }
 
-int write_netdev_img(NetDeviceEntry *nde, struct cr_fdset *fds)
+int write_netdev_img(NetDeviceEntry *nde, struct cr_imgset *fds)
 {
-	return pb_write_one(fdset_fd(fds, CR_FD_NETDEV), nde, PB_NETDEV);
+	return pb_write_one(img_from_set(fds, CR_FD_NETDEV), nde, PB_NETDEV);
 }
 
 static int dump_one_netdev(int type, struct ifinfomsg *ifi,
-		struct rtattr **tb, struct cr_fdset *fds,
-		int (*dump)(NetDeviceEntry *, struct cr_fdset *))
+		struct rtattr **tb, struct cr_imgset *fds,
+		int (*dump)(NetDeviceEntry *, struct cr_imgset *))
 {
 	NetDeviceEntry netdev = NET_DEVICE_ENTRY__INIT;
 
@@ -103,7 +103,7 @@ static char *link_kind(struct ifinfomsg *ifi, struct rtattr **tb)
 }
 
 static int dump_unknown_device(struct ifinfomsg *ifi, char *kind,
-		struct rtattr **tb, struct cr_fdset *fds)
+		struct rtattr **tb, struct cr_imgset *fds)
 {
 	int ret;
 
@@ -118,7 +118,7 @@ static int dump_unknown_device(struct ifinfomsg *ifi, char *kind,
 }
 
 static int dump_one_ethernet(struct ifinfomsg *ifi, char *kind,
-		struct rtattr **tb, struct cr_fdset *fds)
+		struct rtattr **tb, struct cr_imgset *fds)
 {
 	if (!strcmp(kind, "veth"))
 		/*
@@ -137,7 +137,7 @@ static int dump_one_ethernet(struct ifinfomsg *ifi, char *kind,
 }
 
 static int dump_one_gendev(struct ifinfomsg *ifi, char *kind,
-		struct rtattr **tb, struct cr_fdset *fds)
+		struct rtattr **tb, struct cr_imgset *fds)
 {
 	if (!strcmp(kind, "tun"))
 		return dump_one_netdev(ND_TYPE__TUN, ifi, tb, fds, dump_tun_link);
@@ -146,7 +146,7 @@ static int dump_one_gendev(struct ifinfomsg *ifi, char *kind,
 }
 
 static int dump_one_voiddev(struct ifinfomsg *ifi, char *kind,
-		struct rtattr **tb, struct cr_fdset *fds)
+		struct rtattr **tb, struct cr_imgset *fds)
 {
 	if (!strcmp(kind, "venet"))
 		/*
@@ -161,7 +161,7 @@ static int dump_one_voiddev(struct ifinfomsg *ifi, char *kind,
 
 static int dump_one_link(struct nlmsghdr *hdr, void *arg)
 {
-	struct cr_fdset *fds = arg;
+	struct cr_imgset *fds = arg;
 	struct ifinfomsg *ifi;
 	int ret = 0, len = hdr->nlmsg_len - NLMSG_LENGTH(sizeof(*ifi));
 	struct rtattr *tb[IFLA_MAX + 1];
@@ -203,7 +203,7 @@ unk:
 	return ret;
 }
 
-static int dump_links(struct cr_fdset *fds)
+static int dump_links(struct cr_imgset *fds)
 {
 	int sk, ret;
 	struct {
@@ -436,19 +436,19 @@ static int run_iptables_tool(char *def_cmd, int fdin, int fdout)
 	return ret;
 }
 
-static inline int dump_ifaddr(struct cr_fdset *fds)
+static inline int dump_ifaddr(struct cr_imgset *fds)
 {
-	return run_ip_tool("addr", "save", -1, fdset_fd(fds, CR_FD_IFADDR));
+	return run_ip_tool("addr", "save", -1, img_from_set(fds, CR_FD_IFADDR));
 }
 
-static inline int dump_route(struct cr_fdset *fds)
+static inline int dump_route(struct cr_imgset *fds)
 {
-	return run_ip_tool("route", "save", -1, fdset_fd(fds, CR_FD_ROUTE));
+	return run_ip_tool("route", "save", -1, img_from_set(fds, CR_FD_ROUTE));
 }
 
-static inline int dump_iptables(struct cr_fdset *fds)
+static inline int dump_iptables(struct cr_imgset *fds)
 {
-	return run_iptables_tool("iptables-save", -1, fdset_fd(fds, CR_FD_IPTABLES));
+	return run_iptables_tool("iptables-save", -1, img_from_set(fds, CR_FD_IPTABLES));
 }
 
 static int restore_ip_dump(int type, int pid, char *cmd)
@@ -529,10 +529,10 @@ static int mount_ns_sysfs(void)
 
 int dump_net_ns(int pid, int ns_id)
 {
-	struct cr_fdset *fds;
+	struct cr_imgset *fds;
 	int ret;
 
-	fds = cr_fdset_open(ns_id, NETNS, O_DUMP);
+	fds = cr_imgset_open(ns_id, NETNS, O_DUMP);
 	if (fds == NULL)
 		return -1;
 
@@ -551,7 +551,7 @@ int dump_net_ns(int pid, int ns_id)
 	close(ns_sysfs_fd);
 	ns_sysfs_fd = -1;
 
-	close_cr_fdset(&fds);
+	close_cr_imgset(&fds);
 	return ret;
 }
 
diff --git a/parasite-syscall.c b/parasite-syscall.c
index db92c6b..ca4a913 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -12,7 +12,7 @@
 #include "protobuf/core.pb-c.h"
 #include "protobuf/pagemap.pb-c.h"
 
-#include "fdset.h"
+#include "imgset.h"
 #include "syscall.h"
 #include "ptrace.h"
 #include "asm/processor-flags.h"
@@ -573,7 +573,7 @@ int parasite_dump_thread_seized(struct parasite_ctl *ctl, int id,
 	return dump_thread_core(pid, core, args);
 }
 
-int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_fdset)
+int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_imgset *cr_imgset)
 {
 	struct parasite_dump_sa_args *args;
 	int ret, sig, fd;
@@ -585,7 +585,7 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f
 	if (ret < 0)
 		return ret;
 
-	fd = fdset_fd(cr_fdset, CR_FD_SIGACT);
+	fd = img_from_set(cr_imgset, CR_FD_SIGACT);
 
 	for (sig = 1; sig <= SIGMAX; sig++) {
 		int i = sig - 1;
diff --git a/pipes.c b/pipes.c
index ef260aa..51b95da 100644
--- a/pipes.c
+++ b/pipes.c
@@ -5,7 +5,7 @@
 #include <stdlib.h>
 #include <sys/mman.h>
 
-#include "fdset.h"
+#include "imgset.h"
 #include "image.h"
 #include "files.h"
 #include "pipes.h"
@@ -425,7 +425,7 @@ int dump_one_pipe_data(struct pipe_data_dump *pd, int lfd, const struct fd_parms
 		return -1;
 	}
 
-	img = fdset_fd(glob_fdset, pd->img_type);
+	img = img_from_set(glob_imgset, pd->img_type);
 	pd->ids[pd->nr++] = pipe_id(p);
 
 	pipe_size = fcntl(lfd, F_GETPIPE_SZ);
@@ -499,7 +499,7 @@ static int dump_one_pipe(int lfd, u32 id, const struct fd_parms *p)
 	pe.flags	= p->flags;
 	pe.fown		= (FownEntry *)&p->fown;
 
-	if (pb_write_one(fdset_fd(glob_fdset, CR_FD_PIPES), &pe, PB_PIPE))
+	if (pb_write_one(img_from_set(glob_imgset, CR_FD_PIPES), &pe, PB_PIPE))
 		return -1;
 
 	return dump_one_pipe_data(&pd_pipes, lfd, p);
diff --git a/signalfd.c b/signalfd.c
index ba7f5f6..8281c72 100644
--- a/signalfd.c
+++ b/signalfd.c
@@ -6,7 +6,7 @@
 #include "asm/types.h"
 #include "signalfd.h"
 #include "proc_parse.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "image.h"
 #include "util.h"
 #include "log.h"
@@ -45,7 +45,7 @@ static int dump_signalfd_entry(union fdinfo_entries *e, void *arg)
 	e->sfd.flags = da->p->flags;
 	e->sfd.fown = (FownEntry *)&da->p->fown;
 
-	return pb_write_one(fdset_fd(glob_fdset, CR_FD_SIGNALFD),
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_SIGNALFD),
 			&e->sfd, PB_SIGNALFD);
 }
 
diff --git a/sk-inet.c b/sk-inet.c
index a94cd41..e38f1bf 100644
--- a/sk-inet.c
+++ b/sk-inet.c
@@ -12,7 +12,7 @@
 #include "asm/types.h"
 #include "libnetlink.h"
 #include "cr_options.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "inet_diag.h"
 #include "files.h"
 #include "image.h"
@@ -291,7 +291,7 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
 	if (dump_socket_opts(lfd, &skopts))
 		goto err;
 
-	if (pb_write_one(fdset_fd(glob_fdset, CR_FD_INETSK), &ie, PB_INET_SK))
+	if (pb_write_one(img_from_set(glob_imgset, CR_FD_INETSK), &ie, PB_INET_SK))
 		goto err;
 
 	pr_info("Dumping inet socket at %d\n", p->fd);
diff --git a/sk-netlink.c b/sk-netlink.c
index 93fd8d1..ecbff8c 100644
--- a/sk-netlink.c
+++ b/sk-netlink.c
@@ -2,7 +2,7 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
-#include "fdset.h"
+#include "imgset.h"
 #include "files.h"
 #include "sockets.h"
 #include "util.h"
@@ -137,7 +137,7 @@ static int dump_one_netlink_fd(int lfd, u32 id, const struct fd_parms *p)
 	if (dump_socket_opts(lfd, &skopts))
 		goto err;
 
-	if (pb_write_one(fdset_fd(glob_fdset, CR_FD_NETLINK_SK), &ne, PB_NETLINK_SK))
+	if (pb_write_one(img_from_set(glob_imgset, CR_FD_NETLINK_SK), &ne, PB_NETLINK_SK))
 		goto err;
 
 	return 0;
diff --git a/sk-packet.c b/sk-packet.c
index 410da8f..d4ca77d 100644
--- a/sk-packet.c
+++ b/sk-packet.c
@@ -5,7 +5,7 @@
 #include <unistd.h>
 #include <string.h>
 #include "asm/types.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "files.h"
 #include "sockets.h"
 #include "libnetlink.h"
@@ -190,7 +190,7 @@ static int dump_one_packet_fd(int lfd, u32 id, const struct fd_parms *p)
 	if (ret)
 		goto out;
 
-	ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_PACKETSK), &psk, PB_PACKET_SOCK);
+	ret = pb_write_one(img_from_set(glob_imgset, CR_FD_PACKETSK), &psk, PB_PACKET_SOCK);
 out:
 	release_skopts(&skopts);
 	xfree(psk.rx_ring);
diff --git a/sk-queue.c b/sk-queue.c
index 9180e09..c2f8640 100644
--- a/sk-queue.c
+++ b/sk-queue.c
@@ -12,7 +12,7 @@
 
 #include "asm/types.h"
 #include "list.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "image.h"
 #include "servicefd.h"
 #include "cr_options.h"
@@ -151,13 +151,13 @@ int dump_sk_queue(int sock_fd, int sock_id)
 			goto err_set_sock;
 		}
 
-		ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_SK_QUEUES), &pe, PB_SK_QUEUES);
+		ret = pb_write_one(img_from_set(glob_imgset, CR_FD_SK_QUEUES), &pe, PB_SK_QUEUES);
 		if (ret < 0) {
 			ret = -EIO;
 			goto err_set_sock;
 		}
 
-		ret = write_img_buf(fdset_fd(glob_fdset, CR_FD_SK_QUEUES), data, pe.length);
+		ret = write_img_buf(img_from_set(glob_imgset, CR_FD_SK_QUEUES), data, pe.length);
 		if (ret < 0) {
 			ret = -EIO;
 			goto err_set_sock;
diff --git a/sk-unix.c b/sk-unix.c
index dad0750..f31e43b 100644
--- a/sk-unix.c
+++ b/sk-unix.c
@@ -12,7 +12,7 @@
 #include "asm/types.h"
 #include "libnetlink.h"
 #include "cr_options.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "unix_diag.h"
 #include "files.h"
 #include "file-ids.h"
@@ -133,7 +133,7 @@ static int write_unix_entry(struct unix_sk_desc *sk)
 {
 	int ret;
 
-	ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_UNIXSK), sk->ue, PB_UNIX_SK);
+	ret = pb_write_one(img_from_set(glob_imgset, CR_FD_UNIXSK), sk->ue, PB_UNIX_SK);
 
 	show_one_unix_img("Dumped", sk->ue);
 
@@ -604,7 +604,7 @@ int fix_external_unix_sockets(void)
 		e.fown		= &fown;
 		e.opts		= &skopts;
 
-		if (pb_write_one(fdset_fd(glob_fdset, CR_FD_UNIXSK), &e, PB_UNIX_SK))
+		if (pb_write_one(img_from_set(glob_imgset, CR_FD_UNIXSK), &e, PB_UNIX_SK))
 			goto err;
 
 		show_one_unix_img("Dumped extern", &e);
diff --git a/timerfd.c b/timerfd.c
index bc2ac33..edf917a 100644
--- a/timerfd.c
+++ b/timerfd.c
@@ -15,7 +15,7 @@
 #include "timerfd.h"
 #include "pstree.h"
 #include "files.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "util.h"
 #include "log.h"
 #include "bug.h"
@@ -81,7 +81,7 @@ static int dump_timerfd_entry(union fdinfo_entries *e, void *arg)
 		tfy->id, tfy->clockid, (unsigned long long)tfy->vsec, (unsigned long long)tfy->vnsec,
 		(unsigned long long)tfy->isec, (unsigned long long)tfy->insec);
 
-	return pb_write_one(fdset_fd(glob_fdset, CR_FD_TIMERFD), &e->tfy, PB_TIMERFD);
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_TIMERFD), &e->tfy, PB_TIMERFD);
 }
 
 static int dump_one_timerfd(int lfd, u32 id, const struct fd_parms *p)
diff --git a/tty.c b/tty.c
index 6d351cd..462f023 100644
--- a/tty.c
+++ b/tty.c
@@ -18,7 +18,7 @@
 #include "syscall.h"
 #include "files.h"
 #include "cr_options.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "servicefd.h"
 #include "image.h"
 #include "util.h"
@@ -1107,7 +1107,7 @@ static int dump_pty_info(int lfd, u32 id, const struct fd_parms *p, int major, i
 	 * gather.
 	 */
 	if (pti->hangup)
-		return pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY_INFO), &info, PB_TTY_INFO);
+		return pb_write_one(img_from_set(glob_imgset, CR_FD_TTY_INFO), &info, PB_TTY_INFO);
 
 	/*
 	 * Now trace the paired/unpaired ttys. For example
@@ -1152,7 +1152,7 @@ static int dump_pty_info(int lfd, u32 id, const struct fd_parms *p, int major, i
 	}
 	winsize_copy(&winsize, &w);
 
-	ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY_INFO), &info, PB_TTY_INFO);
+	ret = pb_write_one(img_from_set(glob_imgset, CR_FD_TTY_INFO), &info, PB_TTY_INFO);
 out:
 	xfree(termios.c_cc);
 	xfree(termios_locked.c_cc);
@@ -1200,7 +1200,7 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p)
 		ret = dump_pty_info(lfd, e.tty_info_id, p, major, index);
 
 	if (!ret)
-		ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY_FILES), &e, PB_TTY_FILE);
+		ret = pb_write_one(img_from_set(glob_imgset, CR_FD_TTY_FILES), &e, PB_TTY_FILE);
 	return ret;
 }
 
diff --git a/tun.c b/tun.c
index de4458a..82cecc4 100644
--- a/tun.c
+++ b/tun.c
@@ -5,7 +5,7 @@
 #include <sys/ioctl.h>
 
 #include "cr_options.h"
-#include "fdset.h"
+#include "imgset.h"
 #include "protobuf.h"
 #include "cr-show.h"
 #include "string.h"
@@ -266,7 +266,7 @@ static struct tun_link *get_tun_link_fd(char *name, unsigned flags)
 
 static int dump_tunfile(int lfd, u32 id, const struct fd_parms *p)
 {
-	int ret, img = fdset_fd(glob_fdset, CR_FD_TUNFILE);
+	int ret, img = img_from_set(glob_imgset, CR_FD_TUNFILE);
 	TunfileEntry tfe = TUNFILE_ENTRY__INIT;
 	struct ifreq ifr;
 
@@ -398,7 +398,7 @@ struct collect_image_info tunfile_cinfo = {
 	.flags = COLLECT_OPTIONAL,
 };
 
-int dump_tun_link(NetDeviceEntry *nde, struct cr_fdset *fds)
+int dump_tun_link(NetDeviceEntry *nde, struct cr_imgset *fds)
 {
 	TunLinkEntry tle = TUN_LINK_ENTRY__INIT;
 	char spath[64];
-- 
1.8.4.2




More information about the CRIU mailing list