Skip to content

Commit

Permalink
Added support for kernel 5.0.
Browse files Browse the repository at this point in the history
'do_gettimeofday' is not available in 5.0 so use ktime_t functions
instead.
  • Loading branch information
pgiri committed Feb 4, 2019
1 parent 5e29f6a commit 939b983
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ndiswrapper/driver/ntoskernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2501,7 +2501,11 @@ struct worker_init_struct {

int ntoskernel_init(void)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
struct timeval now;
#else
ktime_t now;
#endif

spin_lock_init(&dispatcher_lock);
spin_lock_init(&ntoskernel_lock);
Expand All @@ -2521,10 +2525,16 @@ int ntoskernel_init(void)
INIT_WORK(&ntos_work, ntos_work_worker);
wrap_timer_slist.next = NULL;

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
do_gettimeofday(&now);
wrap_ticks_to_boot = TICKS_1601_TO_1970;
wrap_ticks_to_boot += (u64)now.tv_sec * TICKSPERSEC;
wrap_ticks_to_boot += now.tv_usec * 10;
#else
now = ktime_get_real();
wrap_ticks_to_boot = TICKS_1601_TO_1970;
wrap_ticks_to_boot += ktime_to_us(now) * 10;
#endif
wrap_ticks_to_boot -= jiffies * TICKSPERJIFFY;
TRACE2("%llu", wrap_ticks_to_boot);

Expand Down

0 comments on commit 939b983

Please sign in to comment.