Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD: Use the new freeuio() helper to free dynamically allocated UIOs #16300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markjdb
Copy link
Contributor

@markjdb markjdb commented Jun 26, 2024

Motivation and Context

FreeBSD now has a helper function to free UIOs returned by cloneuio(). Use that instead of calling free() directly.

Description

FreeBSD has a new interface for freeing UIOs, freeuio(). Use that when on a sufficiently new kernel. This has no effect for now but it may be necessary in the future.

How Has This Been Tested?

Build-tested.

Types of changes

  • 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:

This freeuio() interface was introduced to FreeBSD recently.  For now
it simply calls free(), so this change has no effect.  However, this
may not always be true, and in CheriBSD this change is required.

Signed-off-by: Mark Johnston <[email protected]>
static void
zfs_freeuio(struct uio *uio)
{
#if __FreeBSD_version > 1500013
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just double checking, should this be >= or >?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

> is correct. __FreeBSD_version was not bumped when freeuio() was added to FreeBSD, and its value at the time was 1500013. This change won't compile for previous revisions after the bump from 1500012 to 1500013, to be safe we can just consider 1500014 to be the first version which includes freeuio().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants