From a135b40ba2b8b08301c22f9bce97acbdafb31152 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Sun, 1 Jul 2012 05:48:15 +0400 Subject: [PATCH] ghost-files: Merge dump and restore helper structs Signed-off-by: Pavel Emelyanov --- files-reg.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/files-reg.c b/files-reg.c index 0e38a785f..74ff63322 100644 --- a/files-reg.c +++ b/files-reg.c @@ -14,22 +14,23 @@ #include "files-reg.h" -struct ghost_file { - struct list_head list; - u32 id; - char *path; -}; - /* * Ghost files are those not visible from the FS. Dumping them is * nasty and the only way we have -- just carry its contents with * us. Any brave soul to implement link unlinked file back? */ -struct ghost_file_dumpee { +struct ghost_file { struct list_head list; u32 id; - u32 dev; - u32 ino; + union { + struct /* for dumping */ { + u32 dev; + u32 ino; + }; + struct /* for restoring */ { + char *path; + }; + }; }; static u32 ghost_file_ids = 1; @@ -212,7 +213,7 @@ static int dump_ghost_file(int _fd, u32 id, const struct stat *st) static int dump_ghost_remap(char *path, const struct stat *st, int lfd, u32 id) { - struct ghost_file_dumpee *gf; + struct ghost_file *gf; struct remap_file_path_entry rpe; pr_info("Dumping ghost file for fd %d id %#x\n", lfd, id);