Re: [PATCH v2 6/8] socket: Add SO_TIMESTAMP[NS]_NEW
Willem de Bruijn <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.network,gmane.linux.kernel.year-2038,gmane.linux.ports.alpha,gmane.linux.ports.mips.general,gmane.linux.ports.parisc,gmane.linux.drivers.rdma,gmane.linux.ports.sparc |
|---|---|
| Message-ID | <CAF=yD-J8Ea1ope3ZBgPCufnMxDgGArhqRdvszz44u29BJAPS7w@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 */
}
}