lkml.org 
[lkml]   [2018]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW
> 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 */
}
}

\
 
 \ /
  Last update: 2018-12-12 16:37    [W:0.069 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site