Message ID | 20191108211323.1806194-4-arnd@arndb.de |
---|---|
State | Accepted |
Commit | 0309f98f2fdc3526317e9bac150ca690f1f94ce6 |
Headers | show |
Series | y2038 cleanups | expand |
Acked-by: Deepa Dinamani <deepa.kernel@gmail.com>
On Fri, Nov 8, 2019 at 10:15 PM Arnd Bergmann <arnd@arndb.de> wrote: > diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h > index 28491dac074b..0cca19670fd2 100644 > --- a/include/uapi/linux/errqueue.h > +++ b/include/uapi/linux/errqueue.h > @@ -37,9 +37,16 @@ struct sock_extended_err { > * The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_* > * communicate network timestamps by passing this struct in a cmsg with > * recvmsg(). See Documentation/networking/timestamping.txt for details. > + * User space sees a timespec definition that matches either > + * __kernel_timespec or __kernel_old_timespec, in the kernel we > + * require two structure definitions to provide both. > */ > struct scm_timestamping { > +#ifdef __KERNEL__ > + struct __kernel_old_timespec ts[3]; > +#else > struct timespec ts[3]; > +#endif > }; The kbuild bot pointed out that the way I sent this series, the use of __kernel_old_timespec causes a build failure, because I introduce this in a separate submission. I'm moving this patch over to the other series, and changing the subject to y2038: socket: use __kernel_old_timespec instead of timespec With the expectation of merging it along with the other core patches. Arnd
diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h index 28491dac074b..0cca19670fd2 100644 --- a/include/uapi/linux/errqueue.h +++ b/include/uapi/linux/errqueue.h @@ -37,9 +37,16 @@ struct sock_extended_err { * The timestamping interfaces SO_TIMESTAMPING, MSG_TSTAMP_* * communicate network timestamps by passing this struct in a cmsg with * recvmsg(). See Documentation/networking/timestamping.txt for details. + * User space sees a timespec definition that matches either + * __kernel_timespec or __kernel_old_timespec, in the kernel we + * require two structure definitions to provide both. */ struct scm_timestamping { +#ifdef __KERNEL__ + struct __kernel_old_timespec ts[3]; +#else struct timespec ts[3]; +#endif }; struct scm_timestamping64 { diff --git a/net/core/scm.c b/net/core/scm.c index 31a38239c92f..dc6fed1f221c 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -268,8 +268,10 @@ void put_cmsg_scm_timestamping(struct msghdr *msg, struct scm_timestamping_inter struct scm_timestamping tss; int i; - for (i = 0; i < ARRAY_SIZE(tss.ts); i++) - tss.ts[i] = timespec64_to_timespec(tss_internal->ts[i]); + for (i = 0; i < ARRAY_SIZE(tss.ts); i++) { + tss.ts[i].tv_sec = tss_internal->ts[i].tv_sec; + tss.ts[i].tv_nsec = tss_internal->ts[i].tv_nsec; + } put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMPING_OLD, sizeof(tss), &tss); }
In order to remove the 'struct timespec' definition and the timespec64_to_timespec() helper function, change over the in-kernel definition of 'struct scm_timestamping' to use the __kernel_old_timespec replacement and open-code the assignment. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- include/uapi/linux/errqueue.h | 7 +++++++ net/core/scm.c | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) -- 2.20.0