mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +00:00
dump: Split dumping reg file and pipes
Reg files are those obtained by open() syscall on restore. Pipes should be checked to belong to pipefs (fifos are not supported yet). Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
50ff1438b0
commit
37a3ed86f4
28
cr-dump.c
28
cr-dump.c
@ -352,15 +352,19 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dump_gen_file(struct fd_parms *p, int lfd,
|
||||
static int dump_reg_file(struct fd_parms *p, int lfd,
|
||||
const struct cr_fdset *cr_fdset)
|
||||
{
|
||||
p->id = MAKE_FD_GENID(p->stat.st_dev, p->stat.st_ino, p->pos);
|
||||
if (S_ISFIFO(p->stat.st_mode))
|
||||
p->type = FDINFO_PIPE;
|
||||
else
|
||||
p->type = FDINFO_REG;
|
||||
p->type = FDINFO_REG;
|
||||
return do_dump_gen_file(p, lfd, cr_fdset);
|
||||
}
|
||||
|
||||
static int dump_pipe(struct fd_parms *p, int lfd,
|
||||
const struct cr_fdset *cr_fdset)
|
||||
{
|
||||
p->id = MAKE_FD_GENID(p->stat.st_dev, p->stat.st_ino, p->pos);
|
||||
p->type = FDINFO_PIPE;
|
||||
return do_dump_gen_file(p, lfd, cr_fdset);
|
||||
}
|
||||
|
||||
@ -454,7 +458,7 @@ static int dump_chrdev(struct fd_parms *p, int lfd, const struct cr_fdset *set)
|
||||
|
||||
maj = major(p->stat.st_rdev);
|
||||
if (maj == MEM_MAJOR)
|
||||
return dump_gen_file(p, lfd, set);
|
||||
return dump_reg_file(p, lfd, set);
|
||||
|
||||
if (p->fd < 3 && (maj == TTY_MAJOR ||
|
||||
maj == UNIX98_PTY_SLAVE_MAJOR)) {
|
||||
@ -486,6 +490,10 @@ static int dump_inotify(struct fd_parms *p, int lfd, const struct cr_fdset *set)
|
||||
return do_dump_gen_file(p, lfd, set);
|
||||
}
|
||||
|
||||
#ifndef PIPEFS_MAGIC
|
||||
#define PIPEFS_MAGIC 0x50495045
|
||||
#endif
|
||||
|
||||
static int dump_one_file(pid_t pid, int fd, int lfd, char fd_flags,
|
||||
const struct cr_fdset *cr_fdset)
|
||||
{
|
||||
@ -518,9 +526,11 @@ static int dump_one_file(pid_t pid, int fd, int lfd, char fd_flags,
|
||||
}
|
||||
|
||||
if (S_ISREG(p.stat.st_mode) ||
|
||||
S_ISDIR(p.stat.st_mode) ||
|
||||
S_ISFIFO(p.stat.st_mode))
|
||||
return dump_gen_file(&p, lfd, cr_fdset);
|
||||
S_ISDIR(p.stat.st_mode))
|
||||
return dump_reg_file(&p, lfd, cr_fdset);
|
||||
|
||||
if (S_ISFIFO(p.stat.st_mode) && (statfs.f_type == PIPEFS_MAGIC))
|
||||
return dump_pipe(&p, lfd, cr_fdset);
|
||||
|
||||
return dump_unsupp_fd(&p);
|
||||
}
|
||||
|
@ -39,8 +39,6 @@
|
||||
#define INOTIFY_MAGIC 0x48424431 /* Volgograd */
|
||||
#define INOTIFY_WMAGIC 0x54562009 /* Svetlogorsk (Rauschen) */
|
||||
|
||||
#define PIPEFS_MAGIC 0x50495045
|
||||
|
||||
enum fd_types {
|
||||
FDINFO_UND,
|
||||
FDINFO_REG,
|
||||
|
Loading…
x
Reference in New Issue
Block a user