diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c index c73731483a324..539fc38312af4 100644 --- a/fs/vfs/fs_epoll.c +++ b/fs/vfs/fs_epoll.c @@ -83,6 +83,16 @@ static const struct file_operations g_epoll_ops = #endif }; +static struct inode g_epoll_inode = +{ + .i_crefs = 1, + .i_flags = FSNODEFLAG_TYPE_DRIVER, + .u = + { + .i_ops = &g_epoll_ops, + }, +}; + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -109,12 +119,12 @@ static FAR struct epoll_head *epoll_head_from_fd(int fd) return NULL; } - return (FAR struct epoll_head *)filep->f_inode->i_private; + return (FAR struct epoll_head *)filep->f_priv; } static int epoll_do_open(FAR struct file *filep) { - FAR struct epoll_head *eph = filep->f_inode->i_private; + FAR struct epoll_head *eph = filep->f_priv; int ret; ret = nxsem_wait(&eph->sem); @@ -130,7 +140,7 @@ static int epoll_do_open(FAR struct file *filep) static int epoll_do_close(FAR struct file *filep) { - FAR struct epoll_head *eph = filep->f_inode->i_private; + FAR struct epoll_head *eph = filep->f_priv; int ret; ret = nxsem_wait(&eph->sem); @@ -187,7 +197,7 @@ static int epoll_do_create(int size, int flags) /* Alloc the file descriptor */ - fd = files_allocate(&eph->in, flags, 0, eph, 0); + fd = files_allocate(&g_epoll_inode, flags, 0, eph, 0); if (fd < 0) { nxsem_destroy(&eph->sem); @@ -196,6 +206,7 @@ static int epoll_do_create(int size, int flags) return -1; } + inode_addref(&g_epoll_inode); nxsem_post(&eph->sem); return fd; }