Commit 82acfd44 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

files: Merge shmalloc() to fle_init()

Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 7e9fe49f
...@@ -692,12 +692,19 @@ int rst_file_params(int fd, FownEntry *fown, int flags) ...@@ -692,12 +692,19 @@ int rst_file_params(int fd, FownEntry *fown, int flags)
return 0; return 0;
} }
static void fle_init(struct fdinfo_list_entry *fle, int pid, FdinfoEntry *fe) static struct fdinfo_list_entry *alloc_fle(int pid, FdinfoEntry *fe)
{ {
struct fdinfo_list_entry *fle;
fle = shmalloc(sizeof(*fle));
if (!fle)
return NULL;
fle->pid = pid; fle->pid = pid;
fle->fe = fe; fle->fe = fe;
fle->received = 0; fle->received = 0;
fle->stage = FLE_INITIALIZED; fle->stage = FLE_INITIALIZED;
return fle;
} }
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)
...@@ -708,12 +715,10 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info) ...@@ -708,12 +715,10 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
pr_info("Collect fdinfo pid=%d fd=%d id=%#x\n", pr_info("Collect fdinfo pid=%d fd=%d id=%#x\n",
pid, e->fd, e->id); pid, e->fd, e->id);
new_le = shmalloc(sizeof(*new_le)); new_le = alloc_fle(pid, e);
if (!new_le) if (!new_le)
return -1; return -1;
fle_init(new_le, pid, e);
fdesc = find_file_desc(e); fdesc = find_file_desc(e);
if (fdesc == NULL) { if (fdesc == NULL) {
pr_err("No file for fd %d id %#x\n", e->fd, e->id); pr_err("No file for fd %d id %#x\n", e->fd, e->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