Page MenuHomeFreeBSD

df: Cleanup and refactor
Needs ReviewPublic

Authored by jlduran on Jan 2 2026, 7:56 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 20, 3:11 AM
Unknown Object (File)
Thu, Mar 19, 12:24 AM
Unknown Object (File)
Wed, Mar 18, 4:21 AM
Unknown Object (File)
Wed, Mar 18, 3:21 AM
Unknown Object (File)
Tue, Mar 17, 6:33 AM
Unknown Object (File)
Thu, Mar 12, 1:13 PM
Unknown Object (File)
Thu, Mar 12, 5:18 AM
Unknown Object (File)
Wed, Mar 11, 11:46 AM
Subscribers

Details

Reviewers
des
Summary

Improve code style and type safety:

  • Change boolean flags from int to bool type for clarity
  • Given sys/param.h is already included, use the MAX() macro it provides
  • Update variable types from int to size_t
  • Adjust string comparison logic for better readability
  • Add --libxo to usage message
  • Various style(9) fixes

No functional changes intended.

Suggested by: des

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

  • Remove stray reference to availheader
jlduran marked 8 inline comments as done.
jlduran edited the summary of this revision. (Show Details)

Address suggestions

bin/df/df.c
37–41
83–87

these should all be bool, you'll have to change makevfslist() and checkvfsname() to suit.

163–164

I'm not sure lflag is actually needed, we can just check whether vfslist_l is null like we do for vfslist_t.

294–296

this lets you drop the cast in the malloc() call below

308
309–310

this should be fatal, imo

368

should mntsize be size_t?

369–372
490–494
611–614

actually I was mistaken, I missed that the if above used <= instead of <... either revert this or change the if (and update the comment).

jlduran marked 9 inline comments as done.
jlduran edited the summary of this revision. (Show Details)

Address suggestions.

bin/df/df.c
309–310

Will be addressed in a separate revision, as it is a functional change.

jlduran marked an inline comment as done.
jlduran added inline comments.
jlduran edited the summary of this revision. (Show Details)
  • Add --libxo to usage message