mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 05:55:46 +08:00
fs/vfs: Rename files_allocate to file_allocate
align with the intention better Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
126ce6428e
commit
4af98af376
+7
-3
@@ -155,16 +155,20 @@ void files_releaselist(FAR struct filelist *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: files_allocate
|
* Name: file_allocate
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Allocate a struct files instance and associate it with an inode
|
* Allocate a struct files instance and associate it with an inode
|
||||||
* instance. Returns the file descriptor == index into the files array.
|
* instance. Returns the file descriptor == index into the files array.
|
||||||
*
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure.
|
||||||
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int files_allocate(FAR struct inode *inode, int oflags, off_t pos,
|
int file_allocate(FAR struct inode *inode, int oflags, off_t pos,
|
||||||
FAR void *priv, int minfd)
|
FAR void *priv, int minfd)
|
||||||
{
|
{
|
||||||
FAR struct filelist *list;
|
FAR struct filelist *list;
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
+7
-3
@@ -408,16 +408,20 @@ void inode_release(FAR struct inode *inode);
|
|||||||
int foreach_inode(foreach_inode_t handler, FAR void *arg);
|
int foreach_inode(foreach_inode_t handler, FAR void *arg);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: files_allocate
|
* Name: file_allocate
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Allocate a struct files instance and associate it with an inode
|
* Allocate a struct files instance and associate it with an inode
|
||||||
* instance. Returns the file descriptor == index into the files array.
|
* instance. Returns the file descriptor == index into the files array.
|
||||||
*
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||||
|
* any failure.
|
||||||
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int files_allocate(FAR struct inode *inode, int oflags, off_t pos,
|
int file_allocate(FAR struct inode *inode, int oflags, off_t pos,
|
||||||
FAR void *priv, int minfd);
|
FAR void *priv, int minfd);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: dir_allocate
|
* Name: dir_allocate
|
||||||
|
|||||||
+1
-1
@@ -349,7 +349,7 @@ static mqd_t nxmq_vopen(FAR const char *mq_name, int oflags, va_list ap)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = files_allocate(mq.f_inode, mq.f_oflags, mq.f_pos, mq.f_priv, 0);
|
ret = file_allocate(mq.f_inode, mq.f_oflags, mq.f_pos, mq.f_priv, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
file_mq_close(&mq);
|
file_mq_close(&mq);
|
||||||
|
|||||||
+1
-1
@@ -165,7 +165,7 @@ int sockfd_allocate(FAR struct socket *psock, int oflags)
|
|||||||
{
|
{
|
||||||
int sockfd;
|
int sockfd;
|
||||||
|
|
||||||
sockfd = files_allocate(&g_sock_inode, oflags, 0, psock, 0);
|
sockfd = file_allocate(&g_sock_inode, oflags, 0, psock, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
inode_addref(&g_sock_inode);
|
inode_addref(&g_sock_inode);
|
||||||
|
|||||||
+2
-2
@@ -66,8 +66,8 @@ int file_dup(FAR struct file *filep, int minfd)
|
|||||||
|
|
||||||
/* Then allocate a new file descriptor for the inode */
|
/* Then allocate a new file descriptor for the inode */
|
||||||
|
|
||||||
fd2 = files_allocate(filep2.f_inode, filep2.f_oflags,
|
fd2 = file_allocate(filep2.f_inode, filep2.f_oflags,
|
||||||
filep2.f_pos, filep2.f_priv, minfd);
|
filep2.f_pos, filep2.f_priv, minfd);
|
||||||
if (fd2 < 0)
|
if (fd2 < 0)
|
||||||
{
|
{
|
||||||
file_close(&filep2);
|
file_close(&filep2);
|
||||||
|
|||||||
+1
-1
@@ -198,7 +198,7 @@ static int epoll_do_create(int size, int flags)
|
|||||||
|
|
||||||
/* Alloc the file descriptor */
|
/* Alloc the file descriptor */
|
||||||
|
|
||||||
fd = files_allocate(&g_epoll_inode, flags, 0, eph, 0);
|
fd = file_allocate(&g_epoll_inode, flags, 0, eph, 0);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
nxsem_destroy(&eph->sem);
|
nxsem_destroy(&eph->sem);
|
||||||
|
|||||||
+2
-2
@@ -245,8 +245,8 @@ static int nx_vopen(FAR const char *path, int oflags, va_list ap)
|
|||||||
|
|
||||||
/* Allocate a new file descriptor for the inode */
|
/* Allocate a new file descriptor for the inode */
|
||||||
|
|
||||||
fd = files_allocate(filep.f_inode, filep.f_oflags,
|
fd = file_allocate(filep.f_inode, filep.f_oflags,
|
||||||
filep.f_pos, filep.f_priv, 0);
|
filep.f_pos, filep.f_priv, 0);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
file_close(&filep);
|
file_close(&filep);
|
||||||
|
|||||||
Reference in New Issue
Block a user