[CRIU] [PATCH] files_reg: carry rdev with regular files

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Wed Jul 6 07:26:23 PDT 2016


Will be required to create silly-renamed device files on SPFS.
Note: rdev is carried as a part of ghost file information, but it's not used
in case of silly-renamed files.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 criu/files-reg.c     |    5 +++++
 images/regfile.proto |    1 +
 2 files changed, 6 insertions(+)

diff --git a/criu/files-reg.c b/criu/files-reg.c
index 157cb8f..588fbc4 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -1187,6 +1187,11 @@ ext:
 		rfe.size = p->stat.st_size;
 	}
 
+	if (S_ISCHR(p->stat.st_mode) || S_ISBLK(p->stat.st_mode)) {
+		rfe.has_rdev = true;
+		rfe.rdev = p->stat.st_rdev;
+	}
+
 	rimg = img_from_set(glob_imgset, CR_FD_REG_FILES);
 	return pb_write_one(rimg, &rfe, PB_REG_FILE);
 }
diff --git a/images/regfile.proto b/images/regfile.proto
index bc4c14d..3db0820 100644
--- a/images/regfile.proto
+++ b/images/regfile.proto
@@ -13,4 +13,5 @@ message reg_file_entry {
 	optional uint64		size	= 8;
 	optional bool		ext	= 9;
 	optional uint32         mode    = 10;
+	optional uint32         rdev    = 11;
 }



More information about the CRIU mailing list