aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph/decode.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ceph/decode.h')
-rw-r--r--include/linux/ceph/decode.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index d143ac8879c6..a6c2a48d42e0 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -194,16 +194,22 @@ ceph_decode_skip_n(p, end, sizeof(u8), bad)
194 } while (0) 194 } while (0)
195 195
196/* 196/*
197 * struct ceph_timespec <-> struct timespec 197 * struct ceph_timespec <-> struct timespec64
198 */ 198 */
199static inline void ceph_decode_timespec(struct timespec *ts, 199static inline void ceph_decode_timespec64(struct timespec64 *ts,
200 const struct ceph_timespec *tv) 200 const struct ceph_timespec *tv)
201{ 201{
202 ts->tv_sec = (__kernel_time_t)le32_to_cpu(tv->tv_sec); 202 /*
203 * This will still overflow in year 2106. We could extend
204 * the protocol to steal two more bits from tv_nsec to
205 * add three more 136 year epochs after that the way ext4
206 * does if necessary.
207 */
208 ts->tv_sec = (time64_t)le32_to_cpu(tv->tv_sec);
203 ts->tv_nsec = (long)le32_to_cpu(tv->tv_nsec); 209 ts->tv_nsec = (long)le32_to_cpu(tv->tv_nsec);
204} 210}
205static inline void ceph_encode_timespec(struct ceph_timespec *tv, 211static inline void ceph_encode_timespec64(struct ceph_timespec *tv,
206 const struct timespec *ts) 212 const struct timespec64 *ts)
207{ 213{
208 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec); 214 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
209 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec); 215 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);