fs: Remove the unused nx_pipe to prefer file_pipe for kernel
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
fc1efe2c0b
commit
19bded4738
@ -167,26 +167,21 @@ static int pipe_register(size_t bufsize, int flags,
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nx_pipe
|
||||
* Name: pipe2
|
||||
*
|
||||
* Description:
|
||||
* nx_pipe() creates a pair of file descriptors, pointing to a pipe inode,
|
||||
* pipe2() 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.
|
||||
* 0 is returned on success; -1 (ERROR) is returned on a failure
|
||||
* with the errno value set appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -232,34 +227,33 @@ errout_with_driver:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int nx_pipe(int fd[2], size_t bufsize, int flags)
|
||||
int pipe2(int fd[2], int flags)
|
||||
{
|
||||
char devname[32];
|
||||
int ret;
|
||||
|
||||
/* Register a new pipe device */
|
||||
|
||||
ret = pipe_register(bufsize, flags, devname, sizeof(devname));
|
||||
ret = pipe_register(CONFIG_DEV_PIPE_SIZE, flags, devname, sizeof(devname));
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
set_errno(-ret);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* Get a write file descriptor */
|
||||
|
||||
fd[1] = nx_open(devname, O_WRONLY | flags);
|
||||
fd[1] = open(devname, O_WRONLY | flags);
|
||||
if (fd[1] < 0)
|
||||
{
|
||||
ret = fd[1];
|
||||
goto errout_with_driver;
|
||||
}
|
||||
|
||||
/* Get a read file descriptor */
|
||||
|
||||
fd[0] = nx_open(devname, O_RDONLY | flags);
|
||||
fd[0] = open(devname, O_RDONLY | flags);
|
||||
if (fd[0] < 0)
|
||||
{
|
||||
ret = fd[0];
|
||||
goto errout_with_wrfd;
|
||||
}
|
||||
|
||||
@ -273,7 +267,7 @@ errout_with_wrfd:
|
||||
|
||||
errout_with_driver:
|
||||
unregister_driver(devname);
|
||||
return ret;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DEV_PIPE_SIZE > 0 */
|
||||
|
@ -1402,19 +1402,15 @@ int file_fchstat(FAR struct file *filep, FAR struct stat *buf, int flags);
|
||||
int nx_unlink(FAR const char *pathname);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nx_pipe
|
||||
* Name: file_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.
|
||||
* file_pipe() creates a pair of file descriptors, pointing to a pipe
|
||||
* inode, and places them in the array pointed to by 'filep'. filep[0]
|
||||
* is for reading, filep[1] is for writing.
|
||||
*
|
||||
* Input Parameters:
|
||||
* fd[2] - The user provided array in which to catch the pipe file
|
||||
* filep[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.
|
||||
@ -1427,7 +1423,6 @@ int nx_unlink(FAR const char *pathname);
|
||||
|
||||
#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
|
||||
int file_pipe(FAR struct file *filep[2], size_t bufsize, int flags);
|
||||
int nx_pipe(int fd[2], size_t bufsize, int flags);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -258,7 +258,7 @@ SYSCALL_LOOKUP(futimens, 2)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
|
||||
SYSCALL_LOOKUP(nx_pipe, 3)
|
||||
SYSCALL_LOOKUP(pipe2, 2)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0
|
||||
|
@ -352,7 +352,7 @@ FAR void *sbrk(intptr_t incr);
|
||||
|
||||
/* Special devices */
|
||||
|
||||
int pipe(int fd[2]);
|
||||
#define pipe(fd) pipe2(fd, 0)
|
||||
int pipe2(int pipefd[2], int flags);
|
||||
|
||||
/* Schedule an alarm */
|
||||
|
@ -151,8 +151,6 @@
|
||||
"ntohl","arpa/inet.h","","uint32_t","uint32_t"
|
||||
"ntohs","arpa/inet.h","","uint16_t","uint16_t"
|
||||
"perror","stdio.h","defined(CONFIG_FILE_STREAM)","void","FAR const char *"
|
||||
"pipe","unistd.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *"
|
||||
"pipe2","unistd.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","int"
|
||||
"posix_fallocate","fcntl.h","","int","off_t","off_t"
|
||||
"preadv","sys/uio.h","","ssize_t","int","FAR const struct iovec *","int","off_t"
|
||||
"printf","stdio.h","","int","FAR const IPTR char *","..."
|
||||
|
Can't render this file because it has a wrong number of fields in line 2.
|
@ -46,10 +46,6 @@ ifneq ($(CONFIG_DISABLE_MOUNTPOINTS),y)
|
||||
CSRCS += lib_truncate.c lib_posix_fallocate.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PIPES),y)
|
||||
CSRCS += lib_pipe.c lib_pipe2.c
|
||||
endif
|
||||
|
||||
# Add the unistd directory to the build
|
||||
|
||||
DEPPATH += --dep-path unistd
|
||||
|
@ -1,70 +0,0 @@
|
||||
/****************************************************************************
|
||||
* libs/libc/unistd/lib_pipe.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pipe
|
||||
*
|
||||
* Description:
|
||||
* 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.
|
||||
*
|
||||
* Input Parameters:
|
||||
* fd[2] - The user provided array in which to catch the pipe file
|
||||
* descriptors
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 is returned on success; otherwise, -1 is returned with errno set
|
||||
* appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int pipe(int fd[2])
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = nx_pipe(fd, CONFIG_DEV_PIPE_SIZE, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
set_errno(-ret);
|
||||
ret = ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PIPES && CONFIG_DEV_PIPE_SIZE > 0 */
|
@ -1,71 +0,0 @@
|
||||
/****************************************************************************
|
||||
* libs/libc/unistd/lib_pipe2.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#if defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pipe2
|
||||
*
|
||||
* Description:
|
||||
* pipe2() 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. If flags is 0, then pipe2() is the same as pipe().
|
||||
*
|
||||
* Input Parameters:
|
||||
* fd[2] - The user provided array in which to catch the pipe file
|
||||
* descriptors
|
||||
* flags - The file status flags.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 is returned on success; otherwise, -1 is returned with errno set
|
||||
* appropriately.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int pipe2(int fd[2], int flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = nx_pipe(fd, CONFIG_DEV_PIPE_SIZE, flags);
|
||||
if (ret < 0)
|
||||
{
|
||||
set_errno(-ret);
|
||||
ret = ERROR;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PIPES && CONFIG_DEV_PIPE_SIZE > 0 */
|
@ -69,7 +69,6 @@
|
||||
"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/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_pthread_create","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_trampoline_t","FAR pthread_t *","FAR const pthread_attr_t *","pthread_startroutine_t","pthread_addr_t"
|
||||
"nx_pthread_exit","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","noreturn","pthread_addr_t"
|
||||
"nx_vsyslog","nuttx/syslog/syslog.h","","int","int","FAR const IPTR char *","FAR va_list *"
|
||||
@ -77,6 +76,7 @@
|
||||
"nxsched_get_streams","nuttx/sched.h","defined(CONFIG_FILE_STREAM)","FAR struct streamlist *"
|
||||
"open","fcntl.h","","int","FAR const char *","int","...","mode_t"
|
||||
"pgalloc", "nuttx/arch.h", "defined(CONFIG_BUILD_KERNEL)", "uintptr_t", "uintptr_t", "unsigned int"
|
||||
"pipe2","unistd.h","defined(CONFIG_PIPES) && CONFIG_DEV_PIPE_SIZE > 0","int","int [2]|FAR int *","int"
|
||||
"poll","poll.h","","int","FAR struct pollfd *","nfds_t","int"
|
||||
"posix_spawn","spawn.h","!defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_LIBC_EXECFUNCS)","int","FAR pid_t *","FAR const char *","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char * const []|FAR char * const *","FAR char * const []|FAR char * const *"
|
||||
"ppoll","poll.h","","int","FAR struct pollfd *","nfds_t","FAR const struct timespec *","FAR const sigset_t *"
|
||||
|
Can't render this file because it has a wrong number of fields in line 2.
|
Loading…
Reference in New Issue
Block a user