Commit e42c7695 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

proc: Remove unneeded callback arg from parse_fdinfo

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent c14cede6
...@@ -92,7 +92,7 @@ static int autofs_check_fd_stat(struct stat *stat, int prgp, int fd, ...@@ -92,7 +92,7 @@ static int autofs_check_fd_stat(struct stat *stat, int prgp, int fd,
return 0; return 0;
if (stat->st_ino != ino) if (stat->st_ino != ino)
return 0; 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; return -1;
*mode = fdinfo.flags & O_WRONLY; *mode = fdinfo.flags & O_WRONLY;
......
...@@ -284,7 +284,7 @@ static int check_fdinfo_eventfd(void) ...@@ -284,7 +284,7 @@ static int check_fdinfo_eventfd(void)
return -1; return -1;
} }
ret = parse_fdinfo(fd, FD_TYPES__EVENTFD, NULL, &fe); ret = parse_fdinfo(fd, FD_TYPES__EVENTFD, &fe);
close(fd); close(fd);
if (ret) { if (ret) {
...@@ -307,7 +307,7 @@ int check_mnt_id(void) ...@@ -307,7 +307,7 @@ int check_mnt_id(void)
struct fdinfo_common fdinfo = { .mnt_id = -1 }; struct fdinfo_common fdinfo = { .mnt_id = -1 };
int ret; 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) if (ret < 0)
return -1; return -1;
...@@ -333,7 +333,7 @@ static int check_fdinfo_signalfd(void) ...@@ -333,7 +333,7 @@ static int check_fdinfo_signalfd(void)
return -1; return -1;
} }
ret = parse_fdinfo(fd, FD_TYPES__SIGNALFD, NULL, &sfd); ret = parse_fdinfo(fd, FD_TYPES__SIGNALFD, &sfd);
close(fd); close(fd);
if (ret) { if (ret) {
...@@ -369,7 +369,7 @@ static int check_fdinfo_eventpoll(void) ...@@ -369,7 +369,7 @@ static int check_fdinfo_eventpoll(void)
goto epoll_err; goto epoll_err;
} }
ret = parse_fdinfo(efd, FD_TYPES__EVENTPOLL, NULL, &efe); ret = parse_fdinfo(efd, FD_TYPES__EVENTPOLL, &efe);
if (ret) { if (ret) {
pr_err("Error parsing proc fdinfo\n"); pr_err("Error parsing proc fdinfo\n");
goto epoll_err; goto epoll_err;
...@@ -410,7 +410,7 @@ static int check_fdinfo_inotify(void) ...@@ -410,7 +410,7 @@ static int check_fdinfo_inotify(void)
return -1; return -1;
} }
ret = parse_fdinfo(ifd, FD_TYPES__INOTIFY, NULL, &ify); ret = parse_fdinfo(ifd, FD_TYPES__INOTIFY, &ify);
close(ifd); close(ifd);
if (ret < 0) { if (ret < 0) {
......
...@@ -47,7 +47,7 @@ static int dump_one_eventfd(int lfd, u32 id, const struct fd_parms *p) ...@@ -47,7 +47,7 @@ static int dump_one_eventfd(int lfd, u32 id, const struct fd_parms *p)
{ {
EventfdFileEntry efd = EVENTFD_FILE_ENTRY__INIT; 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; return -1;
efd.id = id; efd.id = id;
......
...@@ -60,7 +60,7 @@ static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p) ...@@ -60,7 +60,7 @@ static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p)
e.flags = p->flags; e.flags = p->flags;
e.fown = (FownEntry *)&p->fown; e.fown = (FownEntry *)&p->fown;
if (parse_fdinfo(lfd, FD_TYPES__EVENTPOLL, NULL, &e)) if (parse_fdinfo(lfd, FD_TYPES__EVENTPOLL, &e))
goto out; goto out;
pr_info_eventpoll("Dumping ", &e); pr_info_eventpoll("Dumping ", &e);
......
...@@ -339,7 +339,7 @@ static int fill_fd_params(struct pid *owner_pid, int fd, int lfd, ...@@ -339,7 +339,7 @@ static int fill_fd_params(struct pid *owner_pid, int fd, int lfd,
return -1; 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; return -1;
p->fs_type = fsbuf.f_type; p->fs_type = fsbuf.f_type;
......
...@@ -329,7 +329,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p) ...@@ -329,7 +329,7 @@ static int dump_one_inotify(int lfd, u32 id, const struct fd_parms *p)
ie.flags = p->flags; ie.flags = p->flags;
ie.fown = (FownEntry *)&p->fown; ie.fown = (FownEntry *)&p->fown;
if (parse_fdinfo(lfd, FD_TYPES__INOTIFY, NULL, &ie)) if (parse_fdinfo(lfd, FD_TYPES__INOTIFY, &ie))
goto free; goto free;
for (i = 0; i < ie.n_wd; i++) for (i = 0; i < ie.n_wd; i++)
...@@ -354,7 +354,7 @@ static int pre_dump_one_inotify(int pid, int lfd) ...@@ -354,7 +354,7 @@ static int pre_dump_one_inotify(int pid, int lfd)
InotifyFileEntry ie = INOTIFY_FILE_ENTRY__INIT; InotifyFileEntry ie = INOTIFY_FILE_ENTRY__INIT;
int i; 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; return -1;
for (i = 0; i < ie.n_wd; i++) { 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) ...@@ -430,7 +430,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
fe.flags = p->flags; fe.flags = p->flags;
fe.fown = (FownEntry *)&p->fown; 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; goto free;
for (i = 0; i < fe.n_mark; i++) for (i = 0; i < fe.n_mark; i++)
...@@ -452,7 +452,7 @@ static int pre_dump_one_fanotify(int pid, int lfd) ...@@ -452,7 +452,7 @@ static int pre_dump_one_fanotify(int pid, int lfd)
FanotifyFileEntry fe = FANOTIFY_FILE_ENTRY__INIT; FanotifyFileEntry fe = FANOTIFY_FILE_ENTRY__INIT;
int i; 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; return -1;
for (i = 0; i < fe.n_mark; i++) { for (i = 0; i < fe.n_mark; i++) {
......
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
#include "images/fsnotify.pb-c.h" #include "images/fsnotify.pb-c.h"
#include "images/timerfd.pb-c.h" #include "images/timerfd.pb-c.h"
union fdinfo_entries {
};
struct fdinfo_common { struct fdinfo_common {
off64_t pos; off64_t pos;
int flags; int flags;
...@@ -19,9 +16,7 @@ struct fdinfo_common { ...@@ -19,9 +16,7 @@ struct fdinfo_common {
int owner; int owner;
}; };
extern int parse_fdinfo(int fd, int type, extern int parse_fdinfo(int fd, int type, void *arg);
int (*cb)(union fdinfo_entries *e, void *arg), void *arg); extern int parse_fdinfo_pid(int pid, int fd, int type, void *arg);
extern int parse_fdinfo_pid(int pid, int fd, int type,
int (*cb)(union fdinfo_entries *e, void *arg), void *arg);
#endif #endif
...@@ -1597,8 +1597,7 @@ nodata: ...@@ -1597,8 +1597,7 @@ nodata:
static int parse_file_lock_buf(char *buf, struct file_lock *fl, static int parse_file_lock_buf(char *buf, struct file_lock *fl,
bool is_blocked); bool is_blocked);
static int parse_fdinfo_pid_s(int pid, int fd, int type, static int parse_fdinfo_pid_s(int pid, int fd, int type, void *arg)
int (*cb)(union fdinfo_entries *e, void *arg), void *arg)
{ {
struct bfd f; struct bfd f;
char *str; char *str;
...@@ -1922,23 +1921,21 @@ out: ...@@ -1922,23 +1921,21 @@ out:
return exit_code; return exit_code;
} }
int parse_fdinfo_pid(int pid, int fd, int type, int parse_fdinfo_pid(int pid, int fd, int type, void *arg)
int (*cb)(union fdinfo_entries *e, void *arg), 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 parse_fdinfo(int fd, int type, void *arg)
int (*cb)(union fdinfo_entries *e, void *arg), 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) int get_fd_mntid(int fd, int *mnt_id)
{ {
struct fdinfo_common fdinfo = { .mnt_id = -1}; 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; return -1;
*mnt_id = fdinfo.mnt_id; *mnt_id = fdinfo.mnt_id;
......
...@@ -28,7 +28,7 @@ static int dump_one_signalfd(int lfd, u32 id, const struct fd_parms *p) ...@@ -28,7 +28,7 @@ static int dump_one_signalfd(int lfd, u32 id, const struct fd_parms *p)
{ {
SignalfdEntry sfd = SIGNALFD_ENTRY__INIT; SignalfdEntry sfd = SIGNALFD_ENTRY__INIT;
if (parse_fdinfo(lfd, FD_TYPES__SIGNALFD, NULL, &sfd)) if (parse_fdinfo(lfd, FD_TYPES__SIGNALFD, &sfd))
return -1; return -1;
sfd.id = id; sfd.id = id;
......
...@@ -68,7 +68,7 @@ static int dump_one_timerfd(int lfd, u32 id, const struct fd_parms *p) ...@@ -68,7 +68,7 @@ static int dump_one_timerfd(int lfd, u32 id, const struct fd_parms *p)
{ {
TimerfdEntry tfe = TIMERFD_ENTRY__INIT; TimerfdEntry tfe = TIMERFD_ENTRY__INIT;
if (parse_fdinfo(lfd, FD_TYPES__TIMERFD, NULL, &tfe)) if (parse_fdinfo(lfd, FD_TYPES__TIMERFD, &tfe))
return -1; return -1;
tfe.id = id; tfe.id = id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment