Page MenuHomeFreeBSD

df: Cleanup and refactor
Needs ReviewPublic

Authored by jlduran on Jan 2 2026, 7:56 PM.
Tags
None
Referenced Files
F152849359: D54457.id172986.diff
Fri, Apr 17, 12:15 PM
F152840258: D54457.id172973.diff
Fri, Apr 17, 10:59 AM
Unknown Object (File)
Tue, Apr 14, 4:10 AM
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
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–40
86–87

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

164

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

296–297

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

309
310–311

this should be fatal, imo

370

should mntsize be size_t?

372–373
494–497
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
310–311

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