[7/7] proc: Remove unneeded callback arg from parse_fdinfo

Submitted by Pavel Emelianov on June 22, 2017, 5:40 p.m.

Details

Message ID 01fcd995-c038-d02e-24c3-1aaa74ed30d7@virtuozzo.com
State Accepted
Series "Relax fdinfo parsing code"
Headers show

Commit Message

Pavel Emelianov June 22, 2017, 5:40 p.m.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/autofs.c         |  2 +-
 criu/cr-check.c       | 10 +++++-----
 criu/eventfd.c        |  2 +-
 criu/eventpoll.c      |  2 +-
 criu/files.c          |  2 +-
 criu/fsnotify.c       |  8 ++++----
 criu/include/fdinfo.h |  9 ++-------
 criu/proc_parse.c     | 15 ++++++---------
 criu/signalfd.c       |  2 +-
 criu/timerfd.c        |  2 +-
 10 files changed, 23 insertions(+), 31 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/autofs.c b/criu/autofs.c
index b0c5cab..c7e0bbd 100644
--- a/criu/autofs.c
+++ b/criu/autofs.c
@@ -92,7 +92,7 @@  static int autofs_check_fd_stat(struct stat *stat, int prgp, int fd,
 		return 0;
 	if (stat->st_ino != ino)
 		return 0;
-	if (parse_fdinfo_pid(prgp, fd, FD_TYPES__UND, NULL, &fdinfo))
+	if (parse_fdinfo_pid(prgp, fd, FD_TYPES__UND, &fdinfo))
 		return -1;
 
 	*mode = fdinfo.flags & O_WRONLY;
diff --git a/criu/cr-check.c b/criu/cr-check.c
index d5463c3..3992141 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -285,7 +285,7 @@  static int check_fdinfo_eventfd(void)
 		return -1;
 	}
 
-	ret = parse_fdinfo(fd, FD_TYPES__EVENTFD, NULL, &fe);
+	ret = parse_fdinfo(fd, FD_TYPES__EVENTFD, &fe);
 	close(fd);
 
 	if (ret) {
@@ -308,7 +308,7 @@  int check_mnt_id(void)
 	struct fdinfo_common fdinfo = { .mnt_id = -1 };
 	int ret;
 
-	ret = parse_fdinfo(get_service_fd(LOG_FD_OFF), FD_TYPES__UND, NULL, &fdinfo);
+	ret = parse_fdinfo(get_service_fd(LOG_FD_OFF), FD_TYPES__UND, &fdinfo);
 	if (ret < 0)
 		return -1;
 
@@ -334,7 +334,7 @@  static int check_fdinfo_signalfd(void)
 		return -1;
 	}
 
-	ret = parse_fdinfo(fd, FD_TYPES__SIGNALFD, NULL, &sfd);
+	ret = parse_fdinfo(fd, FD_TYPES__SIGNALFD, &sfd);
 	close(fd);
 
 	if (ret) {
@@ -370,7 +370,7 @@  static int check_fdinfo_eventpoll(void)
 		goto epoll_err;
 	}
 
-	ret = parse_fdinfo(efd, FD_TYPES__EVENTPOLL, NULL, &efe);
+	ret = parse_fdinfo(efd, FD_TYPES__EVENTPOLL, &efe);
 	if (ret) {
 		pr_err("Error parsing proc fdinfo\n");
 		goto epoll_err;
@@ -411,7 +411,7 @@  static int check_fdinfo_inotify(void)
 		return -1;
 	}
 
