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)
Dec 20 2023, 4:55 AM
Unknown Object (File)
Dec 14 2023, 10:33 PM
Unknown Object (File)
Nov 4 2023, 8:34 PM
Unknown Object (File)
Aug 16 2023, 7:59 AM
Unknown Object (File)
Aug 16 2023, 7:40 AM
Unknown Object (File)
Jul 30 2023, 12:02 AM
Unknown Object (File)
May 29 2023, 6:35 AM
Unknown Object (File)
Mar 19 2023, 5:20 PM

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.