diff options
author | Namjae Jeon <[email protected]> | 2021-03-30 14:56:26 +0900 |
---|---|---|
committer | Steve French <[email protected]> | 2021-05-10 19:15:30 -0500 |
commit | a648d8aff84beedaff6302df47a947a56533ec41 (patch) | |
tree | 671004be9dbeea295b428a8deab3aea011d5185c | |
parent | 64b39f4a2fd293cf899dd8062c57ce3715dd7ee9 (diff) |
cifsd: merge time_wrappers.h into smb_common.h
This patch merge time_wrappers.h into smb_common.h.
Signed-off-by: Namjae Jeon <[email protected]>
Signed-off-by: Steve French <[email protected]>
-rw-r--r-- | fs/cifsd/netmisc.c | 17 | ||||
-rw-r--r-- | fs/cifsd/smb2pdu.c | 1 | ||||
-rw-r--r-- | fs/cifsd/smb_common.h | 6 | ||||
-rw-r--r-- | fs/cifsd/time_wrappers.h | 34 | ||||
-rw-r--r-- | fs/cifsd/vfs.c | 1 |
5 files changed, 22 insertions, 37 deletions
diff --git a/fs/cifsd/netmisc.c b/fs/cifsd/netmisc.c index 55393667abcc..5d0327d87397 100644 --- a/fs/cifsd/netmisc.c +++ b/fs/cifsd/netmisc.c @@ -10,7 +10,7 @@ #include "glob.h" #include "smberr.h" #include "nterr.h" -#include "time_wrappers.h" +#include "smb_common.h" /* * Convert the NT UTC (based 1601-01-01, in hundred nanosecond units) @@ -42,3 +42,18 @@ struct timespec64 ksmbd_NTtimeToUnix(__le64 ntutc) return ts; } + +/* Convert the Unix UTC into NT UTC. */ +inline u64 ksmbd_UnixTimeToNT(struct timespec64 t) +{ + /* Convert to 100ns intervals and then add the NTFS time offset. */ + return (u64)t.tv_sec * 10000000 + t.tv_nsec / 100 + NTFS_TIME_OFFSET; +} + +inline long long ksmbd_systime(void) +{ + struct timespec64 ts; + + ktime_get_real_ts64(&ts); + return ksmbd_UnixTimeToNT(ts); +} diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c index 3e8f1a3800dd..139041768f65 100644 --- a/fs/cifsd/smb2pdu.c +++ b/fs/cifsd/smb2pdu.c @@ -26,7 +26,6 @@ #include "vfs_cache.h" #include "misc.h" -#include "time_wrappers.h" #include "server.h" #include "smb_common.h" #include "smbstatus.h" diff --git a/fs/cifsd/smb_common.h b/fs/cifsd/smb_common.h index 2d7b1c693ff4..2e171c9002b2 100644 --- a/fs/cifsd/smb_common.h +++ b/fs/cifsd/smb_common.h @@ -541,4 +541,10 @@ static inline void inc_rfc1001_len(void *buf, int count) { be32_add_cpu((__be32 *)buf, count); } + +#define NTFS_TIME_OFFSET ((u64)(369 * 365 + 89) * 24 * 3600 * 10000000) + +struct timespec64 ksmbd_NTtimeToUnix(__le64 ntutc); +u64 ksmbd_UnixTimeToNT(struct timespec64 t); +long long ksmbd_systime(void); #endif /* __SMB_COMMON_H__ */ diff --git a/fs/cifsd/time_wrappers.h b/fs/cifsd/time_wrappers.h deleted file mode 100644 index 31bea2058f88..000000000000 --- a/fs/cifsd/time_wrappers.h +++ /dev/null @@ -1,34 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2019 Samsung Electronics Co., Ltd. - */ - -#ifndef __KSMBD_TIME_WRAPPERS_H -#define __KSMBD_TIME_WRAPPERS_H - -/* - * A bunch of ugly hacks to workaoround all the API differences - * between different kernel versions. - */ - -#define NTFS_TIME_OFFSET ((u64)(369 * 365 + 89) * 24 * 3600 * 10000000) - -/* Convert the Unix UTC into NT UTC. */ -static inline u64 ksmbd_UnixTimeToNT(struct timespec64 t) -{ - /* Convert to 100ns intervals and then add the NTFS time offset. */ - return (u64)t.tv_sec * 10000000 + t.tv_nsec / 100 + NTFS_TIME_OFFSET; -} - -struct timespec64 ksmbd_NTtimeToUnix(__le64 ntutc); - -#define KSMBD_TIME_TO_TM time64_to_tm - -static inline long long ksmbd_systime(void) -{ - struct timespec64 ts; - - ktime_get_real_ts64(&ts); - return ksmbd_UnixTimeToNT(ts); -} -#endif /* __KSMBD_TIME_WRAPPERS_H */ diff --git a/fs/cifsd/vfs.c b/fs/cifsd/vfs.c index 69dc1ee0fc75..264f8932d40f 100644 --- a/fs/cifsd/vfs.c +++ b/fs/cifsd/vfs.c @@ -31,7 +31,6 @@ #include "ndr.h" #include "auth.h" -#include "time_wrappers.h" #include "smb_common.h" #include "mgmt/share_config.h" #include "mgmt/tree_connect.h" |