-	ret = parse_fdinfo(ifd, FD_TYPES__INOTIFY, NULL, &ify);
+	ret = parse_fdinfo(ifd, FD_TYPES__INOTIFY, &ify);
 	close(ifd);
 
 	if (ret < 0) {
diff --git a/criu/eventfd.c b/criu/eventfd.c
index 7212ad4..b3c76e3 100644
--- a/criu/eventfd.c
+++ b/criu/eventfd.c
@@ -47,7 +47,7 @@  static int dump_one_eventfd(int lfd, u32 id, const struct fd_parms *p)
 {
 	EventfdFileEntry efd = EVENTFD_FILE_ENTRY__INIT;
 
-	if (parse_fdinfo(lfd, FD_TYPES__EVENTFD, NULL, &efd))
+	if (parse_fdinfo(lfd, FD_TYPES__EVENTFD, &efd))
 		return -1;
 
 	efd.id = id;
diff --git a/criu/eventpoll.c b/criu/eventpoll.c
index 87e2457..b58e068 100644
--- a/criu/eventpoll.c
+++ b/criu/eventpoll.c
@@ -60,7 +60,7 @@  static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p)
 	e.flags = p->flags;
 	e.fown = (FownEntry *)&p->fown;
 
-	if (parse_fdinfo(lfd, FD_TYPES__EVENTPOLL, NULL, &e))
+	if (parse_fdinfo(lfd, FD_TYPES__EVENTPOLL, &e))
 		goto out;
 
 	pr_info_eventpoll("Dumping ", &e);
diff --git a/criu/files.c b/criu/files.c
index 137df41..a36eb36 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -354,7 +354,7 @@  static int fill_fd_params(struct pid *owner_pid, int fd, int lfd,
 		return -1;
 	}
 
-	if (parse_fdinfo_pid(owner_pid->real, fd, FD_TYPES__UND, NULL, &fdinfo))
+	if (parse_fdinfo_pid(owner_pid->real, fd, FD_TYPES__UND, &fdinfo))
 		return -1;
 
 	p->fs_type	= fsbuf.f_type;
diff --git a/criu/fsnotify.c b/criu/fsnotify.c
index f86fbea..cb1b32c 100644
--- a/criu/fsnotify.c
+++ b/criu/fsnotify.c
@@ -329,7 +329,7 @@  static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p)
 	ie.flags = p->flags;
 	ie.fown = (FownEntry *)&p->fown;
 
-	if (parse_fdinfo(lfd, FD_TYPES__INOTIFY, NULL, &ie))
+	if (parse_fdinfo(lfd, FD_TYPES__INOTIFY, &ie))
 		goto free;
 
 	for (i = 0; i < ie.n_wd; i++)
@@ -354,7 +354,7 @@  static int pre_dump_one_inotify(int pid, int lfd)
 	InotifyFileEntry ie = INOTIFY_FILE_ENTRY__INIT;
 	int i;
 
