]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/timekeeping32.h
ceph: quota: add initial infrastructure to support cephfs quotas
[mirror_ubuntu-bionic-kernel.git] / include / linux / timekeeping32.h
1 #ifndef _LINUX_TIMEKEEPING32_H
2 #define _LINUX_TIMEKEEPING32_H
3 /*
4 * These interfaces are all based on the old timespec type
5 * and should get replaced with the timespec64 based versions
6 * over time so we can remove the file here.
7 */
8
9 extern void do_gettimeofday(struct timeval *tv);
10 unsigned long get_seconds(void);
11
12 /* does not take xtime_lock */
13 struct timespec __current_kernel_time(void);
14
15 static inline struct timespec current_kernel_time(void)
16 {
17 struct timespec64 now = current_kernel_time64();
18
19 return timespec64_to_timespec(now);
20 }
21
22 #if BITS_PER_LONG == 64
23 /**
24 * Deprecated. Use do_settimeofday64().
25 */
26 static inline int do_settimeofday(const struct timespec *ts)
27 {
28 return do_settimeofday64(ts);
29 }
30
31 static inline int __getnstimeofday(struct timespec *ts)
32 {
33 return __getnstimeofday64(ts);
34 }
35
36 static inline void getnstimeofday(struct timespec *ts)
37 {
38 getnstimeofday64(ts);
39 }
40
41 static inline void ktime_get_ts(struct timespec *ts)
42 {
43 ktime_get_ts64(ts);
44 }
45
46 static inline void ktime_get_real_ts(struct timespec *ts)
47 {
48 getnstimeofday64(ts);
49 }
50
51 static inline void getrawmonotonic(struct timespec *ts)
52 {
53 getrawmonotonic64(ts);
54 }
55
56 static inline struct timespec get_monotonic_coarse(void)
57 {
58 return get_monotonic_coarse64();
59 }
60
61 static inline void getboottime(struct timespec *ts)
62 {
63 return getboottime64(ts);
64 }
65 #else
66 /**
67 * Deprecated. Use do_settimeofday64().
68 */
69 static inline int do_settimeofday(const struct timespec *ts)
70 {
71 struct timespec64 ts64;
72
73 ts64 = timespec_to_timespec64(*ts);
74 return do_settimeofday64(&ts64);
75 }
76
77 static inline int __getnstimeofday(struct timespec *ts)
78 {
79 struct timespec64 ts64;
80 int ret = __getnstimeofday64(&ts64);
81
82 *ts = timespec64_to_timespec(ts64);
83 return ret;
84 }
85
86 static inline void getnstimeofday(struct timespec *ts)
87 {
88 struct timespec64 ts64;
89
90 getnstimeofday64(&ts64);
91 *ts = timespec64_to_timespec(ts64);
92 }
93
94 static inline void ktime_get_ts(struct timespec *ts)
95 {
96 struct timespec64 ts64;
97
98 ktime_get_ts64(&ts64);
99 *ts = timespec64_to_timespec(ts64);
100 }
101
102 static inline void ktime_get_real_ts(struct timespec *ts)
103 {
104 struct timespec64 ts64;
105
106 getnstimeofday64(&ts64);
107 *ts = timespec64_to_timespec(ts64);
108 }
109
110 static inline void getrawmonotonic(struct timespec *ts)
111 {
112 struct timespec64 ts64;
113
114 getrawmonotonic64(&ts64);
115 *ts = timespec64_to_timespec(ts64);
116 }
117
118 static inline struct timespec get_monotonic_coarse(void)
119 {
120 return timespec64_to_timespec(get_monotonic_coarse64());
121 }
122
123 static inline void getboottime(struct timespec *ts)
124 {
125 struct timespec64 ts64;
126
127 getboottime64(&ts64);
128 *ts = timespec64_to_timespec(ts64);
129 }
130 #endif
131
132 /*
133 * Timespec interfaces utilizing the ktime based ones
134 */
135 static inline void get_monotonic_boottime(struct timespec *ts)
136 {
137 *ts = ktime_to_timespec(ktime_get_boottime());
138 }
139
140 static inline void timekeeping_clocktai(struct timespec *ts)
141 {
142 *ts = ktime_to_timespec(ktime_get_clocktai());
143 }
144
145 /*
146 * Persistent clock related interfaces
147 */
148 extern void read_persistent_clock(struct timespec *ts);
149 extern int update_persistent_clock(struct timespec now);
150
151 #endif