+ coda-change-codas-user-api-to-use-64-bit-time_t-in-timespec.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: coda: change Coda's user api to use 64-bit time_t in timespec
has been added to the -mm tree.  Its filename is
     coda-change-codas-user-api-to-use-64-bit-time_t-in-timespec.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/coda-change-codas-user-api-to-use-64-bit-time_t-in-timespec.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/coda-change-codas-user-api-to-use-64-bit-time_t-in-timespec.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Jan Harkes <jaharkes@xxxxxxxxxx>
Subject: coda: change Coda's user api to use 64-bit time_t in timespec

Move the 32-bit time_t problems to userspace.

Link: http://lkml.kernel.org/r/8d089068823bfb292a4020f773922fbd82ffad39.1558117389.git.jaharkes@xxxxxxxxxx
Signed-off-by: Jan Harkes <jaharkes@xxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Cc: David Howells <dhowells@xxxxxxxxxx>
Cc: Fabian Frederick <fabf@xxxxxxxxx>
Cc: Mikko Rapeli <mikko.rapeli@xxxxxx>
Cc: Sam Protsenko <semen.protsenko@xxxxxxxxxx>
Cc: Yann Droneaud <ydroneaud@xxxxxxxxxx>
Cc: Zhouyang Jia <jiazhouyang09@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 Documentation/filesystems/coda.txt |   10 ++++----
 fs/coda/coda_linux.c               |   21 +++++------------
 include/uapi/linux/coda.h          |   33 +++++----------------------
 3 files changed, 19 insertions(+), 45 deletions(-)

--- a/Documentation/filesystems/coda.txt~coda-change-codas-user-api-to-use-64-bit-time_t-in-timespec
+++ a/Documentation/filesystems/coda.txt
@@ -481,8 +481,8 @@ kernel support.
 
 
 
