* [PATCH] Remove struct timeval from socket header
@ 2009-08-24 18:19 Dan Smith
[not found] ` <1251137994-17972-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Dan Smith @ 2009-08-24 18:19 UTC (permalink / raw)
To: containers-qjLDD68F18O7TbgM5vRIOg
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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Remove struct timeval from socket header
[not found] ` <1251137994-17972-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-08-25 0:04 ` Serge E. Hallyn
2009-08-25 5:54 ` Oren Laadan
2009-08-25 7:49 ` Matt Helsley
2 siblings, 0 replies; 5+ messages in thread
From: Serge E. Hallyn @ 2009-08-25 0:04 UTC (permalink / raw)
To: Dan Smith; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
Quoting Dan Smith (danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
> 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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Acked-by: Serge Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
> 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-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Remove struct timeval from socket header
[not found] ` <1251137994-17972-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-08-25 0:04 ` Serge E. Hallyn
@ 2009-08-25 5:54 ` Oren Laadan
2009-08-25 7:49 ` Matt Helsley
2 siblings, 0 replies; 5+ messages in thread
From: Oren Laadan @ 2009-08-25 5:54 UTC (permalink / raw)
To: Dan Smith; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
Added, thanks.
Dan Smith wrote:
> 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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
> 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;
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Remove struct timeval from socket header
[not found] ` <1251137994-17972-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-08-25 0:04 ` Serge E. Hallyn
2009-08-25 5:54 ` Oren Laadan
@ 2009-08-25 7:49 ` Matt Helsley
[not found] ` <20090825074902.GE8078-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2 siblings, 1 reply; 5+ messages in thread
From: Matt Helsley @ 2009-08-25 7:49 UTC (permalink / raw)
To: Dan Smith; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
On Mon, Aug 24, 2009 at 11:19:54AM -0700, Dan Smith wrote:
> This patch removes the 'struct timeval' from the socket header and replaces
> it with a fixed-size type as suggested by Oren.
nit:
I think I can guess the reason Oren suggested this but I shouldn't have
to -- it should be in the changelog instead of simply saying oren
suggested it.
Cheers,
-Matt Helsley
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Remove struct timeval from socket header
[not found] ` <20090825074902.GE8078-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
@ 2009-08-25 13:37 ` Dan Smith
0 siblings, 0 replies; 5+ messages in thread
From: Dan Smith @ 2009-08-25 13:37 UTC (permalink / raw)
To: Matt Helsley; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
MH> I think I can guess the reason Oren suggested this but I shouldn't
MH> have to -- it should be in the changelog instead of simply saying
MH> oren suggested it.
Okay, I thought "fixed-size type" was clear enough, but noted.
Thanks!
--
Dan Smith
IBM Linux Technology Center
email: danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-25 13:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-24 18:19 [PATCH] Remove struct timeval from socket header Dan Smith
[not found] ` <1251137994-17972-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-08-25 0:04 ` Serge E. Hallyn
2009-08-25 5:54 ` Oren Laadan
2009-08-25 7:49 ` Matt Helsley
[not found] ` <20090825074902.GE8078-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-08-25 13:37 ` Dan Smith
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.