Thread (23 messages) 23 messages, 4 authors, 2018-12-18

Re: [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2018-12-12 15:36:04
Also in: linux-alpha, linux-rdma, lkml, sparclinux

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 */
        }
   }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help