fs: Change inode_checkflags to static function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
66db15437d
commit
d84aba8a42
@ -167,16 +167,6 @@ int inode_lock(void);
|
||||
|
||||
void inode_unlock(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: inode_checkflags
|
||||
*
|
||||
* Description:
|
||||
* Check if the access described by 'oflags' is supported on 'inode'
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int inode_checkflags(FAR struct inode *inode, int oflags);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: inode_search
|
||||
*
|
||||
|
@ -43,6 +43,50 @@
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: inode_checkflags
|
||||
*
|
||||
* Description:
|
||||
* Check if the access described by 'oflags' is supported on 'inode'
|
||||
*
|
||||
* inode_checkflags() is an internal NuttX interface and should not be
|
||||
* called from applications.
|
||||
*
|
||||
* Input Parameters:
|
||||
* inode - The inode to check
|
||||
* oflags - open flags.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success. On failure, a negated errno value is
|
||||
* returned.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int inode_checkflags(FAR struct inode *inode, int oflags)
|
||||
{
|
||||
FAR const struct file_operations *ops = inode->u.i_ops;
|
||||
|
||||
if (INODE_IS_PSEUDODIR(inode))
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
if (ops == NULL)
|
||||
{
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
if (((oflags & O_RDOK) != 0 && !ops->read && !ops->ioctl) ||
|
||||
((oflags & O_WROK) != 0 && !ops->write && !ops->ioctl))
|
||||
{
|
||||
return -EACCES;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_vopen
|
||||
****************************************************************************/
|
||||
@ -275,50 +319,6 @@ static int nx_vopen(FAR struct tcb_s *tcb,
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: inode_checkflags
|
||||
*
|
||||
* Description:
|
||||
* Check if the access described by 'oflags' is supported on 'inode'
|
||||
*
|
||||
* inode_checkflags() is an internal NuttX interface and should not be
|
||||
* called from applications.
|
||||
*
|
||||
* Input Parameters:
|
||||
* inode - The inode to check
|
||||
* oflags - open flags.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success. On failure, a negated errno value is
|
||||
* returned.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int inode_checkflags(FAR struct inode *inode, int oflags)
|
||||
{
|
||||
FAR const struct file_operations *ops = inode->u.i_ops;
|
||||
|
||||
if (INODE_IS_PSEUDODIR(inode))
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
if (ops == NULL)
|
||||
{
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
if (((oflags & O_RDOK) != 0 && !ops->read && !ops->ioctl) ||
|
||||
((oflags & O_WROK) != 0 && !ops->write && !ops->ioctl))
|
||||
{
|
||||
return -EACCES;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_open
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user