CONFIG_NFILE_DESCRIPTORS=0 can no longer be used to disable the file system. NuttX with no file system does not make sense.

Squashed commit of the following:

    configs/:  The few configurations that formerly set CONFIG_NFILE_DESCRIPTORS=0 should not default, rather they should set the number of descriptors to 3.
    fs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    tools/:  Tools updates for changes to usage of CONFIG_NFILE_DESCRIPTORS.
    syscall/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    drivers/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NFILE_DESCRIPTORS == 0
    binfmt/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    arch/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/Kconfig:  CONFIG_NFILE_DESCRIPTORS may no longer to set to a value less than 3
    configs/:  Remove all settings for CONFIG_NFILE_DESCRIPTORS < 3
This commit is contained in:
Gregory Nutt
2019-02-11 12:09:26 -06:00
parent 07bcc6292a
commit a64869aa67
141 changed files with 374 additions and 1008 deletions
-2
View File
@@ -59,7 +59,6 @@ include shm/Make.defs
# Additional files required is mount-able file systems are supported
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
include mount/Make.defs
@@ -79,7 +78,6 @@ include userfs/Make.defs
include hostfs/Make.defs
include littlefs/Make.defs
endif
endif
COBJS = $(CSRCS:.c=$(OBJEXT))
+1 -11
View File
@@ -63,24 +63,16 @@
# define CONFIG_FS_NAIOC 8
#endif
#undef AIO_HAVE_FILEP
#undef AIO_HAVE_PSOCK
#if CONFIG_NFILE_DESCRIPTORS > 0
# define AIO_HAVE_FILEP
#endif
#if defined(CONFIG_NET_TCP) && CONFIG_NSOCKET_DESCRIPTORS > 0
# define AIO_HAVE_PSOCK
#endif
#if !defined(AIO_HAVE_FILEP) && !defined(AIO_HAVE_PSOCK)
# error AIO needs file and/or socket descriptors
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/* This structure contains one AIO control block and appends information
* needed by the logic running on the worker thread. These structures are
* pre-allocated, the number pre-allocated controlled by CONFIG_FS_NAIOC.
@@ -93,9 +85,7 @@ struct aio_container_s
FAR struct aiocb *aioc_aiocbp; /* The contained AIO control block */
union
{
#ifdef AIO_HAVE_FILEP
FAR struct file *aioc_filep; /* File structure to use with the I/O */
#endif
#ifdef AIO_HAVE_PSOCK
FAR struct socket *aioc_psock; /* Socket structure to use with the I/O */
#endif
+2 -6
View File
@@ -94,10 +94,9 @@ static void aio_read_worker(FAR void *arg)
#endif
aiocbp = aioc_decant(aioc);
#if defined(AIO_HAVE_FILEP) && defined(AIO_HAVE_PSOCK)
#ifdef AIO_HAVE_PSOCK
if (aiocbp->aio_fildes < CONFIG_NFILE_DESCRIPTORS)
#endif
#ifdef AIO_HAVE_FILEP
{
/* Perform the file read using:
*
@@ -110,11 +109,8 @@ static void aio_read_worker(FAR void *arg)
nread = file_pread(aioc->u.aioc_filep, (FAR void *)aiocbp->aio_buf,
aiocbp->aio_nbytes, aiocbp->aio_offset);
}
#endif
#if defined(AIO_HAVE_FILEP) && defined(AIO_HAVE_PSOCK)
else
#endif
#ifdef AIO_HAVE_PSOCK
else
{
/* Perform the socket receive using:
*
+2 -10
View File
@@ -81,9 +81,7 @@ static void aio_write_worker(FAR void *arg)
uint8_t prio;
#endif
ssize_t nwritten = 0;
#ifdef AIO_HAVE_FILEP
int oflags;
#endif
/* Get the information from the container, decant the AIO control block,
* and free the container before starting any I/O. That will minimize
@@ -97,10 +95,9 @@ static void aio_write_worker(FAR void *arg)
#endif
aiocbp = aioc_decant(aioc);
#if defined(AIO_HAVE_FILEP) && defined(AIO_HAVE_PSOCK)
#ifdef AIO_HAVE_PSOCK
if (aiocbp->aio_fildes < CONFIG_NFILE_DESCRIPTORS)
#endif
#ifdef AIO_HAVE_FILEP
{
/* Call fcntl(F_GETFL) to get the file open mode. */
@@ -138,11 +135,8 @@ static void aio_write_worker(FAR void *arg)
aiocbp->aio_offset);
}
}
#endif
#if defined(AIO_HAVE_FILEP) && defined(AIO_HAVE_PSOCK)
else
#endif
#ifdef AIO_HAVE_PSOCK
else
{
/* Perform the send using:
*
@@ -166,9 +160,7 @@ static void aio_write_worker(FAR void *arg)
aiocbp->aio_result = nwritten;
#ifdef AIO_HAVE_FILEP
errout:
#endif
/* Signal the client */
+3 -9
View File
@@ -76,10 +76,8 @@ FAR struct aio_container_s *aio_contain(FAR struct aiocb *aiocbp)
FAR struct aio_container_s *aioc;
union
{
#ifdef AIO_HAVE_FILEP
FAR struct file *filep;
#endif
#ifdef AIO_HAVE_FILEP
#ifdef AIO_HAVE_PSOCK
FAR struct socket *psock;
#endif
FAR void *ptr;
@@ -89,10 +87,9 @@ FAR struct aio_container_s *aio_contain(FAR struct aiocb *aiocbp)
#endif
int ret;
#if defined(AIO_HAVE_FILEP) && defined(AIO_HAVE_PSOCK)
#ifdef AIO_HAVE_PSOCK
if (aiocbp->aio_fildes < CONFIG_NFILE_DESCRIPTORS)
#endif
#ifdef AIO_HAVE_FILEP
{
/* Get the file structure corresponding to the file descriptor. */
@@ -104,11 +101,8 @@ FAR struct aio_container_s *aio_contain(FAR struct aiocb *aiocbp)
DEBUGASSERT(u.filep != NULL);
}
#endif
#if defined(AIO_HAVE_FILEP) && defined(AIO_HAVE_PSOCK)
else
#endif
#ifdef AIO_HAVE_PSOCK
else
{
/* Get the socket structure corresponding to the socket descriptor */
+1 -5
View File
@@ -33,14 +33,10 @@
#
############################################################################
# Don't build anything if there are no file descriptors
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
CSRCS += fs_closedir.c fs_opendir.c fs_readdir.c fs_rewinddir.c fs_seekdir.c
# Include dirent build support
DEPPATH += --dep-path dirent
VPATH += :dirent
endif
-5
View File
@@ -33,10 +33,6 @@
#
############################################################################
# Don't build anything if there are no file descriptors
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
CSRCS += fs_registerdriver.c fs_unregisterdriver.c
# Don't build-in block driver support if there are no mountpoints
@@ -63,4 +59,3 @@ endif # CONFIG_DISABLE_MOUNTPOINT
DEPPATH += --dep-path driver
VPATH += :driver
endif
+1 -5
View File
@@ -33,10 +33,6 @@
#
############################################################################
# Don't build anything if there are no file descriptors
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
CSRCS += fs_files.c fs_foreachinode.c fs_inode.c fs_inodeaddref.c
CSRCS += fs_inodebasename.c fs_inodefind.c fs_inodefree.c fs_inoderelease.c
CSRCS += fs_inoderemove.c fs_inodereserve.c fs_inodesearch.c
@@ -46,4 +42,4 @@ CSRCS += fs_fileopen.c fs_filedetach.c fs_fileclose.c
DEPPATH += --dep-path inode
VPATH += :inode
endif
-2
View File
@@ -109,7 +109,6 @@ static inline void _files_semtake(FAR struct filelist *list)
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int file_detach(int fd, FAR struct file *filep)
{
FAR struct filelist *list;
@@ -165,5 +164,4 @@ int file_detach(int fd, FAR struct file *filep)
_files_semgive(list);
return OK;
}
#endif
+2 -3
View File
@@ -33,9 +33,8 @@
#
############################################################################
# Don't build anything if there are no file descriptors
# Don't build anything if there is no mountpoint support
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
CSRCS += fs_mount.c fs_umount2.c fs_foreachmountpoint.c
@@ -56,4 +55,4 @@ DEPPATH += --dep-path mount
VPATH += :mount
endif
endif
+3 -5
View File
@@ -1049,9 +1049,7 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile,
size_t buflen, off_t offset)
{
FAR struct task_group_s *group = tcb->group;
#if CONFIG_NFILE_DESCRIPTORS > 0 /* Guaranteed to be true */
FAR struct file *file;
#endif
#if CONFIG_NSOCKET_DESCRIPTORS > 0
FAR struct socket *socket;
#endif
@@ -1066,7 +1064,6 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile,
remaining = buflen;
totalsize = 0;
#if CONFIG_NFILE_DESCRIPTORS > 0 /* Guaranteed to be true */
linesize = snprintf(procfile->line, STATUS_LINELEN, "\n%-3s %-8s %s\n",
"FD", "POS", "OFLAGS");
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
@@ -1082,7 +1079,9 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile,
/* Examine each open file descriptor */
for (i = 0, file = group->tg_filelist.fl_files; i < CONFIG_NFILE_DESCRIPTORS; i++, file++)
for (i = 0, file = group->tg_filelist.fl_files;
i < CONFIG_NFILE_DESCRIPTORS;
i++, file++)
{
/* Is there an inode associated with the file descriptor? */
@@ -1102,7 +1101,6 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile,
}
}
}
#endif
#if CONFIG_NSOCKET_DESCRIPTORS > 0
linesize = snprintf(procfile->line, STATUS_LINELEN, "\n%-3s %-2s %-3s %s\n",
-37
View File
@@ -33,42 +33,6 @@
#
############################################################################
# If there are no file descriptors configured, then a small part of the
# logic in this directory may still apply to socket descriptors
ifeq ($(CONFIG_NFILE_DESCRIPTORS),0)
ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0)
# Socket descriptor support
CSRCS += fs_close.c fs_read.c fs_write.c fs_ioctl.c
# Support for network access using streams
ifneq ($(CONFIG_NFILE_STREAMS),0)
CSRCS += fs_fdopen.c
endif
# Support for poll() and select() (which derives from poll()
ifneq ($(CONFIG_DISABLE_POLL),y)
CSRCS += fs_poll.c fs_select.c
endif
# Support for sendfile()
ifeq ($(CONFIG_NET_SENDFILE),y)
CSRCS += fs_sendfile.c
endif
# Include vfs build support
DEPPATH += --dep-path vfs
VPATH += :vfs
endif
else
# Common file/socket descriptor support
CSRCS += fs_close.c fs_dup.c fs_dup2.c fs_fcntl.c fs_dupfd.c fs_dupfd2.c
@@ -106,4 +70,3 @@ endif
DEPPATH += --dep-path vfs
VPATH += :vfs
endif
+1 -8
View File
@@ -82,24 +82,20 @@
int close(int fd)
{
int errcode;
#if CONFIG_NFILE_DESCRIPTORS > 0
int ret;
#endif
/* close() is a cancellation point */
(void)enter_cancellation_point();
#if CONFIG_NFILE_DESCRIPTORS > 0
/* Did we get a valid file descriptor? */
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
#endif
{
/* Close a socket descriptor */
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS))
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
ret = net_close(fd);
if (ret < 0)
@@ -119,7 +115,6 @@ int close(int fd)
}
}
#if CONFIG_NFILE_DESCRIPTORS > 0
/* Close the driver or mountpoint. NOTES: (1) there is no
* exclusion mechanism here, the driver or mountpoint must be
* able to handle concurrent operations internally, (2) The driver
@@ -142,8 +137,6 @@ int close(int fd)
leave_cancellation_point();
return OK;
#endif
errout:
set_errno(errcode);
leave_cancellation_point();
+1 -3
View File
@@ -65,7 +65,6 @@ int dup(int fd)
/* Check the range of the descriptor to see if we got a file or a socket
* descriptor. */
#if CONFIG_NFILE_DESCRIPTORS > 0
if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS)
{
/* Its a valid file descriptor.. dup the file descriptor using any
@@ -76,12 +75,11 @@ int dup(int fd)
ret = fs_dupfd(fd, 0);
}
else
#endif
{
/* Not a valid file descriptor. Did we get a valid socket descriptor? */
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS))
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
/* Yes.. dup the socket descriptor. The errno value is not set. */
+5 -4
View File
@@ -1,7 +1,8 @@
/****************************************************************************
* fs/vfs/fs_dup2.c
*
* Copyright (C) 2007-2009, 2011, 2013, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011, 2013, 2017 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -50,7 +51,7 @@
* performed.
*/
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
/****************************************************************************
* Public Functions
@@ -77,7 +78,7 @@ int dup2(int fd1, int fd2)
/* Not a valid file descriptor. Did we get a valid socket descriptor? */
if ((unsigned int)fd1 < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS))
if ((unsigned int)fd1 < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
/* Yes.. dup the socket descriptor. The errno value is not set. */
@@ -110,5 +111,5 @@ int dup2(int fd1, int fd2)
}
}
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 ... */
#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS > 0 */
+2 -5
View File
@@ -1,7 +1,8 @@
/****************************************************************************
* fs/vfs/fs_dupfd.c
*
* Copyright (C) 2007-2009, 2011-2014, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2014, 2017 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -47,8 +48,6 @@
#include "inode/inode.h"
#if CONFIG_NFILE_DESCRIPTORS > 0
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -147,5 +146,3 @@ errout:
return ERROR;
}
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */
-4
View File
@@ -46,8 +46,6 @@
#include "inode/inode.h"
#if CONFIG_NFILE_DESCRIPTORS > 0
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -133,5 +131,3 @@ errout:
return ERROR;
}
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */
+1 -7
View File
@@ -75,7 +75,6 @@
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int file_vfcntl(FAR struct file *filep, int cmd, va_list ap)
{
int ret = -EINVAL;
@@ -212,7 +211,6 @@ int file_vfcntl(FAR struct file *filep, int cmd, va_list ap)
return ret;
}
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */
/****************************************************************************
* Name: file_fcntl
@@ -233,7 +231,6 @@ int file_vfcntl(FAR struct file *filep, int cmd, va_list ap)
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int file_fcntl(FAR struct file *filep, int cmd, ...)
{
va_list ap;
@@ -252,7 +249,6 @@ int file_fcntl(FAR struct file *filep, int cmd, ...)
va_end(ap);
return ret;
}
#endif
/****************************************************************************
* Name: fcntl
@@ -289,7 +285,6 @@ int fcntl(int fd, int cmd, ...)
/* Did we get a valid file descriptor? */
#if CONFIG_NFILE_DESCRIPTORS > 0
if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS)
{
/* Get the file structure corresponding to the file descriptor. */
@@ -307,12 +302,11 @@ int fcntl(int fd, int cmd, ...)
}
}
else
#endif
{
/* No... check for operations on a socket descriptor */
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS))
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
/* Yes.. defer socket descriptor operations to net_vfcntl(). The
* errno is not set on failures.
+3 -7
View File
@@ -62,7 +62,6 @@
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static inline int fs_checkfd(FAR struct tcb_s *tcb, int fd, int oflags)
{
FAR struct file *filep;
@@ -110,7 +109,6 @@ static inline int fs_checkfd(FAR struct tcb_s *tcb, int fd, int oflags)
return OK;
}
#endif
/****************************************************************************
* Public Functions
@@ -159,9 +157,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb)
* lie in a different range.
*/
#if CONFIG_NFILE_DESCRIPTORS > 0
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
#endif
{
/* No.. If networking is enabled then this might be a socket
* descriptor.
@@ -177,14 +173,14 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb)
#endif
}
/* The descriptor is in a valid range to file descriptor... perform some more checks */
/* The descriptor is in a valid range to file descriptor... perform some
* more checks.
*/
#if CONFIG_NFILE_DESCRIPTORS > 0
else
{
ret = fs_checkfd(tcb, fd, oflags);
}
#endif
/* Do we have a good descriptor of some sort? */
+1 -9
View File
@@ -75,7 +75,6 @@
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int file_ioctl(FAR struct file *filep, int req, unsigned long arg)
{
FAR struct inode *inode;
@@ -101,7 +100,6 @@ int file_ioctl(FAR struct file *filep, int req, unsigned long arg)
return (int)inode->u.i_ops->ioctl(filep, req, arg);
}
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */
/****************************************************************************
* Name: ioctl/fs_ioctl
@@ -139,19 +137,17 @@ int ioctl(int fd, int req, unsigned long arg)
#endif
{
int errcode;
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR struct file *filep;
int ret;
/* Did we get a valid file descriptor? */
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
#endif
{
/* Perform the socket ioctl */
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS))
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
ret = netdev_ioctl(fd, req, arg);
if (ret < 0)
@@ -170,7 +166,6 @@ int ioctl(int fd, int req, unsigned long arg)
}
}
#if CONFIG_NFILE_DESCRIPTORS > 0
/* Get the file structure corresponding to the file descriptor. */
ret = fs_getfilep(fd, &filep);
@@ -194,9 +189,6 @@ int ioctl(int fd, int req, unsigned long arg)
}
return ret;
#else
errcode = ENOTTY;
#endif
errout:
set_errno(errcode);
-3
View File
@@ -47,8 +47,6 @@
#include "inode/inode.h"
#if CONFIG_NFILE_DESCRIPTORS > 0
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -194,4 +192,3 @@ errout:
return (off_t)ERROR;
}
#endif
+2 -12
View File
@@ -98,7 +98,6 @@ static int poll_semtake(FAR sem_t *sem)
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static int poll_fdsetup(int fd, FAR struct pollfd *fds, bool setup)
{
/* Check for a valid file descriptor */
@@ -121,7 +120,6 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, bool setup)
return fdesc_poll(fd, fds, setup);
}
#endif
/****************************************************************************
* Name: poll_setup
@@ -131,7 +129,6 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, bool setup)
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static inline int poll_setup(FAR struct pollfd *fds, nfds_t nfds, sem_t *sem)
{
unsigned int i;
@@ -227,7 +224,6 @@ static inline int poll_setup(FAR struct pollfd *fds, nfds_t nfds, sem_t *sem)
return OK;
}
#endif
/****************************************************************************
* Name: poll_teardown
@@ -238,9 +234,8 @@ static inline int poll_setup(FAR struct pollfd *fds, nfds_t nfds, sem_t *sem)
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds, int *count,
int ret)
static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds,
FAR int *count, int ret)
{
unsigned int i;
int status = OK;
@@ -299,7 +294,6 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds, int *count,
return ret;
}
#endif
/****************************************************************************
* Public Functions
@@ -324,7 +318,6 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds, int *count,
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
{
FAR struct inode *inode;
@@ -370,7 +363,6 @@ int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
return ret;
}
#endif
/****************************************************************************
* Name: fdesc_poll
@@ -391,7 +383,6 @@ int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int fdesc_poll(int fd, FAR struct pollfd *fds, bool setup)
{
FAR struct file *filep;
@@ -411,7 +402,6 @@ int fdesc_poll(int fd, FAR struct pollfd *fds, bool setup)
return file_poll(filep, fds, setup);
}
#endif
/****************************************************************************
* Name: poll
-9
View File
@@ -140,9 +140,7 @@ ssize_t nx_read(int fd, FAR void *buf, size_t nbytes)
{
/* Did we get a valid file descriptor? */
#if CONFIG_NFILE_DESCRIPTORS > 0
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
#endif
{
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
/* No.. If networking is enabled, read() is the same as recv() with
@@ -156,8 +154,6 @@ ssize_t nx_read(int fd, FAR void *buf, size_t nbytes)
return -EBADF;
#endif
}
#if CONFIG_NFILE_DESCRIPTORS > 0
else
{
FAR struct file *filep;
@@ -178,11 +174,6 @@ ssize_t nx_read(int fd, FAR void *buf, size_t nbytes)
return file_read(filep, buf, nbytes);
}
#else
/* I don't think we can get here */
return -ENOSYS;
#endif
}
/****************************************************************************
+3 -2
View File
@@ -50,7 +50,7 @@
#include <nuttx/sched.h>
#include <nuttx/net/net.h>
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_SENDFILE
#ifdef CONFIG_NET_SENDFILE
/****************************************************************************
* Public Functions
@@ -148,4 +148,5 @@ ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count)
return lib_sendfile(outfd, infd, offset, count);
}
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_SENDFILE */
#endif /* CONFIG_NET_SENDFILE */
-7
View File
@@ -137,9 +137,7 @@ ssize_t file_write(FAR struct file *filep, FAR const void *buf, size_t nbytes)
ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes)
{
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR struct file *filep;
#endif
ssize_t ret;
if (buf == NULL)
@@ -149,9 +147,7 @@ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes)
/* Did we get a valid file descriptor? */
#if CONFIG_NFILE_DESCRIPTORS > 0
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
#endif
{
#if defined(CONFIG_NET_TCP) && CONFIG_NSOCKET_DESCRIPTORS > 0
/* Write to a socket descriptor is equivalent to send with flags == 0. */
@@ -161,8 +157,6 @@ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes)
ret = -EBADF;
#endif
}
#if CONFIG_NFILE_DESCRIPTORS > 0
else
{
/* The descriptor is in the right range to be a file descriptor..
@@ -180,7 +174,6 @@ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes)
ret = file_write(filep, buf, nbytes);
}
}
#endif
return ret;
}