Move the declaration of nx_mkfifo/nx_pipe to nuttx/fs/fs.h

the new location is better than nuttx/drivers/drivers.h
since they are part of the file system api.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-01-02 05:34:21 +08:00 committed by archer
parent 86fab49c46
commit 4d4cba41f6
9 changed files with 71 additions and 74 deletions

View File

@ -45,7 +45,6 @@
#include <errno.h>
#include <nuttx/fs/fs.h>
#include <nuttx/drivers/drivers.h>
#include "pipe_common.h"

View File

@ -47,7 +47,6 @@
#include <errno.h>
#include <nuttx/fs/fs.h>
#include <nuttx/drivers/drivers.h>
#include <nuttx/semaphore.h>
#include "pipe_common.h"

View File

@ -83,7 +83,6 @@
#include <nuttx/kmalloc.h>
#include <nuttx/semaphore.h>
#include <nuttx/fs/fs.h>
#include <nuttx/drivers/drivers.h>
#include <nuttx/serial/pty.h>
#include "pty.h"

View File

@ -217,72 +217,6 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset,
ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset,
size_t len);
/****************************************************************************
* Name: nx_pipe
*
* Description:
* nx_pipe() creates a pair of file descriptors, pointing to a pipe inode,
* and places them in the array pointed to by 'fd'. fd[0] is for reading,
* fd[1] is for writing.
*
* NOTE: nx_pipe is a special, non-standard, NuttX-only interface. Since
* the NuttX FIFOs are based in in-memory, circular buffers, the ability
* to control the size of those buffers is critical for system tuning.
*
* Input Parameters:
* fd[2] - The user provided array in which to catch the pipe file
* descriptors
* bufsize - The size of the in-memory, circular buffer in bytes.
* flags - The file status flags.
*
* Returned Value:
* 0 is returned on success; a negated errno value is returned on a
* failure.
*
****************************************************************************/
#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
int nx_pipe(int fd[2], size_t bufsize, int flags);
#endif
/****************************************************************************
* Name: nx_mkfifo
*
* Description:
* nx_mkfifo() makes a FIFO device driver file with name 'pathname.' Unlike
* Linux, a NuttX FIFO is not a special file type but simply a device
* driver instance. 'mode' specifies the FIFO's permissions.
*
* Once the FIFO has been created by nx_mkfifo(), any thread can open it
* for reading or writing, in the same way as an ordinary file. However, it
* must have been opened from both reading and writing before input or
* output can be performed. This FIFO implementation will block all
* attempts to open a FIFO read-only until at least one thread has opened
* the FIFO for writing.
*
* If all threads that write to the FIFO have closed, subsequent calls to
* read() on the FIFO will return 0 (end-of-file).
*
* NOTE: nx_mkfifo is a special, non-standard, NuttX-only interface. Since
* the NuttX FIFOs are based in in-memory, circular buffers, the ability
* to control the size of those buffers is critical for system tuning.
*
* Input Parameters:
* pathname - The full path to the FIFO instance to attach to or to create
* (if not already created).
* mode - Ignored for now
* bufsize - The size of the in-memory, circular buffer in bytes.
*
* Returned Value:
* 0 is returned on success; a negated errno value is returned on a
* failure.
*
****************************************************************************/
#if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0
int nx_mkfifo(FAR const char *pathname, mode_t mode, size_t bufsize);
#endif
#undef EXTERN
#if defined(__cplusplus)
}

View File

@ -1467,6 +1467,72 @@ int nx_stat(FAR const char *path, FAR struct stat *buf, int resolve);
int nx_unlink(FAR const char *pathname);
/****************************************************************************
* Name: nx_pipe
*
* Description:
* nx_pipe() creates a pair of file descriptors, pointing to a pipe inode,
* and places them in the array pointed to by 'fd'. fd[0] is for reading,
* fd[1] is for writing.
*
* NOTE: nx_pipe is a special, non-standard, NuttX-only interface. Since
* the NuttX FIFOs are based in in-memory, circular buffers, the ability
* to control the size of those buffers is critical for system tuning.
*
* Input Parameters:
* fd[2] - The user provided array in which to catch the pipe file
* descriptors
* bufsize - The size of the in-memory, circular buffer in bytes.
* flags - The file status flags.
*
* Returned Value:
* 0 is returned on success; a negated errno value is returned on a
* failure.
*
****************************************************************************/
#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
int nx_pipe(int fd[2], size_t bufsize, int flags);
#endif
/****************************************************************************
* Name: nx_mkfifo
*
* Description:
* nx_mkfifo() makes a FIFO device driver file with name 'pathname.' Unlike
* Linux, a NuttX FIFO is not a special file type but simply a device
* driver instance. 'mode' specifies the FIFO's permissions.
*
* Once the FIFO has been created by nx_mkfifo(), any thread can open it
* for reading or writing, in the same way as an ordinary file. However, it
* must have been opened from both reading and writing before input or
* output can be performed. This FIFO implementation will block all
* attempts to open a FIFO read-only until at least one thread has opened
* the FIFO for writing.
*
* If all threads that write to the FIFO have closed, subsequent calls to
* read() on the FIFO will return 0 (end-of-file).
*
* NOTE: nx_mkfifo is a special, non-standard, NuttX-only interface. Since
* the NuttX FIFOs are based in in-memory, circular buffers, the ability
* to control the size of those buffers is critical for system tuning.
*
* Input Parameters:
* pathname - The full path to the FIFO instance to attach to or to create
* (if not already created).
* mode - Ignored for now
* bufsize - The size of the in-memory, circular buffer in bytes.
*
* Returned Value:
* 0 is returned on success; a negated errno value is returned on a
* failure.
*
****************************************************************************/
#if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0
int nx_mkfifo(FAR const char *pathname, mode_t mode, size_t bufsize);
#endif
#undef EXTERN
#if defined(__cplusplus)
}

View File

@ -43,7 +43,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <nuttx/drivers/drivers.h>
#include <nuttx/fs/fs.h>
#if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0

View File

@ -27,7 +27,7 @@
#include <errno.h>
#include <unistd.h>
#include <nuttx/drivers/drivers.h>
#include <nuttx/fs/fs.h>
#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0

View File

@ -27,7 +27,7 @@
#include <errno.h>
#include <unistd.h>
#include <nuttx/drivers/drivers.h>
#include <nuttx/fs/fs.h>
#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0

View File

@ -63,8 +63,8 @@
"mq_timedsend","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","FAR const char *","size_t","unsigned int","FAR const struct timespec *"
"mq_unlink","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","FAR const char *"
"munmap","sys/mman.h","defined(CONFIG_FS_RAMMAP)","int","FAR void *","size_t"
"nx_mkfifo","nuttx/drivers/drivers.h","defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0","int","FAR const char *","mode_t","size_t"
"nx_pipe","nuttx/drivers/drivers.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","size_t","int"
"nx_mkfifo","nuttx/fs/fs.h","defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0","int","FAR const char *","mode_t","size_t"
"nx_pipe","nuttx/fs/fs.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","size_t","int"
"nx_task_spawn","nuttx/spawn.h","defined(CONFIG_LIB_SYSCALL) && !defined(CONFIG_BUILD_KERNEL)","int","FAR const struct spawn_syscall_parms_s *"
"nx_vsyslog","nuttx/syslog/syslog.h","","int","int","FAR const IPTR char *","FAR va_list *"
"nxsched_get_stackinfo","nuttx/sched.h","","int","pid_t","FAR struct stackinfo_s *"

Can't render this file because it has a wrong number of fields in line 2.