Commit 54fb48d7 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

signalfd: Rework parse_fdinfo no to use callback

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent c94d0cac
......@@ -302,11 +302,6 @@ static int check_fdinfo_eventfd(void)
return 0;
}
static int check_one_sfd(union fdinfo_entries *e, void *arg)
{
return 0;
}
int check_mnt_id(void)
{
struct fdinfo_common fdinfo = { .mnt_id = -1 };
......@@ -328,6 +323,7 @@ static int check_fdinfo_signalfd(void)
{
int fd, ret;
sigset_t mask;
SignalfdEntry sfd = SIGNALFD_ENTRY__INIT;
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
......@@ -337,7 +333,7 @@ static int check_fdinfo_signalfd(void)
return -1;
}
ret = parse_fdinfo(fd, FD_TYPES__SIGNALFD, check_one_sfd, NULL);
ret = parse_fdinfo(fd, FD_TYPES__SIGNALFD, NULL, &sfd);
close(fd);
if (ret) {
......
......@@ -31,7 +31,6 @@ struct eventpoll_tfd_entry {
};
union fdinfo_entries {
SignalfdEntry sfd;
struct inotify_wd_entry ify;
struct fanotify_mark_entry ffy;
struct eventpoll_tfd_entry epl;
......
......@@ -1768,17 +1768,14 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type,
continue;
}
if (fdinfo_field(str, "sigmask")) {
signalfd_entry__init(&entry.sfd);
SignalfdEntry *sfd = arg;
if (type != FD_TYPES__SIGNALFD)
goto parse_err;
ret = sscanf(str, "sigmask: %Lx",
(unsigned long long *)&entry.sfd.sigmask);
(unsigned long long *)&sfd->sigmask);
if (ret != 1)
goto parse_err;
ret = cb(&entry, arg);
if (ret)
goto out;
entry_met = true;
continue;
......
......@@ -24,34 +24,19 @@ int is_signalfd_link(char *link)
return is_anon_link_type(link, "[signalfd]");
}
struct signalfd_dump_arg {
u32 id;
const struct fd_parms *p;
bool dumped;
};
static int dump_signalfd_entry(union fdinfo_entries *e, void *arg)
static int dump_one_signalfd(int lfd, u32 id, const struct fd_parms *p)
{
struct signalfd_dump_arg *da = arg;
SignalfdEntry sfd = SIGNALFD_ENTRY__INIT;
if (da->dumped) {
pr_err("Several counters in a file?\n");
if (parse_fdinfo(lfd, FD_TYPES__SIGNALFD, NULL, &sfd))
return -1;
}
da->dumped = true;
e->sfd.id = da->id;
e->sfd.flags = da->p->flags;
e->sfd.fown = (FownEntry *)&da->p->fown;
sfd.id = id;
sfd.flags = p->flags;
sfd.fown = (FownEntry *)&p->fown;
return pb_write_one(img_from_set(glob_imgset, CR_FD_SIGNALFD),
&e->sfd, PB_SIGNALFD);
}
static int dump_one_signalfd(int lfd, u32 id, const struct fd_parms *p)
{
struct signalfd_dump_arg da = { .id = id, .p = p, };
return parse_fdinfo(lfd, FD_TYPES__SIGNALFD, dump_signalfd_entry, &da);
&sfd, PB_SIGNALFD);
}
const struct fdtype_ops signalfd_dump_ops = {
......
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