-	if (parse_fdinfo_pid(pid, lfd, FD_TYPES__INOTIFY, NULL, &ie))
+	if (parse_fdinfo_pid(pid, lfd, FD_TYPES__INOTIFY, &ie))
 		return -1;
 
 	for (i = 0; i < ie.n_wd; i++) {
@@ -430,7 +430,7 @@  static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
 	fe.flags = p->flags;
 	fe.fown = (FownEntry *)&p->fown;
 
-	if (parse_fdinfo(lfd, FD_TYPES__FANOTIFY, NULL, &fe) < 0)
+	if (parse_fdinfo(lfd, FD_TYPES__FANOTIFY, &fe) < 0)
 		goto free;
 
 	for (i = 0; i < fe.n_mark; i++)
@@ -452,7 +452,7 @@  static int pre_dump_one_fanotify(int pid, int lfd)
 	FanotifyFileEntry fe = FANOTIFY_FILE_ENTRY__INIT;
 	int i;
 
-	if (parse_fdinfo_pid(pid, lfd, FD_TYPES__FANOTIFY, NULL, &fe))
+	if (parse_fdinfo_pid(pid, lfd, FD_TYPES__FANOTIFY, &fe))
 		return -1;
 
 	for (i = 0; i < fe.n_mark; i++) {
diff --git a/criu/include/fdinfo.h b/criu/include/fdinfo.h
index ab1f122..10fb31f 100644
--- a/criu/include/fdinfo.h
+++ b/criu/include/fdinfo.h
@@ -9,9 +9,6 @@ 
 #include "images/fsnotify.pb-c.h"
 #include "images/timerfd.pb-c.h"
 
-union fdinfo_entries {
-};
-
 struct fdinfo_common {
 	off64_t pos;
 	int flags;
@@ -19,9 +16,7 @@  struct fdinfo_common {
 	int owner;
 };
 
-extern int parse_fdinfo(int fd, int type,
-		int (*cb)(union fdinfo_entries *e, void *arg), void *arg);
-extern int parse_fdinfo_pid(int pid, int fd, int type,
-		int (*cb)(union fdinfo_entries *e, void *arg), void *arg);
+extern int parse_fdinfo(int fd, int type, void *arg);
+extern int parse_fdinfo_pid(int pid, int fd, int type, void *arg);
 
 #endif
diff --git a/criu/proc_parse.c b/criu/proc_parse.c
index b745cde..aa56a0e 100644
--- a/criu/proc_parse.c
+++ b/criu/proc_parse.c
@@ -1669,8 +1669,7 @@  nodata:
 
 static int parse_file_lock_buf(char *buf, struct file_lock *fl,
 				bool is_blocked);
-static int parse_fdinfo_pid_s(int pid, int fd, int type,
-		int (*cb)(union fdinfo_entries *e, void *arg), void *arg)
+static int parse_fdinfo_pid_s(int pid, int fd, int type, void *arg)
 {
 	struct bfd f;
 	char *str;
@@ -1994,23 +1993,21 @@  out:
 	return exit_code;
 }
 
-int parse_fdinfo_pid(int pid, int fd, int type,
-		int (*cb)(union fdinfo_entries *e, void *arg), void *arg)
+int parse_fdinfo_pid(int pid, int fd, int type, void *arg)
 {
-	return parse_fdinfo_pid_s(pid, fd, type, cb, arg);
+	return parse_fdinfo_pid_s(pid, fd, type, arg);
 }
 
-int parse_fdinfo(int fd, int type,
-		int (*cb)(union fdinfo_entries *e, void *arg), void *arg)
+int parse_fdinfo(int fd, int type, void *arg)
 {
-	return parse_fdinfo_pid_s(PROC_SELF, fd, type, cb, arg);
+	return parse_fdinfo_pid_s(PROC_SELF, fd, type, arg);
 }
 
 int get_fd_mntid(int fd, int *mnt_id)
 {
 	struct fdinfo_common fdinfo = { .mnt_id = -1};
 
-	if (parse_fdinfo(fd, FD_TYPES__UND, NULL, &fdinfo))
+	if (parse_fdinfo(fd, FD_TYPES__UND, &fdinfo))
 		return -1;
 
 	*mnt_id = fdinfo.mnt_id;
diff --git a/criu/signalfd.c b/criu/signalfd.c
index 660f510..f33efa1 100644
--- a/criu/signalfd.c
+++ b/criu/signalfd.c
@@ -28,7 +28,7 @@  static int dump_one_signalfd(int lfd, u32 id, const struct fd_parms *p)
 {
 	SignalfdEntry sfd = SIGNALFD_ENTRY__INIT;
 
-	if (parse_fdinfo(lfd, FD_TYPES__SIGNALFD, NULL, &sfd))
+	if (parse_fdinfo(lfd, FD_TYPES__SIGNALFD, &sfd))
 		return -1;
 
 	sfd.id = id;
diff --git a/criu/timerfd.c b/criu/timerfd.c
index 60f77fc..aa2aae1 100644
--- a/criu/timerfd.c
+++ b/criu/timerfd.c
@@ -68,7 +68,7 @@  static int dump_one_timerfd(int lfd, u32 id, const struct fd_parms *p)
 {
 	TimerfdEntry tfe = TIMERFD_ENTRY__INIT;
 
-	if (parse_fdinfo(lfd, FD_TYPES__TIMERFD, NULL, &tfe))
+	if (parse_fdinfo(lfd, FD_TYPES__TIMERFD, &tfe))
 		return -1;
 
 	tfe.id = id;