zfs
zfs copied to clipboard
FreeBSD: Use a statement expression to implement SET_ERROR()
Use a statement expression to implement SET_ERROR().
Motivation and Context
The current implementation makes assumptions about how SDT_PROBE* is implemented on FreeBSD. These assumptions will become false after a forthcoming FreeBSD kernel change.
Description
SET_ERROR() can be implemented using a statement expression in a way that avoids making assumptions about SDT internals. OpenZFS uses statement expressions elsewhere in the kernel module, so I presume that doing so here is allowed.
How Has This Been Tested?
Interactively, using dtrace -n 'sdt:::set-error {printf("%d", args[0]); stack();}'
and using a kernel debugger to validate dtrace's output.
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Performance enhancement (non-breaking change which improves efficiency)
- [ ] Code cleanup (non-breaking change which makes code smaller or more readable)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
- [ ] Documentation (a change to man pages or other documentation)
Checklist:
- [x] My code follows the OpenZFS code style requirements.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the contributing document.
- [ ] I have added tests to cover my changes.
- [ ] I have run the ZFS Test Suite with this change applied.
- [x] All commit messages are properly formatted and contain
Signed-off-by
.