xref: /kernel/linux/linux-5.10/include/linux/time32.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci#ifndef _LINUX_TIME32_H
28c2ecf20Sopenharmony_ci#define _LINUX_TIME32_H
38c2ecf20Sopenharmony_ci/*
48c2ecf20Sopenharmony_ci * These are all interfaces based on the old time_t definition
58c2ecf20Sopenharmony_ci * that overflows in 2038 on 32-bit architectures. New code
68c2ecf20Sopenharmony_ci * should use the replacements based on time64_t and timespec64.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Any interfaces in here that become unused as we migrate
98c2ecf20Sopenharmony_ci * code to time64_t should get removed.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/time64.h>
138c2ecf20Sopenharmony_ci#include <linux/timex.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <vdso/time32.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistruct old_itimerspec32 {
188c2ecf20Sopenharmony_ci	struct old_timespec32 it_interval;
198c2ecf20Sopenharmony_ci	struct old_timespec32 it_value;
208c2ecf20Sopenharmony_ci};
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cistruct old_utimbuf32 {
238c2ecf20Sopenharmony_ci	old_time32_t	actime;
248c2ecf20Sopenharmony_ci	old_time32_t	modtime;
258c2ecf20Sopenharmony_ci};
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistruct old_timex32 {
288c2ecf20Sopenharmony_ci	u32 modes;
298c2ecf20Sopenharmony_ci	s32 offset;
308c2ecf20Sopenharmony_ci	s32 freq;
318c2ecf20Sopenharmony_ci	s32 maxerror;
328c2ecf20Sopenharmony_ci	s32 esterror;
338c2ecf20Sopenharmony_ci	s32 status;
348c2ecf20Sopenharmony_ci	s32 constant;
358c2ecf20Sopenharmony_ci	s32 precision;
368c2ecf20Sopenharmony_ci	s32 tolerance;
378c2ecf20Sopenharmony_ci	struct old_timeval32 time;
388c2ecf20Sopenharmony_ci	s32 tick;
398c2ecf20Sopenharmony_ci	s32 ppsfreq;
408c2ecf20Sopenharmony_ci	s32 jitter;
418c2ecf20Sopenharmony_ci	s32 shift;
428c2ecf20Sopenharmony_ci	s32 stabil;
438c2ecf20Sopenharmony_ci	s32 jitcnt;
448c2ecf20Sopenharmony_ci	s32 calcnt;
458c2ecf20Sopenharmony_ci	s32 errcnt;
468c2ecf20Sopenharmony_ci	s32 stbcnt;
478c2ecf20Sopenharmony_ci	s32 tai;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	s32:32; s32:32; s32:32; s32:32;
508c2ecf20Sopenharmony_ci	s32:32; s32:32; s32:32; s32:32;
518c2ecf20Sopenharmony_ci	s32:32; s32:32; s32:32;
528c2ecf20Sopenharmony_ci};
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciextern int get_old_timespec32(struct timespec64 *, const void __user *);
558c2ecf20Sopenharmony_ciextern int put_old_timespec32(const struct timespec64 *, void __user *);
568c2ecf20Sopenharmony_ciextern int get_old_itimerspec32(struct itimerspec64 *its,
578c2ecf20Sopenharmony_ci			const struct old_itimerspec32 __user *uits);
588c2ecf20Sopenharmony_ciextern int put_old_itimerspec32(const struct itimerspec64 *its,
598c2ecf20Sopenharmony_ci			struct old_itimerspec32 __user *uits);
608c2ecf20Sopenharmony_cistruct __kernel_timex;
618c2ecf20Sopenharmony_ciint get_old_timex32(struct __kernel_timex *, const struct old_timex32 __user *);
628c2ecf20Sopenharmony_ciint put_old_timex32(struct old_timex32 __user *, const struct __kernel_timex *);
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/**
658c2ecf20Sopenharmony_ci * ns_to_kernel_old_timeval - Convert nanoseconds to timeval
668c2ecf20Sopenharmony_ci * @nsec:	the nanoseconds value to be converted
678c2ecf20Sopenharmony_ci *
688c2ecf20Sopenharmony_ci * Returns the timeval representation of the nsec parameter.
698c2ecf20Sopenharmony_ci */
708c2ecf20Sopenharmony_ciextern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec);
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#endif
73