Commit 9ca95b5d authored by Pavel Emelyanov's avatar Pavel Emelyanov

fd: Remove ID from fd_parm

It's only required for making pipe_id, but making it is better to
be done in place and using the st_ino only.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 58295468
...@@ -326,7 +326,7 @@ int do_dump_gen_file(struct fd_parms *p, int lfd, ...@@ -326,7 +326,7 @@ int do_dump_gen_file(struct fd_parms *p, int lfd,
int ret = -1; int ret = -1;
e.type = ops->type; e.type = ops->type;
e.id = p->id = ops->make_gen_id(p); e.id = ops->make_gen_id(p);
e.fd = p->fd; e.fd = p->fd;
e.flags = p->fd_flags; e.flags = p->fd_flags;
...@@ -397,7 +397,6 @@ static int fill_fd_params(pid_t pid, int fd, int lfd, char fd_flags, struct fd_p ...@@ -397,7 +397,6 @@ static int fill_fd_params(pid_t pid, int fd, int lfd, char fd_flags, struct fd_p
p->pos = lseek(lfd, 0, SEEK_CUR); p->pos = lseek(lfd, 0, SEEK_CUR);
p->flags = fcntl(lfd, F_GETFL); p->flags = fcntl(lfd, F_GETFL);
p->pid = pid; p->pid = pid;
p->id = FD_ID_INVALID;
p->fd_flags = fd_flags; p->fd_flags = fd_flags;
p->fown = (fown_t){ }; p->fown = (fown_t){ };
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "types.h" #include "types.h"
#include "rbtree.h" #include "rbtree.h"
#define FD_ID_INVALID (-1U)
#define FD_PID_INVALID (-2U) #define FD_PID_INVALID (-2U)
#define FD_DESC_INVALID (-3U) #define FD_DESC_INVALID (-3U)
......
...@@ -13,7 +13,6 @@ struct fd_parms { ...@@ -13,7 +13,6 @@ struct fd_parms {
unsigned int flags; unsigned int flags;
char fd_flags; char fd_flags;
struct stat stat; struct stat stat;
u32 id;
pid_t pid; pid_t pid;
fown_t fown; fown_t fown;
}; };
......
...@@ -315,7 +315,7 @@ static int dump_one_pipe_data(int lfd, u32 id, const struct fd_parms *p) ...@@ -315,7 +315,7 @@ static int dump_one_pipe_data(int lfd, u32 id, const struct fd_parms *p)
/* Maybe we've dumped it already */ /* Maybe we've dumped it already */
for (i = 0; i < nr_pipes; i++) { for (i = 0; i < nr_pipes; i++) {
if (pipes_with_data[i] == p->id) if (pipes_with_data[i] == p->stat.st_ino)
return 0; return 0;
} }
...@@ -326,7 +326,7 @@ static int dump_one_pipe_data(int lfd, u32 id, const struct fd_parms *p) ...@@ -326,7 +326,7 @@ static int dump_one_pipe_data(int lfd, u32 id, const struct fd_parms *p)
return -1; return -1;
} }
pipes_with_data[nr_pipes] = p->id; pipes_with_data[nr_pipes] = p->stat.st_ino;
nr_pipes++; nr_pipes++;
pipe_size = fcntl(lfd, F_GETPIPE_SZ); pipe_size = fcntl(lfd, F_GETPIPE_SZ);
...@@ -346,7 +346,7 @@ static int dump_one_pipe_data(int lfd, u32 id, const struct fd_parms *p) ...@@ -346,7 +346,7 @@ static int dump_one_pipe_data(int lfd, u32 id, const struct fd_parms *p)
struct pipe_data_entry pde; struct pipe_data_entry pde;
int wrote; int wrote;
pde.pipe_id = p->id; pde.pipe_id = p->stat.st_ino;
pde.bytes = bytes; pde.bytes = bytes;
pde.off = 0; pde.off = 0;
...@@ -398,10 +398,11 @@ static int dump_one_pipe(int lfd, u32 id, const struct fd_parms *p) ...@@ -398,10 +398,11 @@ static int dump_one_pipe(int lfd, u32 id, const struct fd_parms *p)
{ {
struct pipe_entry pe; struct pipe_entry pe;
pr_info("Dumping pipe %d with id %#x pipe_id %#x\n", lfd, id, p->id); pr_info("Dumping pipe %d with id %#x pipe_id %#x\n",
lfd, id, (u32)p->stat.st_ino);
pe.id = id; pe.id = id;
pe.pipe_id = p->id; pe.pipe_id = p->stat.st_ino;
pe.flags = p->flags; pe.flags = p->flags;
pe.fown = p->fown; pe.fown = p->fown;
......
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