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)
Jan 22 2026, 10:51 PM
Unknown Object (File)
Jan 20 2026, 9:05 AM
Unknown Object (File)
Jan 19 2026, 9:10 PM
Unknown Object (File)
Jan 17 2026, 7:38 PM
Unknown Object (File)
Jan 16 2026, 7:11 PM
Unknown Object (File)
Jan 14 2026, 11:26 AM
Unknown Object (File)
Jan 11 2026, 9:46 PM
Unknown Object (File)
Jan 9 2026, 8:25 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
  • 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.