mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 20:08:15 +08:00
fs/vfs: Rename fdesc_poll to fs_poll
and reorder the function declaration Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
+3
-3
@@ -105,7 +105,7 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, bool setup)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fdesc_poll(fd, fds, setup);
|
return fs_poll(fd, fds, setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -299,7 +299,7 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds,
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Low-level poll operation based on struct file. This is used both to (1)
|
* Low-level poll operation based on struct file. This is used both to (1)
|
||||||
* support detached file, and also (2) by fdesc_poll() to perform all
|
* support detached file, and also (2) by fs_poll() to perform all
|
||||||
* normal operations on file descriptors.
|
* normal operations on file descriptors.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
@@ -378,7 +378,7 @@ int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int fdesc_poll(int fd, FAR struct pollfd *fds, bool setup)
|
int fs_poll(int fd, FAR struct pollfd *fds, bool setup)
|
||||||
{
|
{
|
||||||
FAR struct file *filep;
|
FAR struct file *filep;
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
+109
-109
@@ -717,23 +717,20 @@ void files_initlist(FAR struct filelist *list);
|
|||||||
void files_releaselist(FAR struct filelist *list);
|
void files_releaselist(FAR struct filelist *list);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: file_dup2
|
* Name: file_dup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Assign an inode to a specific files structure. This is the heart of
|
* Equivalent to the non-standard fs_dupfd() function except that it
|
||||||
* dup2.
|
* accepts a struct file instance instead of a file descriptor and does
|
||||||
*
|
|
||||||
* Equivalent to the non-standard fs_dupfd2() function except that it
|
|
||||||
* accepts struct file instances instead of file descriptors and it does
|
|
||||||
* not set the errno variable.
|
* not set the errno variable.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success; a negated errno value is return on
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
* any failure.
|
* any failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int file_dup2(FAR struct file *filep1, FAR struct file *filep2);
|
int file_dup(FAR struct file *filep, int minfd);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: fs_dupfd OR dup
|
* Name: fs_dupfd OR dup
|
||||||
@@ -758,20 +755,23 @@ int file_dup2(FAR struct file *filep1, FAR struct file *filep2);
|
|||||||
int fs_dupfd(int fd, int minfd);
|
int fs_dupfd(int fd, int minfd);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: file_dup
|
* Name: file_dup2
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Equivalent to the non-standard fs_dupfd() function except that it
|
* Assign an inode to a specific files structure. This is the heart of
|
||||||
* accepts a struct file instance instead of a file descriptor and does
|
* dup2.
|
||||||
|
*
|
||||||
|
* Equivalent to the non-standard fs_dupfd2() function except that it
|
||||||
|
* accepts struct file instances instead of file descriptors and it does
|
||||||
* not set the errno variable.
|
* not set the errno variable.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
* Zero (OK) is returned on success; a negated errno value is return on
|
||||||
* any failure.
|
* any failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int file_dup(FAR struct file *filep, int minfd);
|
int file_dup2(FAR struct file *filep1, FAR struct file *filep2);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: fs_dupfd2 OR dup2
|
* Name: fs_dupfd2 OR dup2
|
||||||
@@ -821,6 +821,48 @@ int fs_dupfd2(int fd1, int fd2);
|
|||||||
|
|
||||||
int file_open(FAR struct file *filep, FAR const char *path, int oflags, ...);
|
int file_open(FAR struct file *filep, FAR const char *path, int oflags, ...);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nx_open and nx_vopen
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* nx_open() is similar to the standard 'open' interface except that is is
|
||||||
|
* not a cancellation point and it does not modify the errno variable.
|
||||||
|
*
|
||||||
|
* nx_vopen() is identical except that it accepts a va_list as an argument
|
||||||
|
* versus taking a variable length list of arguments.
|
||||||
|
*
|
||||||
|
* nx_open() and nx_vopen are internal NuttX interface and should not be
|
||||||
|
* called from applications.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* The new file descriptor is returned on success; a negated errno value is
|
||||||
|
* returned on any failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int nx_vopen(FAR const char *path, int oflags, va_list ap);
|
||||||
|
int nx_open(FAR const char *path, int oflags, ...);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: fs_getfilep
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Given a file descriptor, return the corresponding instance of struct
|
||||||
|
* file. NOTE that this function will currently fail if it is provided
|
||||||
|
* with a socket descriptor.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* fd - The file descriptor
|
||||||
|
* filep - The location to return the struct file instance
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int fs_getfilep(int fd, FAR struct file **filep);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: file_detach
|
* Name: file_detach
|
||||||
*
|
*
|
||||||
@@ -930,39 +972,6 @@ int open_blockdriver(FAR const char *pathname, int mountflags,
|
|||||||
|
|
||||||
int close_blockdriver(FAR struct inode *inode);
|
int close_blockdriver(FAR struct inode *inode);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: fs_ioctl
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Perform device specific operations.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* fd File/socket descriptor of device
|
|
||||||
* req The ioctl command
|
|
||||||
* arg The argument of the ioctl cmd
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* >=0 on success (positive non-zero values are cmd-specific)
|
|
||||||
* -1 on failure with errno set properly:
|
|
||||||
*
|
|
||||||
* EBADF
|
|
||||||
* 'fd' is not a valid descriptor.
|
|
||||||
* EFAULT
|
|
||||||
* 'arg' references an inaccessible memory area.
|
|
||||||
* EINVAL
|
|
||||||
* 'cmd' or 'arg' is not valid.
|
|
||||||
* ENOTTY
|
|
||||||
* 'fd' is not associated with a character special device.
|
|
||||||
* ENOTTY
|
|
||||||
* The specified request does not apply to the kind of object that the
|
|
||||||
* descriptor 'fd' references.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_LIBC_IOCTL_VARIADIC
|
|
||||||
int fs_ioctl(int fd, int req, unsigned long arg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: fs_fdopen
|
* Name: fs_fdopen
|
||||||
*
|
*
|
||||||
@@ -1002,48 +1011,6 @@ int lib_flushall(FAR struct streamlist *list);
|
|||||||
ssize_t lib_sendfile(int outfd, int infd, off_t *offset, size_t count);
|
ssize_t lib_sendfile(int outfd, int infd, off_t *offset, size_t count);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: fs_getfilep
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Given a file descriptor, return the corresponding instance of struct
|
|
||||||
* file. NOTE that this function will currently fail if it is provided
|
|
||||||
* with a socket descriptor.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* fd - The file descriptor
|
|
||||||
* filep - The location to return the struct file instance
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
|
||||||
* any failure.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int fs_getfilep(int fd, FAR struct file **filep);
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: nx_open and nx_vopen
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* nx_open() is similar to the standard 'open' interface except that is is
|
|
||||||
* not a cancellation point and it does not modify the errno variable.
|
|
||||||
*
|
|
||||||
* nx_vopen() is identical except that it accepts a va_list as an argument
|
|
||||||
* versus taking a variable length list of arguments.
|
|
||||||
*
|
|
||||||
* nx_open() and nx_vopen are internal NuttX interface and should not be
|
|
||||||
* called from applications.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* The new file descriptor is returned on success; a negated errno value is
|
|
||||||
* returned on any failure.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int nx_vopen(FAR const char *path, int oflags, va_list ap);
|
|
||||||
int nx_open(FAR const char *path, int oflags, ...);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: file_read
|
* Name: file_read
|
||||||
*
|
*
|
||||||
@@ -1269,6 +1236,39 @@ int file_ioctl(FAR struct file *filep, int req, unsigned long arg);
|
|||||||
|
|
||||||
int nx_ioctl(int fd, int req, unsigned long arg);
|
int nx_ioctl(int fd, int req, unsigned long arg);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: fs_ioctl
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform device specific operations.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* fd File/socket descriptor of device
|
||||||
|
* req The ioctl command
|
||||||
|
* arg The argument of the ioctl cmd
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* >=0 on success (positive non-zero values are cmd-specific)
|
||||||
|
* -1 on failure with errno set properly:
|
||||||
|
*
|
||||||
|
* EBADF
|
||||||
|
* 'fd' is not a valid descriptor.
|
||||||
|
* EFAULT
|
||||||
|
* 'arg' references an inaccessible memory area.
|
||||||
|
* EINVAL
|
||||||
|
* 'cmd' or 'arg' is not valid.
|
||||||
|
* ENOTTY
|
||||||
|
* 'fd' is not associated with a character special device.
|
||||||
|
* ENOTTY
|
||||||
|
* The specified request does not apply to the kind of object that the
|
||||||
|
* descriptor 'fd' references.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIBC_IOCTL_VARIADIC
|
||||||
|
int fs_ioctl(int fd, int req, unsigned long arg);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: file_vfcntl
|
* Name: file_vfcntl
|
||||||
*
|
*
|
||||||
@@ -1339,7 +1339,7 @@ int nx_fcntl(int fd, int cmd, ...);
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Low-level poll operation based on struct file. This is used both to (1)
|
* Low-level poll operation based on struct file. This is used both to (1)
|
||||||
* support detached file, and also (2) by fdesc_poll() to perform all
|
* support detached file, and also (2) by fs_poll() to perform all
|
||||||
* normal operations on file descriptors.
|
* normal operations on file descriptors.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
@@ -1355,6 +1355,26 @@ int nx_fcntl(int fd, int cmd, ...);
|
|||||||
|
|
||||||
int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup);
|
int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: fs_poll
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* The standard poll() operation redirects operations on file descriptors
|
||||||
|
* to this function.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* fd - The file descriptor of interest
|
||||||
|
* fds - The structure describing the events to be monitored, OR NULL if
|
||||||
|
* this is a request to stop monitoring events.
|
||||||
|
* setup - true: Setup up the poll; false: Teardown the poll
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* 0: Success; Negated errno on failure
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int fs_poll(int fd, FAR struct pollfd *fds, bool setup);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: file_fstat
|
* Name: file_fstat
|
||||||
*
|
*
|
||||||
@@ -1397,26 +1417,6 @@ int file_fstat(FAR struct file *filep, FAR struct stat *buf);
|
|||||||
|
|
||||||
int nx_stat(FAR const char *path, FAR struct stat *buf);
|
int nx_stat(FAR const char *path, FAR struct stat *buf);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: fdesc_poll
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* The standard poll() operation redirects operations on file descriptors
|
|
||||||
* to this function.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* fd - The file descriptor of interest
|
|
||||||
* fds - The structure describing the events to be monitored, OR NULL if
|
|
||||||
* this is a request to stop monitoring events.
|
|
||||||
* setup - true: Setup up the poll; false: Teardown the poll
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* 0: Success; Negated errno on failure
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
int fdesc_poll(int fd, FAR struct pollfd *fds, bool setup);
|
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user