Skip to contentSkip to conversation

c/r: checkpoint and restore FIFOs

PATCH New Oren Laadan 1 participant 1 message Jul 23, 2009 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 c/r: checkpoint and restore FIFOs

FIFOs are almost like pipes.

Checkpoints adds the FIFO pathname. The first time the FIFO is found it also assigns an @objref and dumps the contents in the buffers.

To restore, use the @objref only to determine whether a particular FIFO has already been restored earlier. Note that it ignores the file pointer that matches that @objref (unlike with pipes, where that file corresponds to the other end of the pipe). Instead, it creates a new FIFO using the saved pathname.

---
 checkpoint/files.c             |    6 +++
 fs/pipe.c                      |   82 +++++++++++++++++++++++++++++++++++++++-
 include/linux/checkpoint_hdr.h |    1 +
 include/linux/pipe_fs_i.h      |    2 +
 4 files changed, 89 insertions(+), 2 deletions(-)
checkpoint/files.c +6 -0
index bcdc774..0642649 100644
@@ -548,6 +548,12 @@ static struct restore_file_ops restore_file_ops[] = {
 		.file_type = CKPT_FILE_PIPE,
 		.restore = pipe_file_restore,
 	},
+	/* fifo */
+	{
+		.file_name = "FIFO",
+		.file_type = CKPT_FILE_FIFO,
+		.restore = fifo_file_restore,
+	},
 };
 
 static struct file *do_restore_file(struct ckpt_ctx *ctx)
fs/pipe.c +80 -2

114 lines not on this page · raw message

include/linux/checkpoint_hdr.h +1 -0
index e37fa72..4b85956 100644
@@ -326,6 +326,7 @@ enum file_type {
 	CKPT_FILE_IGNORE = 0,
 	CKPT_FILE_GENERIC,
 	CKPT_FILE_PIPE,
+	CKPT_FILE_FIFO,
 	CKPT_FILE_MAX
 };
 
include/linux/pipe_fs_i.h +2 -0
index e526a12..596403e 100644
@@ -160,6 +160,8 @@ struct ckpt_ctx;
 struct ckpt_hdr_file;
 extern struct file *pipe_file_restore(struct ckpt_ctx *ctx,
 				      struct ckpt_hdr_file *ptr);
+extern struct file *fifo_file_restore(struct ckpt_ctx *ctx,
+				      struct ckpt_hdr_file *ptr);
 #endif
 
 #endif
Signature · 1 line
1.6.0.4