32-bit systems using 'struct timeval' will break in the year 2038,
in order to avoid that replace the code with more appropriate types.
This patch replaces timeval with 64 bit ktime_t which is y2038 safe.
Since st->timestamp is only interested in seconds, directly using
time64_t here. Function ktime_get_seconds is used since it uses
monotonic instead of real time and thus will not cause overflow.
Signed-off-by: Shraddha Barke <shraddha.6596(a)gmail.com>
---
drivers/block/sx8.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 59c91d4..baadb77 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -23,7 +23,7 @@
#include <linux/workqueue.h>
#include <linux/bitops.h>
#include <linux/delay.h>
-#include <linux/time.h>
+#include <linux/ktime.h>
#include <linux/hdreg.h>
#include <linux/dma-mapping.h>
#include <linux/completion.h>
@@ -671,16 +671,15 @@ static int carm_send_special (struct carm_host *host, carm_sspc_t func)
static unsigned int carm_fill_sync_time(struct carm_host *host,
unsigned int idx, void *mem)
{
- struct timeval tv;
struct carm_msg_sync_time *st = mem;
- do_gettimeofday(&tv);
+ time64_t tv = ktime_get_seconds();
memset(st, 0, sizeof(*st));
st->type = CARM_MSG_MISC;
st->subtype = MISC_SET_TIME;
st->handle = cpu_to_le32(TAG_ENCODE(idx));
- st->timestamp = cpu_to_le32(tv.tv_sec);
+ st->timestamp = cpu_to_le32(tv);
return sizeof(struct carm_msg_sync_time);
}
--
2.1.4
From: Shraddha Barke <shraddha.6596(a)gmail.com>
32-bit systems using 'struct timeval' will break in the year 2038,
in order to avoid that the code should be replaced with appropriate
types. This patch replaces timeval with 64-bit ktime_t which is y2038
safe. Here, time64_t is used directly since mlc->lcv_t is interested
only in seconds.
Signed-off-by: Shraddha Barke <shraddha.6596(a)gmail.com>
---
drivers/input/serio/hil_mlc.c | 8 +++-----
include/linux/hil_mlc.h | 2 +-
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c
index 65605e4..fb297aa 100644
--- a/drivers/input/serio/hil_mlc.c
+++ b/drivers/input/serio/hil_mlc.c
@@ -274,14 +274,12 @@ static int hilse_match(hil_mlc *mlc, int unused)
/* An LCV used to prevent runaway loops, forces 5 second sleep when reset. */
static int hilse_init_lcv(hil_mlc *mlc, int unused)
{
- struct timeval tv;
+ time64_t now = ktime_get_seconds();
- do_gettimeofday(&tv);
-
- if (mlc->lcv && (tv.tv_sec - mlc->lcv_tv.tv_sec) < 5)
+ if (mlc->lcv && (now - mlc->lcv_t) < 5)
return -1;
- mlc->lcv_tv = tv;
+ mlc->lcv_t = now;
mlc->lcv = 0;
return 0;
diff --git a/include/linux/hil_mlc.h b/include/linux/hil_mlc.h
index 394a840..29bb5e3 100644
--- a/include/linux/hil_mlc.h
+++ b/include/linux/hil_mlc.h
@@ -149,7 +149,7 @@ struct hil_mlc {
int ddi; /* Last operational device id */
int lcv; /* LCV to throttle loops */
- struct timeval lcv_tv; /* Time loop was started */
+ time64_t lcv_t; /* Time loop was started */
int di_map[7]; /* Maps below items to live devs */
struct hil_mlc_devinfo di[HIL_MLC_DEVMEM];
--
2.1.4
The first two patches contain the basic framework for the 64 bit time migration
for filesystems.
The next two patches shows how the framework has been adapted to vfs layer and
cifs filesystem.
There might be some minor changes or additions required as I start adapting to
other filesystems.
The change to timestamp conversion functions(to and from unix format to others)
and range checks will be part of a separate series.
Changes since v1:
* move SYSTEM_TIME macros to fs.h
* add 64 bit version of CURRENT_TIME macros.
Deepa Dinamani (4):
vfs: Add 64 bit time support
kernel: time: Add macros and functions to support 64 bit time
vfs: Add support for vfs code to use 64 bit time.
fs: cifs: Add support for cifs to use 64 bit time
fs/attr.c | 14 ++++-----
fs/bad_inode.c | 9 ++++--
fs/binfmt_misc.c | 7 +++--
fs/cifs/cache.c | 16 ++++++----
fs/cifs/cifsencrypt.c | 2 +-
fs/cifs/cifsglob.h | 6 ++--
fs/cifs/cifsproto.h | 7 +++--
fs/cifs/cifssmb.c | 9 ++++--
fs/cifs/file.c | 9 ++++--
fs/cifs/inode.c | 68 +++++++++++++++++++++++++---------------
fs/cifs/netmisc.c | 10 +++---
fs/inode.c | 44 ++++++++++++++++----------
fs/libfs.c | 58 +++++++++++++++++++++++++---------
fs/locks.c | 5 ++-
fs/nsfs.c | 6 +++-
fs/pipe.c | 6 +++-
fs/posix_acl.c | 2 +-
fs/stat.c | 6 ++--
fs/utimes.c | 4 +--
include/linux/fs.h | 85 +++++++++++++++++++++++++++++++++++++++++++-------
include/linux/stat.h | 6 ++--
include/linux/time64.h | 39 +++++++++++++++++++++++
kernel/time/time.c | 65 +++++++++++++++++++++++++++++++++++++-
23 files changed, 366 insertions(+), 117 deletions(-)
--
1.9.1
The first two patches contain the basic framework for the 64 bit time migration
for filesystems.
The next two patches shows how the framework has been adapted to vfs layer and
cifs filesystem.
There might be some minor changes or additions required as I start adapting to
other filesystems.
The change to timestamp conversion functions(to and from unix format to others)
and range checks will be part of a separate series.
Changes since RFC:
* struct inode_time added unconditionally
* uniform use of CONFIG_FS_USES_64BIT_TIME
* struct inode_timespec added
* merged the first two patches in the previous series
Deepa Dinamani (4):
vfs: Add 64 bit time support
kernel: time: Add macros and functions to support 64 bit time
vfs: Add support for vfs code to use 64 bit time.
fs: cifs: Add support for cifs to use 64 bit time
fs/attr.c | 14 +++++-----
fs/bad_inode.c | 9 ++++--
fs/binfmt_misc.c | 7 +++--
fs/cifs/cache.c | 16 +++++++----
fs/cifs/cifsencrypt.c | 2 +-
fs/cifs/cifsglob.h | 6 ++--
fs/cifs/cifsproto.h | 7 +++--
fs/cifs/cifssmb.c | 9 ++++--
fs/cifs/file.c | 9 ++++--
fs/cifs/inode.c | 68 +++++++++++++++++++++++++++++-----------------
fs/cifs/netmisc.c | 10 +++----
fs/inode.c | 44 +++++++++++++++++++-----------
fs/libfs.c | 58 +++++++++++++++++++++++++++++----------
fs/locks.c | 5 ++--
fs/nsfs.c | 6 +++-
fs/pipe.c | 6 +++-
fs/posix_acl.c | 2 +-
fs/stat.c | 6 ++--
fs/utimes.c | 4 +--
include/linux/fs.h | 74 ++++++++++++++++++++++++++++++++++++++++++--------
include/linux/stat.h | 6 ++--
include/linux/time64.h | 43 +++++++++++++++++++++++++++++
kernel/time/time.c | 65 +++++++++++++++++++++++++++++++++++++++++++-
23 files changed, 359 insertions(+), 117 deletions(-)
--
1.9.1
Concerned with migrating the key related structs in security/keys to
use 64-bit time datatypes; and their corresponding system calls and
macros. The patches are highly correlated and should be either accepted
or rejected as a series. However, they were generated in such
a way that they would be independent. This is for the sake of
readability and to avoid the introduction of new warnings while
building the kernel.
Aya Mahfouz (2):
security: keys: migrate structs key and keyring_search_context
security: keys: migrate struct key_preparsed_payload and time_t
variables
include/linux/key-type.h | 2 +-
include/linux/key.h | 6 +++---
security/keys/gc.c | 20 ++++++++++----------
security/keys/internal.h | 8 ++++----
security/keys/key.c | 20 +++++++-------------
security/keys/keyring.c | 16 ++++++++--------
security/keys/permission.c | 3 +--
security/keys/proc.c | 8 ++++----
security/keys/process_keys.c | 2 +-
9 files changed, 39 insertions(+), 46 deletions(-)
--
2.4.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
This is the basic framework for the 64 bit time migration for filesystems.
There might be some changes or additions required as I start adapting to
filesystems.
This gives the basic high level concept so that we can start discussing.
Actual changes to vfs and other file systems will be in a separate
series.
Changes since v1:
* struct inode_time added unconditionally
* uniform use of CONFIG_FS_USES_64BIT_TIME
Deepa Dinamani (4):
fs: vfs: add accessors for inode times
fs: Add new data type for inode times
fs: Add support for 64 bit time
fs: macros and functions support 64 bit time
include/linux/fs.h | 42 +++++++++++++++++++++++++++++++++++-------
include/linux/stat.h | 12 +++++++++---
include/linux/time.h | 2 ++
include/linux/time64.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
kernel/time/time.c | 28 ++++++++++++++++++++++++++++
5 files changed, 124 insertions(+), 10 deletions(-)
--
1.9.1
Hi,
I am new to linux kernel and trying to understand the process of
different git branch to work.
So, if I am not wrong then there are different branch like stable, next,
staging etc. Previously I work with staging branch so if I am making
any changes for drivers/staging I have to work with staging branch like
follow.
git clone
git checkout -t -b staging-testing origin/staging-testing
git chekcout -b MY_LOCAL_BRANCH
not do work and subimt
So, how it work for other source structure, like now I want to make some
for y2038 -> drivers/scsi which branch should I set up and work with,
next/stable/or is there any specific y2038 branch.
Any wiki link or documentation that explain this full process which
branch to work with when making changes to specific directory will be
useful.
Thanks,
Shirish