Page MenuHomeFreeBSD

df: Cleanup and refactor
Needs ReviewPublic

Authored by jlduran on Jan 2 2026, 7:56 PM.
Tags
None
Referenced Files
F167318099: D54457.id173083.diff
Thu, Aug 20, 9:07 PM
F167296032: D54457.id168931.diff
Thu, Aug 20, 6:07 PM
F167293348: D54457.id172973.diff
Thu, Aug 20, 5:37 PM
F167272960: D54457.id168896.diff
Thu, Aug 20, 1:51 PM
F167269418: D54457.id172986.diff
Thu, Aug 20, 1:11 PM
Unknown Object (File)
Wed, Aug 19, 9:56 PM
Unknown Object (File)
Wed, Aug 19, 4:01 PM
Unknown Object (File)
Tue, Aug 18, 9:02 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