Page MenuHomeFreeBSD

df: ceil() the percentage value
Needs ReviewPublic

Authored by jlduran on Wed, Dec 17, 4:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 20, 2:32 PM
Unknown Object (File)
Thu, Dec 18, 8:07 PM
Unknown Object (File)
Thu, Dec 18, 1:21 PM
Unknown Object (File)
Thu, Dec 18, 12:39 PM
Unknown Object (File)
Thu, Dec 18, 10:48 AM
Unknown Object (File)
Thu, Dec 18, 12:27 AM
Unknown Object (File)
Wed, Dec 17, 5:45 PM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

The percentage value shall be expressed as a positive integer, with any
fractional result causing it to be rounded [up] to the next highest
integer.

https://pubs.opengroup.org/onlinepubs/9799919799/utilities/df.html

Use a hand-rolled ceil() equivalent (as long as it doesn't overflow), to
avoid using math.h.

Fix the tests accordingly, they now match the percentage values on
NetBSD.

Also, use the same rounding method for the calculation of used inodes.

Test Plan
$ kyua test
t_df:hflag  ->  passed  [0.009s]
t_df:normal  ->  passed  [0.008s]

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69325
Build 66208: arc lint + arc unit

Event Timeline

jlduran edited the test plan for this revision. (Show Details)
  • Round up the used inodes percentage as well. Although not required by POSIX, it would be odd to just have one percentage rounded up.