From: Oren Laadan <orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
To: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org
Subject: Re: [PATCH] Remove struct timeval from socket header
Date: Tue, 25 Aug 2009 01:54:32 -0400 [thread overview]
Message-ID: <4A937C98.2030202@librato.com> (raw)
In-Reply-To: <1251137994-17972-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
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;
> }
next prev parent reply other threads:[~2009-08-25 5:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2009-08-25 7:49 ` Matt Helsley
[not found] ` <20090825074902.GE8078-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-08-25 13:37 ` Dan Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A937C98.2030202@librato.com \
--to=orenl-rdfvbdnroixbdgjk7y7tuq@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.