Page MenuHomeFreeBSD

Add nsecs_to_jiffies64() and jiffies_to_{nsecs,usecs}().
ClosedPublic

Authored by markj on Jul 8 2017, 7:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 8, 8:57 AM
Unknown Object (File)
Mon, Oct 6, 3:30 AM
Unknown Object (File)
Sun, Sep 21, 5:04 PM
Unknown Object (File)
Sep 10 2025, 11:34 PM
Unknown Object (File)
Aug 14 2025, 4:18 AM
Unknown Object (File)
Jun 29 2025, 3:43 PM
Unknown Object (File)
Jun 27 2025, 7:47 PM
Unknown Object (File)
Jun 20 2025, 5:09 AM
Subscribers

Details

Summary

Fix style in related functions.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/compat/linuxkpi/common/include/linux/jiffies.h
100 ↗(On Diff #30586)

These max checks are not sufficient for very large input values. You should also verify that the multiplication does not exceed 64-bits!

const uint64_t nsec_max = -1ULL / (uint64_t)hz;
if (nsec > nsec_max)
nsec = nsec_max;
114 ↗(On Diff #30586)

passed jiffies argument should be "int" to avoid problems!

  • Address review comments.
sys/compat/linuxkpi/common/include/linux/jiffies.h
99 ↗(On Diff #30612)

Can you add this check to the msecs_to_jiffies and usecs_to_jiffies aswell?

sys/compat/linuxkpi/common/include/linux/jiffies.h
114 ↗(On Diff #30586)

Do you need to cast j to (uint64_t) ??

sys/compat/linuxkpi/common/include/linux/jiffies.h
126 ↗(On Diff #30656)

(uint64_t)(unsigned int)j ???

We don't like negative times??

Same below. Else the patch looks OK.

sys/compat/linuxkpi/common/include/linux/jiffies.h
126 ↗(On Diff #30656)

Sorry, that was stupid. :(

Thanks for the review.

99 ↗(On Diff #30612)

Done.

This revision was automatically updated to reflect the committed changes.