static int igb_ptp_settime_i210(struct ptp_clock_info *ptp, const struct timespec *ts) { struct timespec64 ts64; ts64 = timespec_to_timespec64(*ts); return igb_ptp_settime64_i210(ptp, &ts64); }
SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, const struct timespec __user *, tp) { struct timespec64 new_tp64; struct timespec new_tp; if (which_clock != CLOCK_REALTIME) return -EINVAL; if (copy_from_user(&new_tp, tp, sizeof (*tp))) return -EFAULT; new_tp64 = timespec_to_timespec64(new_tp); return do_sys_settimeofday64(&new_tp64, NULL); }
SYSCALL_DEFINE2(clock_getres, const clockid_t, which_clock, struct timespec __user *, tp) { struct timespec rtn_tp = { .tv_sec = 0, .tv_nsec = hrtimer_resolution, }; switch (which_clock) { case CLOCK_REALTIME: case CLOCK_MONOTONIC: case CLOCK_BOOTTIME: if (copy_to_user(tp, &rtn_tp, sizeof(rtn_tp))) return -EFAULT; return 0; default: return -EINVAL; } } SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, const struct timespec __user *, rqtp, struct timespec __user *, rmtp) { struct timespec64 t64; struct timespec t; switch (which_clock) { case CLOCK_REALTIME: case CLOCK_MONOTONIC: case CLOCK_BOOTTIME: if (copy_from_user(&t, rqtp, sizeof (struct timespec))) return -EFAULT; t64 = timespec_to_timespec64(t); if (!timespec64_valid(&t64)) return -EINVAL; return hrtimer_nanosleep(&t64, rmtp, flags & TIMER_ABSTIME ? HRTIMER_MODE_ABS : HRTIMER_MODE_REL, which_clock); default: return -EINVAL; } } #ifdef CONFIG_COMPAT long clock_nanosleep_restart(struct restart_block *restart_block) { return hrtimer_nanosleep_restart(restart_block); }