[C/R v20][PATCH 75/96] c/r: introduce checkpoint/restore methods to struct proto_ops

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Oren Laadan
Date: Wednesday, March 17, 2010 - 9:09 am

This adds new 'proto_ops' function for checkpointing and restoring
sockets. This allows the checkpoint/restart code to compile nicely
when, e.g., AF_UNIX sockets are selected as a module.

It also adds a function 'collecting' a socket for leak-detection
during full-container checkpoint. This is useful for those sockets
that hold references to other "collectable" objects. Two examples are
AF_UNIX buffers which reference the socket of origin, and sockets that
have file descriptors in-transit.

Signed-off-by: Oren Laadan <orenl@cs.columbia.edu>
Acked-by: Serge E. Hallyn <serue@us.ibm.com>
Tested-by: Serge E. Hallyn <serue@us.ibm.com>
---
 include/linux/net.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index 5e8083c..72a53b9 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -153,6 +153,9 @@ struct sockaddr;
 struct msghdr;
 struct module;
 
+struct ckpt_ctx;
+struct ckpt_hdr_socket;
+
 struct proto_ops {
 	int		family;
 	struct module	*owner;
@@ -197,6 +200,12 @@ struct proto_ops {
 				      int offset, size_t size, int flags);
 	ssize_t 	(*splice_read)(struct socket *sock,  loff_t *ppos,
 				       struct pipe_inode_info *pipe, size_t len, unsigned int flags);
+	int		(*checkpoint)(struct ckpt_ctx *ctx,
+				      struct socket *sock);
+	int		(*collect)(struct ckpt_ctx *ctx,
+				   struct socket *sock);
+	int		(*restore)(struct ckpt_ctx *ctx, struct socket *sock,
+				   struct ckpt_hdr_socket *h);
 };
 
 #define DECLARE_SOCKADDR(type, dst, src)	\
-- 
1.6.3.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[C/R v20][PATCH 00/96] Linux Checkpoint-Restart - v20, Oren Laadan, (Wed Mar 17, 9:07 am)
[C/R v20][PATCH 13/96] c/r: break out new_user_ns(), Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 19/96] Namespaces submenu, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 22/96] c/r: documentation, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 28/96] c/r: restart-blocks, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 30/96] c/r: restart multiple processes, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 38/96] c/r: dump open file descriptors, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 51/96] c/r: support for open pipes, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 55/96] c/r: support for UTS namespace, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 60/96] c/r: support semaphore sysv-ipc, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 62/96] c/r: add CKPT_COPY() macro, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 66/96] c/r: restore file-&gt;f_cred, Oren Laadan, (Wed Mar 17, 9:08 am)
[C/R v20][PATCH 73/96] c/r: correctly restore pgid, Oren Laadan, (Wed Mar 17, 9:09 am)
[C/R v20][PATCH 75/96] c/r: introduce checkpoint/restore m ..., Oren Laadan, (Wed Mar 17, 9:09 am)
[C/R v20][PATCH 83/96] c/r: checkpoint/restart eventfd, Oren Laadan, (Wed Mar 17, 9:09 am)
[C/R v20][PATCH 95/96] c/r: add selinux support (v6), Oren Laadan, (Wed Mar 17, 9:09 am)
Re: [C/R v20][PATCH 15/96] cgroup freezer: Fix buggy resum ..., Rafael J. Wysocki, (Mon Mar 22, 4:28 pm)
Re: [C/R v20][PATCH 15/96] cgroup freezer: Fix buggy resum ..., Rafael J. Wysocki, (Fri Mar 26, 3:53 pm)
Re: [C/R v20][PATCH 00/96] Linux Checkpoint-Restart - v20, Serge E. Hallyn, (Thu Apr 1, 4:37 pm)