-  struct vtimespec {
-          long            tv_sec;         /* seconds */
+  struct coda_timespec {
+          int64_t         tv_sec;         /* seconds */
           long            tv_nsec;        /* nanoseconds */
   };
 
@@ -496,9 +496,9 @@ kernel support.
           long            va_fileid;      /* file id */
           u_quad_t        va_size;        /* file size in bytes */
           long            va_blocksize;   /* blocksize preferred for i/o */
-          struct vtimespec va_atime;      /* time of last access */
-          struct vtimespec va_mtime;      /* time of last modification */
-          struct vtimespec va_ctime;      /* time file changed */
+          struct coda_timespec va_atime;  /* time of last access */
+          struct coda_timespec va_mtime;  /* time of last modification */
+          struct coda_timespec va_ctime;  /* time file changed */
           u_long          va_gen;         /* generation number of file */
           u_long          va_flags;       /* flags defined for file */
           dev_t           va_rdev;        /* device special file represents */
--- a/fs/coda/coda_linux.c~coda-change-codas-user-api-to-use-64-bit-time_t-in-timespec
+++ a/fs/coda/coda_linux.c
@@ -66,13 +66,8 @@ unsigned short coda_flags_to_cflags(unsi
 	return coda_flags;
 }
 
-static struct timespec64 coda_to_timespec64(struct vtimespec ts)
+static struct timespec64 coda_to_timespec64(struct coda_timespec ts)
 {
-	/*
-	 * We interpret incoming timestamps as 'signed' to match traditional
-	 * usage and support pre-1970 timestamps, but this breaks in y2038
-	 * on 32-bit machines.
-	 */
 	struct timespec64 ts64 = {
 		.tv_sec = ts.tv_sec,
 		.tv_nsec = ts.tv_nsec,
@@ -81,12 +76,10 @@ static struct timespec64 coda_to_timespe
 	return ts64;
 }
 
-static struct vtimespec timespec64_to_coda(struct timespec64 ts64)
+static struct coda_timespec timespec64_to_coda(struct timespec64 ts64)
 {
-	/* clamp the timestamps to the maximum range rather than wrapping */
-	struct vtimespec ts = {
-		.tv_sec = lower_32_bits(clamp_t(time64_t, ts64.tv_sec,
-						LONG_MIN, LONG_MAX)),
+	struct coda_timespec ts = {
+		.tv_sec = ts64.tv_sec,
 		.tv_nsec = ts64.tv_nsec,
 	};
 
@@ -156,11 +149,11 @@ void coda_iattr_to_vattr(struct iattr *i
         vattr->va_uid = (vuid_t) -1; 
         vattr->va_gid = (vgid_t) -1;
         vattr->va_size = (off_t) -1;
-	vattr->va_atime.tv_sec = (long) -1;
+	vattr->va_atime.tv_sec = (int64_t) -1;
 	vattr->va_atime.tv_nsec = (long) -1;
-	vattr->va_mtime.tv_sec = (long) -1;
+	vattr->va_mtime.tv_sec = (int64_t) -1;
 	vattr->va_mtime.tv_nsec = (long) -1;
-	vattr->va_ctime.tv_sec = (long) -1;
+	vattr->va_ctime.tv_sec = (int64_t) -1;
 	vattr->va_ctime.tv_nsec = (long) -1;
         vattr->va_type = C_VNON;
 	vattr->va_fileid = -1;
--- a/include/uapi/linux/coda.h~coda-change-codas-user-api-to-use-64-bit-time_t-in-timespec
+++ a/include/uapi/linux/coda.h
@@ -86,10 +86,6 @@ typedef unsigned long long u_quad_t;
 
 #define inline
 
-struct timespec {
-        long       ts_sec;
-        long       ts_nsec;
-};
 #else  /* DJGPP but not KERNEL */
 #include <sys/time.h>
 typedef unsigned long long u_quad_t;
@@ -110,13 +106,6 @@ typedef unsigned long long u_quad_t;
 #define cdev_t dev_t
 #endif
 
-#ifdef __CYGWIN32__
-struct timespec {
-        time_t  tv_sec;         /* seconds */
-        long    tv_nsec;        /* nanoseconds */
-};
-#endif
-
 #ifndef __BIT_TYPES_DEFINED__
 #define __BIT_TYPES_DEFINED__
 typedef signed char	      int8_t;
@@ -211,19 +200,10 @@ struct CodaFid {
  */
 enum coda_vtype	{ C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
 
-#ifdef __linux__
-/*
- * This matches the traditional Linux 'timespec' structure binary layout,
- * before using 64-bit time_t everywhere. Overflows in y2038 on 32-bit
- * architectures.
- */
-struct vtimespec {
-	long		tv_sec;		/* seconds */
+struct coda_timespec {
+	int64_t		tv_sec;		/* seconds */
 	long		tv_nsec;	/* nanoseconds */
 };
-#else
-#define vtimespec timespec
-#endif
 
 struct coda_vattr {
 	long     	va_type;	/* vnode type (for create) */
@@ -234,9 +214,9 @@ struct coda_vattr {
 	long		va_fileid;	/* file id */
 	u_quad_t	va_size;	/* file size in bytes */
 	long		va_blocksize;	/* blocksize preferred for i/o */
-	struct vtimespec va_atime;	/* time of last access */
-	struct vtimespec va_mtime;	/* time of last modification */
-	struct vtimespec va_ctime;	/* time file changed */
+	struct coda_timespec va_atime;	/* time of last access */
+	struct coda_timespec va_mtime;	/* time of last modification */
+	struct coda_timespec va_ctime;	/* time file changed */
 	u_long		va_gen;		/* generation number of file */
 	u_long		va_flags;	/* flags defined for file */
 	cdev_t	        va_rdev;	/* device special file represents */
@@ -301,7 +281,8 @@ struct coda_statfs {
 
 #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
 
-#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
+//      CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
+#define CODA_KERNEL_VERSION 4 /* 64-bit timespec */
 
 /*
  *        Venus <-> Coda  RPC arguments
_

Patches currently in -mm which might be from jaharkes@xxxxxxxxxx are

coda-pass-the-host-file-in-vma-vm_file-on-mmap.patch
coda-potential-buffer-overflow-in-coda_psdev_write.patch
coda-dont-try-to-print-names-that-were-considered-too-long.patch
uapi-linux-coda_psdevh-move-coda_req_-from-uapi-to-kernel-side-headers.patch
coda-change-codas-user-api-to-use-64-bit-time_t-in-timespec.patch
coda-bump-module-version.patch
coda-remove-uapi-linux-coda_psdevh.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux