aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/fuse/fuse_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/fuse/fuse_device.c')
-rw-r--r--sys/fs/fuse/fuse_device.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c
index cab5925c91de..f8807d6d1c26 100644
--- a/sys/fs/fuse/fuse_device.c
+++ b/sys/fs/fuse/fuse_device.c
@@ -119,6 +119,7 @@ static struct cdevsw fuse_device_cdevsw = {
};
static int fuse_device_filt_read(struct knote *kn, long hint);
+static int fuse_device_filt_write(struct knote *kn, long hint);
static void fuse_device_filt_detach(struct knote *kn);
struct filterops fuse_device_rfiltops = {
@@ -127,6 +128,11 @@ struct filterops fuse_device_rfiltops = {
.f_event = fuse_device_filt_read,
};
+struct filterops fuse_device_wfiltops = {
+ .f_isfd = 1,
+ .f_event = fuse_device_filt_write,
+};
+
/****************************
*
* >>> Fuse device op defs
@@ -180,12 +186,14 @@ fuse_device_filter(struct cdev *dev, struct knote *kn)
error = devfs_get_cdevpriv((void **)&data);
- /* EVFILT_WRITE is not supported; the device is always ready to write */
if (error == 0 && kn->kn_filter == EVFILT_READ) {
kn->kn_fop = &fuse_device_rfiltops;
kn->kn_hook = data;
knlist_add(&data->ks_rsel.si_note, kn, 0);
error = 0;
+ } else if (error == 0 && kn->kn_filter == EVFILT_WRITE) {
+ kn->kn_fop = &fuse_device_wfiltops;
+ error = 0;
} else if (error == 0) {
error = EINVAL;
kn->kn_data = error;
@@ -231,6 +239,16 @@ fuse_device_filt_read(struct knote *kn, long hint)
return (ready);
}
+static int
+fuse_device_filt_write(struct knote *kn, long hint)
+{
+
+ kn->kn_data = 0;
+
+ /* The device is always ready to write, so we return 1*/
+ return (1);
+}
+
/*
* Resources are set up on a per-open basis
*/