Rev 5270 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5270 | Rev 6082 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef _LINUX_TIME64_H |
1 | #ifndef _LINUX_TIME64_H |
2 | #define _LINUX_TIME64_H |
2 | #define _LINUX_TIME64_H |
Line 3... | Line 3... | ||
3 | 3 | ||
- | 4 | #include |
|
Line 4... | Line 5... | ||
4 | #include |
5 | #include |
Line 5... | Line 6... | ||
5 | 6 | ||
6 | typedef __s64 time64_t; |
7 | typedef __s64 time64_t; |
7 | 8 | ||
8 | /* |
9 | /* |
9 | * This wants to go into uapi/linux/time.h once we agreed about the |
10 | * This wants to go into uapi/linux/time.h once we agreed about the |
10 | * userspace interfaces. |
11 | * userspace interfaces. |
- | 12 | */ |
|
11 | */ |
13 | #if __BITS_PER_LONG == 64 |
12 | #if __BITS_PER_LONG == 64 |
14 | # define timespec64 timespec |
13 | # define timespec64 timespec |
15 | #define itimerspec64 itimerspec |
14 | #else |
16 | #else |
15 | struct timespec64 { |
17 | struct timespec64 { |
- | 18 | time64_t tv_sec; /* seconds */ |
|
- | 19 | long tv_nsec; /* nanoseconds */ |
|
- | 20 | }; |
|
- | 21 | ||
- | 22 | struct itimerspec64 { |
|
- | 23 | struct timespec64 it_interval; |
|
16 | time64_t tv_sec; /* seconds */ |
24 | struct timespec64 it_value; |
Line 17... | Line 25... | ||
17 | long tv_nsec; /* nanoseconds */ |
25 | }; |
18 | }; |
26 | |
19 | #endif |
27 | #endif |
Line 26... | Line 34... | ||
26 | #define USEC_PER_SEC 1000000L |
34 | #define USEC_PER_SEC 1000000L |
27 | #define NSEC_PER_SEC 1000000000L |
35 | #define NSEC_PER_SEC 1000000000L |
28 | #define FSEC_PER_SEC 1000000000000000LL |
36 | #define FSEC_PER_SEC 1000000000000000LL |
Line 29... | Line 37... | ||
29 | 37 | ||
- | 38 | /* Located here for timespec[64]_valid_strict */ |
|
30 | /* Located here for timespec[64]_valid_strict */ |
39 | #define TIME64_MAX ((s64)~((u64)1 << 63)) |
31 | #define KTIME_MAX ((s64)~((u64)1 << 63)) |
40 | #define KTIME_MAX ((s64)~((u64)1 << 63)) |
Line 32... | Line 41... | ||
32 | #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) |
41 | #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) |
Line 41... | Line 50... | ||
41 | static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) |
50 | static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) |
42 | { |
51 | { |
43 | return ts; |
52 | return ts; |
44 | } |
53 | } |
Line -... | Line 54... | ||
- | 54 | ||
- | 55 | static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64) |
|
- | 56 | { |
|
- | 57 | return *its64; |
|
- | 58 | } |
|
- | 59 | ||
- | 60 | static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its) |
|
- | 61 | { |
|
- | 62 | return *its; |
|
- | 63 | } |
|
45 | 64 | ||
46 | # define timespec64_equal timespec_equal |
65 | # define timespec64_equal timespec_equal |
47 | # define timespec64_compare timespec_compare |
66 | # define timespec64_compare timespec_compare |
48 | # define set_normalized_timespec64 set_normalized_timespec |
67 | # define set_normalized_timespec64 set_normalized_timespec |
49 | # define timespec64_add_safe timespec_add_safe |
68 | # define timespec64_add_safe timespec_add_safe |
Line 73... | Line 92... | ||
73 | ret.tv_sec = ts.tv_sec; |
92 | ret.tv_sec = ts.tv_sec; |
74 | ret.tv_nsec = ts.tv_nsec; |
93 | ret.tv_nsec = ts.tv_nsec; |
75 | return ret; |
94 | return ret; |
76 | } |
95 | } |
Line -... | Line 96... | ||
- | 96 | ||
- | 97 | static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64) |
|
- | 98 | { |
|
- | 99 | struct itimerspec ret; |
|
- | 100 | ||
- | 101 | ret.it_interval = timespec64_to_timespec(its64->it_interval); |
|
- | 102 | ret.it_value = timespec64_to_timespec(its64->it_value); |
|
- | 103 | return ret; |
|
- | 104 | } |
|
- | 105 | ||
- | 106 | static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its) |
|
- | 107 | { |
|
- | 108 | struct itimerspec64 ret; |
|
- | 109 | ||
- | 110 | ret.it_interval = timespec_to_timespec64(its->it_interval); |
|
- | 111 | ret.it_value = timespec_to_timespec64(its->it_value); |
|
- | 112 | return ret; |
|
- | 113 | } |
|
77 | 114 | ||
78 | static inline int timespec64_equal(const struct timespec64 *a, |
115 | static inline int timespec64_equal(const struct timespec64 *a, |
79 | const struct timespec64 *b) |
116 | const struct timespec64 *b) |
80 | { |
117 | { |
81 | return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); |
118 | return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); |