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 @@ ...@@ -10,7 +10,6 @@
#include "images/timerfd.pb-c.h" #include "images/timerfd.pb-c.h"
union fdinfo_entries { union fdinfo_entries {
TimerfdEntry tfy;
}; };
struct fdinfo_common { struct fdinfo_common {
......
...@@ -1613,8 +1613,6 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type, ...@@ -1613,8 +1613,6 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type,
return -1; return -1;
while (1) { while (1) {
union fdinfo_entries entry;
str = breadline(&f); str = breadline(&f);
if (!str) if (!str)
break; break;
...@@ -1696,16 +1694,13 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type, ...@@ -1696,16 +1694,13 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type,
continue; continue;
} }
if (fdinfo_field(str, "clockid")) { if (fdinfo_field(str, "clockid")) {
timerfd_entry__init(&entry.tfy); TimerfdEntry *tfe = arg;
if (type != FD_TYPES__TIMERFD) if (type != FD_TYPES__TIMERFD)
goto parse_err; goto parse_err;
ret = parse_timerfd(&f, str, &entry.tfy); ret = parse_timerfd(&f, str, tfe);
if (ret) if (ret)
goto parse_err; goto parse_err;
ret = cb(&entry, arg);
if (ret)
goto out;
entry_met = true; entry_met = true;
continue; continue;
......
...@@ -64,26 +64,21 @@ int is_timerfd_link(char *link) ...@@ -64,26 +64,21 @@ int is_timerfd_link(char *link)
return is_anon_link_type(link, "[timerfd]"); 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 tfe = TIMERFD_ENTRY__INIT;
TimerfdEntry *tfy = &e->tfy;
tfy->id = da->id; if (parse_fdinfo(lfd, FD_TYPES__TIMERFD, NULL, &tfe))
tfy->flags = da->p->flags; return -1;
tfy->fown = (FownEntry *)&da->p->fown;
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", 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, tfe.id, tfe.clockid, (unsigned long long)tfe.vsec, (unsigned long long)tfe.vnsec,
(unsigned long long)tfy->isec, (unsigned long long)tfy->insec); (unsigned long long)tfe.isec, (unsigned long long)tfe.insec);
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) return pb_write_one(img_from_set(glob_imgset, CR_FD_TIMERFD), &tfe, PB_TIMERFD);
{
struct timerfd_dump_arg da = { .id = id, .p = p, };
return parse_fdinfo(lfd, FD_TYPES__TIMERFD, dump_timerfd_entry, &da);
} }
const struct fdtype_ops timerfd_dump_ops = { 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