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

timerfd: Rework parse_fdinfo not to use callback

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent e5b4ef20
......@@ -10,7 +10,6 @@
#include "images/timerfd.pb-c.h"
union fdinfo_entries {
TimerfdEntry tfy;
};
struct fdinfo_common {
......
......@@ -1613,8 +1613,6 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type,
return -1;
while (1) {
union fdinfo_entries entry;
str = breadline(&f);
if (!str)
break;
......@@ -1696,16 +1694,13 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type,
continue;
}
if (fdinfo_field(str, "clockid")) {
timerfd_entry__init(&entry.tfy);
TimerfdEntry *tfe = arg;
if (type != FD_TYPES__TIMERFD)
goto parse_err;
ret = parse_timerfd(&f, str, &entry.tfy);
ret = parse_timerfd(&f, str, tfe);
if (ret)
goto parse_err;
ret = cb(&entry, arg);
if (ret)
goto out;
entry_met = true;
continue;
......
......@@ -64,26 +64,21 @@ int is_timerfd_link(char *link)
return is_anon_link_type(link, "[timerfd]");
}
static int dump_timerfd_entry(union fdinfo_entries *e, void *arg)
static int dump_one_timerfd(int lfd, u32 id, const struct fd_parms *p)
{
struct timerfd_dump_arg *da = arg;
TimerfdEntry *tfy = &e->tfy;
TimerfdEntry tfe = TIMERFD_ENTRY__INIT;
tfy->id = da->id;
tfy->flags = da->p->flags;
tfy->fown = (FownEntry *)&da->p->fown;
if (parse_fdinfo(lfd, FD_TYPES__TIMERFD, NULL, &tfe))
return -1;
tfe.id = id;
tfe.flags = p->flags;
tfe.fown = (FownEntry *)&p->fown;
pr_info("Dumping id %#x clockid %d it_value(%llu, %llu) it_interval(%llu, %llu)\n",
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(img_from_set(glob_imgset, CR_FD_TIMERFD), &e->tfy, PB_TIMERFD);
}
tfe.id, tfe.clockid, (unsigned long long)tfe.vsec, (unsigned long long)tfe.vnsec,
(unsigned long long)tfe.isec, (unsigned long long)tfe.insec);
static int dump_one_timerfd(int lfd, u32 id, const struct fd_parms *p)
{
struct timerfd_dump_arg da = { .id = id, .p = p, };
return parse_fdinfo(lfd, FD_TYPES__TIMERFD, dump_timerfd_entry, &da);
return pb_write_one(img_from_set(glob_imgset, CR_FD_TIMERFD), &tfe, PB_TIMERFD);
}
const struct fdtype_ops timerfd_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