Page MenuHomeFreeBSD

Fix getfsstat(2) handling of flags.
ClosedPublic

Authored by trasz on Oct 28 2016, 1:34 PM.

Details

Summary

Fix getfsstat(2) handling of flags. The 'flags' argument is an enum,
not a bitfield. For the intended usage - being passed either MNT_WAIT,
or MNT_NOWAIT - this shouldn't introduce any changes in behaviour.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

trasz retitled this revision from to Fix getfsstat(2) handling of flags..
trasz updated this object.
trasz edited the test plan for this revision. (Show Details)
jhb added a reviewer: jhb.
jhb added a subscriber: jhb.

As some followups:

  1. We should probably validate 'flags' and fail with EINVAL for bad values.
  2. We should rename 'flags' to 'flag' to note it is an enum and not a mask of values. Along with this, libsysdecode/kdump should be fixed to treat it as an enum rather than a mask.
This revision is now accepted and ready to land.Oct 28 2016, 6:39 PM

Indeed, the command should be checked. I think I already asked this question in the discussion elsewhere, are there wrong callers of the fstatfs(2) ? It would be more natural to check flags == MNT_WAIT there, but feasibility of the change depends on the existing apps.

This revision was automatically updated to reflect the committed changes.

I agree about the 'flag' thing, and being more strict about validating it. Still, I'd prefer to do it separately, to make merging easier. Yes, I did review the callers in the tree; I didn't look at the ports, though.