Page MenuHomeFreeBSD

df: ceil() the percentage value
Needs ReviewPublic

Authored by jlduran on Wed, Dec 17, 4:51 AM.
Tags
None
Referenced Files
F139971952: D54264.id168244.diff
Thu, Dec 18, 1:21 PM
F139969113: D54264.id168244.diff
Thu, Dec 18, 12:39 PM
F139961973: D54264.id.diff
Thu, Dec 18, 10:48 AM
F139918996: D54264.diff
Thu, Dec 18, 12:27 AM
F139895193: D54264.diff
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

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.