Commit 455aa8cd authored by Pavel Emelyanov's avatar Pavel Emelyanov

fd: Move ps fd list selection to separate routine

Just for cleaner (from my pov) code.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ccc6b728
...@@ -147,6 +147,16 @@ int rst_file_params(int fd, FownEntry *fown, int flags) ...@@ -147,6 +147,16 @@ int rst_file_params(int fd, FownEntry *fown, int flags)
return 0; return 0;
} }
static struct list_head *select_ps_list(int type, struct rst_info *ri)
{
switch (type) {
case FD_TYPES__EVENTPOLL:
return &ri->eventpoll;
default:
return &ri->fds;
}
}
static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info) static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
{ {
struct fdinfo_list_entry *le, *new_le; struct fdinfo_list_entry *le, *new_le;
...@@ -176,15 +186,7 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info) ...@@ -176,15 +186,7 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
list_add_tail(&new_le->desc_list, &le->desc_list); list_add_tail(&new_le->desc_list, &le->desc_list);
new_le->desc = fdesc; new_le->desc = fdesc;
list_add_tail(&new_le->ps_list, select_ps_list(e->type, rst_info));
switch (new_le->fe->type) {
case FD_TYPES__EVENTPOLL:
list_add_tail(&new_le->ps_list, &rst_info->eventpoll);
break;
default:
list_add_tail(&new_le->ps_list, &rst_info->fds);
break;
}
return 0; return 0;
} }
......
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