linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] uapi: Add a new header for time types
@ 2019-02-13  3:26 Deepa Dinamani
  2019-02-13  3:26 ` [PATCH net-next 1/2] time: Add time_types.h Deepa Dinamani
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Deepa Dinamani @ 2019-02-13  3:26 UTC (permalink / raw)
  To: davem, linux-kernel; +Cc: netdev, willemb, tglx, arnd, y2038

The series aims at adding a new time header: time_types.h.  This header
is what will eventually hold all the uapi time types that we plan to
leave across the interfaces after the y2038 cleanup.

The series was discussed with Arnd Bergmann.

The second patch fixes the errqueue.h header, which has a dependency on
these types.

Note that there may be a trivial merge conflict with linux-next
c70a772fda11 ("y2038: remove struct definition redirects").

Deepa Dinamani (2):
  time: Add time_types.h
  errqueue.h: Include time_types.h

 include/uapi/linux/errqueue.h   |  1 +
 include/uapi/linux/time.h       | 36 +----------------------------
 include/uapi/linux/time_types.h | 40 +++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 35 deletions(-)
 create mode 100644 include/uapi/linux/time_types.h

-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] time: Add time_types.h
  2019-02-13  3:26 [PATCH net-next 0/2] uapi: Add a new header for time types Deepa Dinamani
@ 2019-02-13  3:26 ` Deepa Dinamani
  2019-02-13  3:26 ` [PATCH net-next 2/2] errqueue.h: Include time_types.h Deepa Dinamani
  2019-02-14 16:52 ` [PATCH net-next 0/2] uapi: Add a new header for time types David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Deepa Dinamani @ 2019-02-13  3:26 UTC (permalink / raw)
  To: davem, linux-kernel; +Cc: netdev, willemb, tglx, arnd, y2038

sys/time.h is the mandated include for many time related
defines. However, linux/time.h overlaps sys/time.h
significantly and this makes including both from userspace
or one from the other impossible.

This also means that userspace can get away with including
sys/time.h whenever it needs linux/time.h and this is what's
been happening in the user world usually.

But, we have new data types that we plan to use in the uapi time
interfaces also defined in the linux/time.h. But, we are unable
to use these types when sys/time.h is included.

Hence, move the new types to a new header, time_types.h.
We intend to eventually have all the uapi defines that the kernel
uses defined in this header.
Note that the plan is to replace uapi interfaces with timeval to
use __kernel_old_timeval, timespec to use __kernel_old_timespec etc.

Reported-by: Ran Rozenstein <ranro@mellanox.com>
Fixes: 9718475e6908 ("socket: Add SO_TIMESTAMPING_NEW")
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
 include/uapi/linux/time.h       | 36 +----------------------------
 include/uapi/linux/time_types.h | 40 +++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 35 deletions(-)
 create mode 100644 include/uapi/linux/time_types.h

diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h
index b8ad1b86b942..958932effc5e 100644
--- a/include/uapi/linux/time.h
+++ b/include/uapi/linux/time.h
@@ -3,7 +3,7 @@
 #define _UAPI_LINUX_TIME_H
 
 #include <linux/types.h>
-
+#include <linux/time_types.h>
 
 #ifndef _STRUCT_TIMESPEC
 #define _STRUCT_TIMESPEC
@@ -23,7 +23,6 @@ struct timezone {
 	int	tz_dsttime;	/* type of dst correction */
 };
 
-
 /*
  * Names of the interval timers, and structure
  * defining a timer setting:
@@ -42,39 +41,6 @@ struct itimerval {
 	struct timeval it_value;	/* current value */
 };
 
-#ifndef __kernel_timespec
-struct __kernel_timespec {
-	__kernel_time64_t       tv_sec;                 /* seconds */
-	long long               tv_nsec;                /* nanoseconds */
-};
-#endif
-
-#ifndef __kernel_itimerspec
-struct __kernel_itimerspec {
-	struct __kernel_timespec it_interval;    /* timer period */
-	struct __kernel_timespec it_value;       /* timer expiration */
-};
-#endif
-
-/*
- * legacy timeval structure, only embedded in structures that
- * traditionally used 'timeval' to pass time intervals (not absolute
- * times). Do not add new users. If user space fails to compile
- * here, this is probably because it is not y2038 safe and needs to
- * be changed to use another interface.
- */
-#ifndef __kernel_old_timeval
-struct __kernel_old_timeval {
-	__kernel_long_t tv_sec;
-	__kernel_long_t tv_usec;
-};
-#endif
-
-struct __kernel_sock_timeval {
-	__s64 tv_sec;
-	__s64 tv_usec;
-};
-
 /*
  * The IDs of the various system clocks (for POSIX.1b interval timers):
  */
