]> git.baikalelectronics.ru Git - kernel.git/commit
jffs2: use unsigned 32-bit timstamps consistently
authorArnd Bergmann <arnd@arndb.de>
Fri, 13 Jul 2018 14:47:17 +0000 (16:47 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Wed, 18 Jul 2018 14:44:01 +0000 (16:44 +0200)
commit4970e21519f90ed7d3d7f6595be32488a0ad0136
treeb9f17331dac2996ae44d43ce37f16ef6e2cf6da6
parent7a58b32ebe95ffed45d88196721bba4f732b3702
jffs2: use unsigned 32-bit timstamps consistently

Most users of jffs2 are 32-bit systems that traditionally only support
timestamps using a 32-bit signed time_t, in the range from years 1902 to
2038. On 64-bit systems, jffs2 however interpreted the same timestamps
as unsigned values, reading back negative times (before 1970) as times
between 2038 and 2106.

Now that Linux supports 64-bit inode timestamps even on 32-bit systems,
let's use the second interpretation everywhere to allow jffs2 to be
used on 32-bit systems beyond 2038 without a fundamental change to the
inode format.

This has a slight risk of regressions, when existing files with timestamps
before 1970 are present in file system images and are now interpreted
as future time stamps. I considered moving the wraparound point a bit,
e.g. to 1960, in order to deal with timestamps that ended up on Dec 31,
1969 due to incorrect timezone handling. However, this would complicate
the implementation unnecessarily, so I went with the simplest possible
method of extending the timestamps.

Writing files with timestamps before 1970 or after 2106 now results
in those times being clamped in the file system.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
fs/jffs2/os-linux.h