1 Star 0 Fork 38

jpzhang187/criu

forked from src-openEuler/criu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0023-block-device-dump-block-device-as-reguler-file.patch 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
river 提交于 2022-04-13 15:05 +08:00 . criu: backport kinds of features/bugfix
From 48c6f11d0b3c5f0549ff52cce0c8ce31ad67518f Mon Sep 17 00:00:00 2001
From: Jingxian He <hejingxian@huawei.com>
Date: Wed, 19 May 2021 21:49:15 +0800
Subject: [PATCH 23/72] block-device: dump block device as reguler file
Add block device dump and restore method for kernel module upgrading.
Conflict:NA
Reference:https://gitee.com/src-openeuler/criu/pulls/21
Signed-off-by: Xiaoguang Li <lixiaoguang2@huawei.com>
---
criu/files.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/criu/files.c b/criu/files.c
index 93754fb..f262d80 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -442,6 +442,30 @@ static const struct fdtype_ops *get_mem_dev_ops(struct fd_parms *p, int minor)
return ops;
}
+static int dump_blkdev(struct fd_parms *p, int lfd, FdinfoEntry *e)
+{
+ struct fd_link *link_old = p->link;
+ int maj = major(p->stat.st_rdev);
+ const struct fdtype_ops *ops;
+ int err;
+
+ switch (maj) {
+ case SCSI_DISK0_MAJOR:
+ ops = &regfile_dump_ops;
+ break;
+ default: {
+ char more[32] = "block_dev";
+
+ err = dump_unsupp_fd(p, lfd, "blk", more, e);
+ p->link = link_old;
+ return err;
+ }
+ }
+ err = do_dump_gen_file(p, lfd, ops, e);
+ p->link = link_old;
+ return err;
+}
+
static int dump_chrdev(struct fd_parms *p, int lfd, FdinfoEntry *e)
{
struct fd_link *link_old = p->link;
@@ -508,6 +532,9 @@ static int dump_one_file(struct pid *pid, int fd, int lfd, struct fd_opts *opts,
p.fd_ctl = ctl; /* Some dump_opts require this to talk to parasite */
p.dfds = dfds; /* epoll needs to verify if target fd exist */
+ if (S_ISBLK(p.stat.st_mode))
+ return dump_blkdev(&p, lfd, e);
+
if (S_ISSOCK(p.stat.st_mode))
return dump_socket(&p, lfd, e);
--
2.34.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jpzhang187/criu.git
git@gitee.com:jpzhang187/criu.git
jpzhang187
criu
criu
master

搜索帮助