diff --git a/include/uapi/linux/time_types.h b/include/uapi/linux/time_types.h
new file mode 100644
index 000000000000..4a51ca37305b
--- /dev/null
+++ b/include/uapi/linux/time_types.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_TIME_TYPES_H
+#define _UAPI_LINUX_TIME_TYPES_H
+
+#include <linux/types.h>
+
+#ifndef __kernel_timespec
+struct __kernel_timespec {
+	__kernel_time64_t       tv_sec;                 /* seconds */
+	long long               tv_nsec;                /* nanoseconds */
+};
+#endif
+
+#ifndef __kernel_itimerspec 
+struct __kernel_itimerspec {
+	struct __kernel_timespec it_interval;    /* timer period */
+	struct __kernel_timespec it_value;       /* timer expiration */
+};
+#endif
+
+/*
+ * legacy timeval structure, only embedded in structures that
+ * traditionally used 'timeval' to pass time intervals (not absolute
+ * times). Do not add new users. If user space fails to compile
+ * here, this is probably because it is not y2038 safe and needs to
+ * be changed to use another interface.
+ */
+#ifndef __kernel_old_timeval
+struct __kernel_old_timeval {
+	__kernel_long_t tv_sec;
+	__kernel_long_t tv_usec;
+};
+#endif
+
+struct __kernel_sock_timeval {
+	__s64 tv_sec;
+	__s64 tv_usec;
+};
+
+#endif /* _UAPI_LINUX_TIME_TYPES_H */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] errqueue.h: Include time_types.h
  2019-02-13  3:26 [PATCH net-next 0/2] uapi: Add a new header for time types Deepa Dinamani
  2019-02-13  3:26 ` [PATCH net-next 1/2] time: Add time_types.h Deepa Dinamani
@ 2019-02-13  3:26 ` Deepa Dinamani
  2019-02-14 16:52 ` [PATCH net-next 0/2] uapi: Add a new header for time types David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Deepa Dinamani @ 2019-02-13  3:26 UTC (permalink / raw)
  To: davem, linux-kernel; +Cc: netdev, willemb, tglx, arnd, y2038

Now that we have a separate header for struct __kernel_timespec,
include it directly without relying on userspace to do it.

Reported-by: Ran Rozenstein <ranro@mellanox.com>
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
 include/uapi/linux/errqueue.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
index d955b9e32288..28491dac074b 100644
--- a/include/uapi/linux/errqueue.h
+++ b/include/uapi/linux/errqueue.h
@@ -3,6 +3,7 @@
 #define _UAPI_LINUX_ERRQUEUE_H
 
 #include <linux/types.h>
+#include <linux/time_types.h>
 
 struct sock_extended_err {
 	__u32	ee_errno;	
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] uapi: Add a new header for time types
  2019-02-13  3:26 [PATCH net-next 0/2] uapi: Add a new header for time types Deepa Dinamani
  2019-02-13  3:26 ` [PATCH net-next 1/2] time: Add time_types.h Deepa Dinamani
  2019-02-13  3:26 ` [PATCH net-next 2/2] errqueue.h: Include time_types.h Deepa Dinamani
@ 2019-02-14 16:52 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-02-14 16:52 UTC (permalink / raw)
  To: deepa.kernel; +Cc: linux-kernel, netdev, willemb, tglx, arnd, y2038

From: Deepa Dinamani <deepa.kernel@gmail.com>
Date: Tue, 12 Feb 2019 19:26:02 -0800

> The series aims at adding a new time header: time_types.h.  This header
> is what will eventually hold all the uapi time types that we plan to
> leave across the interfaces after the y2038 cleanup.
> 
> The series was discussed with Arnd Bergmann.
> 
> The second patch fixes the errqueue.h header, which has a dependency on
> these types.
> 
> Note that there may be a trivial merge conflict with linux-next
> c70a772fda11 ("y2038: remove struct definition redirects").

Series applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-14 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13  3:26 [PATCH net-next 0/2] uapi: Add a new header for time types Deepa Dinamani
2019-02-13  3:26 ` [PATCH net-next 1/2] time: Add time_types.h Deepa Dinamani
2019-02-13  3:26 ` [PATCH net-next 2/2] errqueue.h: Include time_types.h Deepa Dinamani
2019-02-14 16:52 ` [PATCH net-next 0/2] uapi: Add a new header for time types David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).