You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/22 07:50:19 UTC
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7642: fs_epoll: support extend the epoll dynamicly.
pkarashchenko commented on code in PR #7642:
URL: https://github.com/apache/incubator-nuttx/pull/7642#discussion_r1028971689
##########
fs/vfs/fs_epoll.c:
##########
@@ -36,23 +36,45 @@
#include <nuttx/clock.h>
#include <nuttx/fs/fs.h>
#include <nuttx/kmalloc.h>
+#include <nuttx/list.h>
#include <nuttx/mutex.h>
+#include <nuttx/signal.h>
#include "inode/inode.h"
/****************************************************************************
* Private Types
****************************************************************************/
-struct epoll_head
+typedef struct epoll_node_s
{
- int size;
- int occupied;
- int crefs;
- mutex_t lock;
- FAR epoll_data_t *data;
- FAR struct pollfd *poll;
-};
+ struct list_node node;
+ epoll_data_t data;
+ struct pollfd pfd;
+} epoll_node_t;
+
+typedef struct epoll_head_s
+{
+ int size;
+ int crefs;
+ mutex_t lock;
+ sem_t sem;
+ struct list_node setup; /* The setup list, store all the setuped
+ * epoll node.
+ */
+ struct list_node teardown; /* The teardown list, store all the epoll
+ * node notified after epoll_wait finish,
+ * these epoll node should be setup again
+ * to check the pending poll notification.
+ */
+ struct list_node free; /* The free list, store all the freed epoll
+ * node.
+ */
+ struct list_node extend; /* The extend list, store all the malloced
+ * first node, used to free the malloced
+ * memory in epoll_do_close().
+ */
+} epoll_head_t;
Review Comment:
ditto
##########
fs/vfs/fs_epoll.c:
##########
@@ -36,23 +36,45 @@
#include <nuttx/clock.h>
#include <nuttx/fs/fs.h>
#include <nuttx/kmalloc.h>
+#include <nuttx/list.h>
#include <nuttx/mutex.h>
+#include <nuttx/signal.h>
#include "inode/inode.h"
/****************************************************************************
* Private Types
****************************************************************************/
-struct epoll_head
+typedef struct epoll_node_s
{
- int size;
- int occupied;
- int crefs;
- mutex_t lock;
- FAR epoll_data_t *data;
- FAR struct pollfd *poll;
-};
+ struct list_node node;
+ epoll_data_t data;
+ struct pollfd pfd;
+} epoll_node_t;
Review Comment:
I'm not sure about the style here. In many places I see stye like
```
struct epoll_node_s
{
struct list_node node;
epoll_data_t data;
struct pollfd pfd;
};
typedef struct epoll_node_s epoll_node_t;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org