[Devel] [PATCH] Remove struct timeval from socket header
Dan Smith
danms at us.ibm.com
Mon Aug 24 11:19:54 PDT 2009
This patch removes the 'struct timeval' from the socket header and replaces
it with a fixed-size type as suggested by Oren.
Signed-off-by: Dan Smith <danms at us.ibm.com>
---
include/linux/checkpoint_hdr.h | 5 +++--
net/checkpoint.c | 22 ++++++++++++++++++++--
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h
index 5473a4f..01be039 100644
--- a/include/linux/checkpoint_hdr.h
+++ b/include/linux/checkpoint_hdr.h
@@ -385,6 +385,9 @@ struct ckpt_hdr_socket {
__s64 rcvlowat;
__u64 flags;
+ __s64 rcvtimeo;
+ __s64 sndtimeo;
+
__u32 err;
__u32 err_soft;
__u32 priority;
@@ -400,8 +403,6 @@ struct ckpt_hdr_socket {
__u8 no_check;
struct linger linger;
- struct timeval rcvtimeo;
- struct timeval sndtimeo;
} sock __attribute__ ((aligned(8)));
} __attribute__ ((aligned(8)));
diff --git a/net/checkpoint.c b/net/checkpoint.c
index a7e7db0..2c62d54 100644
--- a/net/checkpoint.c
+++ b/net/checkpoint.c
@@ -349,6 +349,24 @@ static int sock_restore_flags(struct socket *sock,
return 0;
}
+static int sock_copy_timeval(int op, struct sock *sk,
+ int sockopt, __s64 *saved)
+{
+ struct timeval tv;
+
+ if (op == CKPT_CPT) {
+ if (CKPT_COPY_SOPT(op, sk, sockopt, &tv))
+ return -EINVAL;
+ *saved = timeval_to_ns(&tv);
+ } else {
+ tv = ns_to_timeval(*saved);
+ if (CKPT_COPY_SOPT(op, sk, sockopt, &tv))
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int sock_cptrst(struct ckpt_ctx *ctx, struct sock *sk,
struct ckpt_hdr_socket *h, int op)
{
@@ -392,12 +410,12 @@ static int sock_cptrst(struct ckpt_ctx *ctx, struct sock *sk,
return -EINVAL;
}
- if (CKPT_COPY_SOPT(op, sk, SO_SNDTIMEO, &h->sock.sndtimeo)) {
+ if (sock_copy_timeval(op, sk, SO_SNDTIMEO, &h->sock.sndtimeo)) {
ckpt_debug("Failed to set SO_SNDTIMEO");
return -EINVAL;
}
- if (CKPT_COPY_SOPT(op, sk, SO_RCVTIMEO, &h->sock.rcvtimeo)) {
+ if (sock_copy_timeval(op, sk, SO_RCVTIMEO, &h->sock.rcvtimeo)) {
ckpt_debug("Failed to set SO_RCVTIMEO");
return -EINVAL;
}
--
1.6.2.5
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list