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)
Sun, Apr 12, 7:12 PM
Unknown Object (File)
Sat, Apr 11, 1:49 AM
Unknown Object (File)
Fri, Apr 10, 10:46 AM
Unknown Object (File)
Wed, Apr 8, 9:47 AM
Unknown Object (File)
Wed, Apr 8, 5:03 AM
Unknown Object (File)
Tue, Apr 7, 10:50 AM
Unknown Object (File)
Mon, Apr 6, 5:01 PM
Unknown Object (File)
Mon, Apr 6, 4:38 PM
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
38–41
86–87

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

163

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

295–296

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

308
309–310

this should be fatal, imo

369

should mntsize be size_t?

371–372
493–496
614–617

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