X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Finclude%2Flustre_compat.h;h=9bb08dd7e93766cb30f82776db3c936b7e1511df;hp=237d7b81647d37c25617ec6d29a118bcd9ad2109;hb=3442db6faf685fbdbd092bdfdc8d273e4990a141;hpb=11aae875be5fb30a88281ab47e491b75447b299b diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index 237d7b8..9bb08dd 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -651,4 +651,22 @@ static inline struct timespec current_time(struct inode *inode) } #endif +#ifndef time_after32 +/** + * time_after32 - compare two 32-bit relative times + * @a: the time which may be after @b + * @b: the time which may be before @a + * + * time_after32(a, b) returns true if the time @a is after time @b. + * time_before32(b, a) returns true if the time @b is before time @a. + * + * Similar to time_after(), compare two 32-bit timestamps for relative + * times. This is useful for comparing 32-bit seconds values that can't + * be converted to 64-bit values (e.g. due to disk format or wire protocol + * issues) when it is known that the times are less than 68 years apart. + */ +#define time_after32(a, b) ((s32)((u32)(b) - (u32)(a)) < 0) +#define time_before32(b, a) time_after32(a, b) +#endif + #endif /* _LUSTRE_COMPAT_H */