diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-19 02:39:21 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-19 02:39:21 +0000 |
commit | 9cf192e2eca3b7d266e25a49a02008fe015ff389 (patch) | |
tree | b72c2245db1837de8cf286ac919242c220307b36 | |
parent | c0b98435519199874716495c3654fffff8f6fab9 (diff) | |
download | px4-nuttx-9cf192e2eca3b7d266e25a49a02008fe015ff389.tar.gz px4-nuttx-9cf192e2eca3b7d266e25a49a02008fe015ff389.tar.bz2 px4-nuttx-9cf192e2eca3b7d266e25a49a02008fe015ff389.zip |
Revert part of last change
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1285 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/arch/sim/src/up_devconsole.c | 4 | ||||
-rw-r--r-- | nuttx/drivers/dev_null.c | 6 | ||||
-rw-r--r-- | nuttx/drivers/dev_zero.c | 6 | ||||
-rw-r--r-- | nuttx/drivers/pipe_common.c | 19 | ||||
-rw-r--r-- | nuttx/drivers/pipe_common.h | 2 | ||||
-rw-r--r-- | nuttx/drivers/serial.c | 19 | ||||
-rw-r--r-- | nuttx/fs/fs_poll.c | 10 | ||||
-rw-r--r-- | nuttx/include/nuttx/fs.h | 2 |
8 files changed, 33 insertions, 35 deletions
diff --git a/nuttx/arch/sim/src/up_devconsole.c b/nuttx/arch/sim/src/up_devconsole.c index 7e6cdf20b..89eb33c33 100644 --- a/nuttx/arch/sim/src/up_devconsole.c +++ b/nuttx/arch/sim/src/up_devconsole.c @@ -54,7 +54,7 @@ static ssize_t devconsole_read(struct file *, char *, size_t); static ssize_t devconsole_write(struct file *, const char *, size_t); #ifndef CONFIG_DISABLE_POLL -static int devconsole_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup); +static int devconsole_poll(FAR struct file *filep, FAR struct pollfd *fds); #endif /**************************************************************************** @@ -85,7 +85,7 @@ static ssize_t devconsole_write(struct file *filp, const char *buffer, size_t le } #ifndef CONFIG_DISABLE_POLL -static int devconsole_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup) +static int devconsole_poll(FAR struct file *filep, FAR struct pollfd *fds) { return OK; } diff --git a/nuttx/drivers/dev_null.c b/nuttx/drivers/dev_null.c index cada981fe..a5e7d95ce 100644 --- a/nuttx/drivers/dev_null.c +++ b/nuttx/drivers/dev_null.c @@ -56,7 +56,7 @@ static ssize_t devnull_read(FAR struct file *, FAR char *, size_t); static ssize_t devnull_write(FAR struct file *, FAR const char *, size_t); #ifndef CONFIG_DISABLE_POLL -static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds, boolean setup); +static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds); #endif /**************************************************************************** @@ -103,9 +103,9 @@ static ssize_t devnull_write(FAR struct file *filp, FAR const char *buffer, size ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds, boolean setup) +static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds) { - if (setup) + if (fds) { fds->revents |= (fds->events & (POLLIN|POLLOUT)); if (fds->revents != 0) diff --git a/nuttx/drivers/dev_zero.c b/nuttx/drivers/dev_zero.c index 13276ca7a..08815ace5 100644 --- a/nuttx/drivers/dev_zero.c +++ b/nuttx/drivers/dev_zero.c @@ -56,7 +56,7 @@ static ssize_t devzero_read(FAR struct file *, FAR char *, size_t); static ssize_t devzero_write(FAR struct file *, FAR const char *, size_t); #ifndef CONFIG_DISABLE_POLL -static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds, boolean setup); +static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds); #endif /**************************************************************************** @@ -104,9 +104,9 @@ static ssize_t devzero_write(FAR struct file *filp, FAR const char *buffer, size ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds, boolean setup) +static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds) { - if (setup) + if (fds) { fds->revents |= (fds->events & (POLLIN|POLLOUT)); if (fds->revents != 0) diff --git a/nuttx/drivers/pipe_common.c b/nuttx/drivers/pipe_common.c index 72fea8006..cede17ae1 100644 --- a/nuttx/drivers/pipe_common.c +++ b/nuttx/drivers/pipe_common.c @@ -517,7 +517,7 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup) +int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds) { FAR struct inode *inode = filep->f_inode; FAR struct pipe_dev_s *dev = inode->i_private; @@ -547,14 +547,14 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setu if (dev->d_fds[i] == filep->f_priv) { - dev->d_fds[i] = (setup ? fds : NULL); + dev->d_fds[i] = fds; break; } } if (i >= CONFIG_DEV_PIPE_NPOLLWAITERS) { - DEBUGASSERT(setup); + DEBUGASSERT(fds != NULL); return -EBUSY; } @@ -562,16 +562,13 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setu * private data. */ - filep->f_priv = NULL; /* Assume teardown */ - if (setup) - { - /* Set the poll event structure reference in the 'struct file' private data. */ + filep->f_priv = fds; - filep->f_priv = fds; + /* Check if we should immediately notify on any of the requested events */ - /* Check if we should immediately notify on any of the requested events. First, - * Determine how many bytes are in the buffer - */ + if (fds) + { + /* Determine how many bytes are in the buffer */ if (dev->d_wrndx >= dev->d_rdndx) { diff --git a/nuttx/drivers/pipe_common.h b/nuttx/drivers/pipe_common.h index 0f2247766..05edd9ca2 100644 --- a/nuttx/drivers/pipe_common.h +++ b/nuttx/drivers/pipe_common.h @@ -123,7 +123,7 @@ EXTERN int pipecommon_close(FAR struct file *filep); EXTERN ssize_t pipecommon_read(FAR struct file *, FAR char *, size_t); EXTERN ssize_t pipecommon_write(FAR struct file *, FAR const char *, size_t); #ifndef CONFIG_DISABLE_POLL -EXTERN int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup); +EXTERN int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds); #endif #undef EXTERN diff --git a/nuttx/drivers/serial.c b/nuttx/drivers/serial.c index 0effeff00..4e409fa06 100644 --- a/nuttx/drivers/serial.c +++ b/nuttx/drivers/serial.c @@ -79,7 +79,7 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer, size_t buflen); static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg); #ifndef CONFIG_DISABLE_POLL -static int uart_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup); +static int uart_poll(FAR struct file *filep, FAR struct pollfd *fds); #endif /************************************************************************************ @@ -400,7 +400,7 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg) ****************************************************************************/ #ifndef CONFIG_DISABLE_POLL -int uart_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup) +int uart_poll(FAR struct file *filep, FAR struct pollfd *fds) { FAR struct inode *inode = filep->f_inode; FAR uart_dev_t *dev = inode->i_private; @@ -430,14 +430,14 @@ int uart_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup) if (dev->fds[i] == filep->f_priv) { - dev->fds[i] = (setup ? fds : NULL); + dev->fds[i] = fds; break; } } if (i >= CONFIG_DEV_CONSOLE_NPOLLWAITERS) { - DEBUGASSERT(setup); + DEBUGASSERT(fds != NULL); return -EBUSY; } @@ -445,12 +445,13 @@ int uart_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup) * private data. */ - filep->f_priv = NULL; /* Assume teardown */ - if (setup) + filep->f_priv = fds; + + /* Check if we should immediately notify on any of the requested events */ + + if (fds) { - /* Check if we should immediately notify on any of the requested events. - * First, check if the xmit buffer is full. - */ + /* Check if the xmit buffer is full. */ eventset = 0; diff --git a/nuttx/fs/fs_poll.c b/nuttx/fs/fs_poll.c index 9eed46c05..133f16f49 100644 --- a/nuttx/fs/fs_poll.c +++ b/nuttx/fs/fs_poll.c @@ -93,7 +93,7 @@ static void poll_semtake(FAR sem_t *sem) ****************************************************************************/ #if CONFIG_NFILE_DESCRIPTORS > 0 -static int poll_fdsetup(int fd, FAR struct pollfd *fds, boolean setup) +static int poll_fdsetup(int fd, FAR struct pollfd *fds) { FAR struct filelist *list; FAR struct file *this_file; @@ -109,7 +109,7 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, boolean setup) #if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS)) { - return net_poll(fds->fd, fds, setup); + return net_poll(fd, fds); } else #endif @@ -137,7 +137,7 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, boolean setup) { /* Yes, then setup the poll */ - ret = (int)inode->u.i_ops->poll(this_file, fds, setup); + ret = (int)inode->u.i_ops->poll(this_file, fds); } return ret; } @@ -168,7 +168,7 @@ static inline int poll_setup(FAR struct pollfd *fds, nfds_t nfds, sem_t *sem) /* Set up the poll */ - ret = poll_fdsetup(fds[i].fd, &fds[i], TRUE); + ret = poll_fdsetup(fds[i].fd, &fds[i]); if (ret < 0) { return ret; @@ -201,7 +201,7 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds, int *count) { /* Teardown the poll */ - status = poll_fdsetup(fds[i].fd, &fds[i], FALSE); + status = poll_fdsetup(fds[i].fd, NULL); if (status < 0) { ret = status; diff --git a/nuttx/include/nuttx/fs.h b/nuttx/include/nuttx/fs.h index 3d2370688..ced7beed1 100644 --- a/nuttx/include/nuttx/fs.h +++ b/nuttx/include/nuttx/fs.h @@ -76,7 +76,7 @@ struct file_operations off_t (*seek)(FAR struct file *filp, off_t offset, int whence); int (*ioctl)(FAR struct file *filp, int cmd, unsigned long arg); #ifndef CONFIG_DISABLE_POLL - int (*poll)(FAR struct file *filp, struct pollfd *fds, boolean setup); + int (*poll)(FAR struct file *filp, struct pollfd *fds); #endif /* The two structures need not be common after this point */ |