All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	LKML <linux-kernel@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	y2038 Mailman List <y2038@lists.linaro.org>,
	jejb@parisc-linux.org, ralf@linux-mips.org, rth@twiddle.net,
	linux-alpha@vger.kernel.org, linux-mips@linux-mips.org,
	linux-parisc@vger.kernel.org, linux-rdma@vger.kernel.org,
	sparclinux@vger.kernel.org
Subject: Re: [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW
Date: Wed, 12 Dec 2018 10:35:23 -0500	[thread overview]
Message-ID: <CAF=yD-J8Ea1ope3ZBgPCufnMxDgGArhqRdvszz44u29BJAPS7w@mail.gmail.com> (raw)
In-Reply-To: <CAF=yD-LDWrjxK+XFv-KNAoyP7NCOZiL00n5PkzQ-5aEzq+eCLQ@mail.gmail.com>

> This did not address yet the previous comments on consistency and
> unnecessary code churn.
>
> The existing logic to differentiate SO_TIMESTAMP from SO_TIMESTAMPNS
> in both tcp_recv_timestamp and __sock_recv_timestamp is
>
>   if (sock_flag(sk, SOCK_RCVTSTAMP)) {
>       if (sock_flag(sk, SOCK_RCVTSTAMPNS))
>           /* timespec case */
>       else
>           /* timeval case */
>   }
>
> A new level of nesting needs to be added to differentiate .._OLD from .._NEW.
>
> Even if massively changing the original functions, please do so
> consistently, either
>
>   if (sock_flag(sk, SOCK_RCVTSTAMP)) {
>       if (sock_flag(sk, SOCK_TSTAMP_NEW) {
>           /* new code */
>       } else {
>           if (sock_flag(sk, SOCK_RCVTSTAMPNS))
>               /* timespec case */
>           else
>               /* timeval case */
>      }
>   }

This first example is wrong. I meant

   if (sock_flag(sk, SOCK_RCVTSTAMP)) {
       if (sock_flag(sk, SOCK_RCVTSTAMPNS)) {
           if (sock_flag(sk, SOCK_TSTAMP_NEW)
                /* new code */
          else
                /* timespec case */
       } else {
           if (sock_flag(sk, SOCK_TSTAMP_NEW)
                /* new code */
          else
                /* timeval case */
        }
   }

WARNING: multiple messages have this Message-ID (diff)
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	LKML <linux-kernel@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	y2038 Mailman List <y2038@lists.linaro.org>,
	jejb@parisc-linux.org, ralf@linux-mips.org, rth@twiddle.net,
	linux-alpha@vger.kernel.org, linux-mips@linux-mips.org,
	linux-parisc@vger.kernel.org, linux-rdma@vger.kernel.org,
	sparclinux@vger.kernel.org
Subject: Re: [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW
Date: Wed, 12 Dec 2018 15:35:23 +0000	[thread overview]
Message-ID: <CAF=yD-J8Ea1ope3ZBgPCufnMxDgGArhqRdvszz44u29BJAPS7w@mail.gmail.com> (raw)
In-Reply-To: <CAF=yD-LDWrjxK+XFv-KNAoyP7NCOZiL00n5PkzQ-5aEzq+eCLQ@mail.gmail.com>

> This did not address yet the previous comments on consistency and
> unnecessary code churn.
>
> The existing logic to differentiate SO_TIMESTAMP from SO_TIMESTAMPNS
> in both tcp_recv_timestamp and __sock_recv_timestamp is
>
>   if (sock_flag(sk, SOCK_RCVTSTAMP)) {
>       if (sock_flag(sk, SOCK_RCVTSTAMPNS))
>           /* timespec case */
>       else
>           /* timeval case */
>   }
>
> A new level of nesting needs to be added to differentiate .._OLD from .._NEW.
>
> Even if massively changing the original functions, please do so
> consistently, either
>
>   if (sock_flag(sk, SOCK_RCVTSTAMP)) {
>       if (sock_flag(sk, SOCK_TSTAMP_NEW) {
>           /* new code */
>       } else {
>           if (sock_flag(sk, SOCK_RCVTSTAMPNS))
>               /* timespec case */
>           else
>               /* timeval case */
>      }
>   }

This first example is wrong. I meant

   if (sock_flag(sk, SOCK_RCVTSTAMP)) {
       if (sock_flag(sk, SOCK_RCVTSTAMPNS)) {
           if (sock_flag(sk, SOCK_TSTAMP_NEW)
                /* new code */
          else
                /* timespec case */
       } else {
           if (sock_flag(sk, SOCK_TSTAMP_NEW)
                /* new code */
          else
                /* timeval case */
        }
   }

  reply	other threads:[~2018-12-12 15:35 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 20:25 [PATCH v2 0/8] net: y2038-safe socket timestamps Deepa Dinamani
2018-12-11 20:25 ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 1/8] arch: Use asm-generic/socket.h when possible Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 2/8] sockopt: Rename SO_TIMESTAMP* to SO_TIMESTAMP*_OLD Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 3/8] arch: sparc: Override struct __kernel_old_timeval Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 4/8] socket: Use old_timeval types for socket timestamps Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 5/8] socket: Add struct __kernel_sock_timeval Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-12 15:22   ` Willem de Bruijn
2018-12-12 15:22     ` Willem de Bruijn
2018-12-12 15:35     ` Willem de Bruijn [this message]
2018-12-12 15:35       ` Willem de Bruijn
2018-12-15  1:07     ` Deepa Dinamani
2018-12-15  1:07       ` Deepa Dinamani
2018-12-15 15:11       ` Willem de Bruijn
2018-12-15 15:11         ` Willem de Bruijn
2018-12-15 16:50         ` Deepa Dinamani
2018-12-15 16:50           ` Deepa Dinamani
2018-12-15 16:50           ` Deepa Dinamani
2018-12-15 18:51           ` Willem de Bruijn
2018-12-15 18:51             ` Willem de Bruijn
2018-12-15 20:56             ` Deepa Dinamani
2018-12-15 20:56               ` Deepa Dinamani
2018-12-18 16:33             ` Arnd Bergmann
2018-12-18 16:33               ` Arnd Bergmann
2018-12-18 21:27               ` Deepa Dinamani
2018-12-18 21:27                 ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 7/8] socket: Add SO_TIMESTAMPING_NEW Deepa Dinamani
2018-12-11 20:25   ` Deepa Dinamani
2018-12-12 15:25   ` Willem de Bruijn
2018-12-12 15:25     ` Willem de Bruijn
2018-12-18 16:16     ` Arnd Bergmann
2018-12-18 16:16       ` Arnd Bergmann
2018-12-18 21:22       ` Deepa Dinamani
2018-12-18 21:22         ` Deepa Dinamani
2018-12-11 20:25 ` [PATCH v2 8/8] socket: Update timestamping Documentation Deepa Dinamani
2018-12-12 15:07   ` Willem de Bruijn
2018-12-14 23:24 ` [PATCH v2 0/8] net: y2038-safe socket timestamps David Miller
2018-12-14 23:24   ` David Miller
2018-12-14 23:24   ` David Miller

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='CAF=yD-J8Ea1ope3ZBgPCufnMxDgGArhqRdvszz44u29BJAPS7w@mail.gmail.com' \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=deepa.kernel@gmail.com \
    --cc=jejb@parisc-linux.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=rth@twiddle.net \
    --cc=sparclinux@vger.kernel.org \
    --cc=y2038@lists.linaro.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.