Page MenuHomeFreeBSD

D30503.diff
No OneTemporary

D30503.diff

diff --git a/usr.sbin/bhyve/mevent.h b/usr.sbin/bhyve/mevent.h
--- a/usr.sbin/bhyve/mevent.h
+++ b/usr.sbin/bhyve/mevent.h
@@ -35,14 +35,21 @@
EVF_READ,
EVF_WRITE,
EVF_TIMER,
- EVF_SIGNAL
+ EVF_SIGNAL,
+ EVF_VNODE,
};
+/* Filter flags for EVF_VNODE */
+#define EVFF_ATTRIB 0x0001
+
struct mevent;
struct mevent *mevent_add(int fd, enum ev_type type,
void (*func)(int, enum ev_type, void *),
void *param);
+struct mevent *mevent_add_flags(int fd, enum ev_type type, int fflags,
+ void (*func)(int, enum ev_type, void *),
+ void *param);
struct mevent *mevent_add_disabled(int fd, enum ev_type type,
void (*func)(int, enum ev_type, void *),
void *param);
diff --git a/usr.sbin/bhyve/mevent.c b/usr.sbin/bhyve/mevent.c
--- a/usr.sbin/bhyve/mevent.c
+++ b/usr.sbin/bhyve/mevent.c
@@ -80,6 +80,7 @@
int me_cq;
int me_state; /* Desired kevent flags. */
int me_closefd;
+ int me_fflags;
LIST_ENTRY(mevent) me_list;
};
@@ -165,6 +166,9 @@
if (mevp->me_type == EVF_SIGNAL)
retval = EVFILT_SIGNAL;
+ if (mevp->me_type == EVF_VNODE)
+ retval = EVFILT_VNODE;
+
return (retval);
}
@@ -177,8 +181,18 @@
static int
mevent_kq_fflags(struct mevent *mevp)
{
- /* XXX nothing yet, perhaps EV_EOF for reads ? */
- return (0);
+ int retval;
+
+ retval = 0;
+
+ switch (mevp->me_type) {
+ case EVF_VNODE:
+ if ((mevp->me_fflags & EVFF_ATTRIB) != 0)
+ retval |= NOTE_ATTRIB;
+ break;
+ }
+
+ return (retval);
}
static void
@@ -255,7 +269,7 @@
static struct mevent *
mevent_add_state(int tfd, enum ev_type type,
void (*func)(int, enum ev_type, void *), void *param,
- int state)
+ int state, int fflags)
{
struct kevent kev;
struct mevent *lp, *mevp;
@@ -305,6 +319,7 @@
mevp->me_func = func;
mevp->me_param = param;
mevp->me_state = state;
+ mevp->me_fflags = fflags;
/*
* Try to add the event. If this fails, report the failure to
@@ -332,7 +347,15 @@
void (*func)(int, enum ev_type, void *), void *param)
{
- return (mevent_add_state(tfd, type, func, param, EV_ADD));
+ return (mevent_add_state(tfd, type, func, param, EV_ADD, 0));
+}
+
+struct mevent *
+mevent_add_flags(int tfd, enum ev_type type, int fflags,
+ void (*func)(int, enum ev_type, void *), void *param)
+{
+
+ return (mevent_add_state(tfd, type, func, param, EV_ADD, fflags));
}
struct mevent *
@@ -340,7 +363,7 @@
void (*func)(int, enum ev_type, void *), void *param)
{
- return (mevent_add_state(tfd, type, func, param, EV_ADD | EV_DISABLE));
+ return (mevent_add_state(tfd, type, func, param, EV_ADD | EV_DISABLE, 0));
}
static int

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 6:34 PM (22 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14662842
Default Alt Text
D30503.diff (2 KB)

Event Timeline