Page MenuHomeFreeBSD

bhyve(8): allow mevent to filter EVFILT_VNODE kevents
AbandonedPublic

Authored by rew on Jan 19 2021, 8:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 4 2024, 6:07 PM
Unknown Object (File)
Oct 4 2024, 11:39 AM
Unknown Object (File)
Oct 3 2024, 12:05 AM
Unknown Object (File)
Oct 1 2024, 9:18 AM
Unknown Object (File)
Sep 17 2024, 2:22 AM
Unknown Object (File)
Sep 17 2024, 2:22 AM
Unknown Object (File)
Sep 1 2024, 7:27 AM
Unknown Object (File)
Jul 30 2024, 10:03 AM

Details

Reviewers
grehan
jhb
allanjude
Group Reviewers
bhyve
Summary

An example use-case for this would be to monitor events on a
file-backed disk image that is being used through virtio-blk.

  • Add me_fflags member to struct mevent
  • Modify mevent_kq_fflags() to return me_fflags.
  • Modify mevent_add_state() to accept an additional argument, fflags

mevent_add() doesn't handle setting filter specific flags. I added
mevent_create() that allows the caller to specify flags and
fflags. The expected values for flags and fflags are those described in kqueue(2).

Example usage of mevent_create():

mevent_create(fd, EVF_VNODE, EV_ADD | EV_CLEAR, NOTE_ATTRIB, handler, handler_arg);

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 36397
Build 33286: arc lint + arc unit

Event Timeline

rew requested review of this revision.Jan 19 2021, 8:24 PM
chuck added inline comments.
usr.sbin/bhyve/mevent.c
304

minor style(9) nit - Insert an empty line if the function has no local variables

usr.sbin/bhyve/mevent.c
304

This is now optional in style(9).

usr.sbin/bhyve/mevent.c
304

.. though, having a blank line matches the existing style in this file.

Looks fine.

mevent only exists because libevent wasn't available in-tree at the time. It may be worth investigating that and ditching mevent entirely.

This revision is now accepted and ready to land.Jan 19 2021, 10:31 PM

fix formatting to be consistent with rest of file.

This revision now requires review to proceed.Jan 21 2021, 7:55 PM
rew marked an inline comment as done.Jan 21 2021, 8:44 PM

Looks fine.

mevent only exists because libevent wasn't available in-tree at the time. It may be worth investigating that and ditching mevent entirely.

At first glance, it doesn't look like libevent can detect file changes - I'll look into it though.