FS: Argument is now a structure describing the search.

This commit is contained in:
Gregory Nutt
2017-02-04 11:21:44 -06:00
parent 8437650fc2
commit 36704b7d9c
10 changed files with 335 additions and 231 deletions
+30 -32
View File
@@ -83,11 +83,6 @@ static inline int statpseudo(FAR struct inode *inode, FAR struct stat *buf)
}
else
#endif
{
}
}
else if (inode->u.i_ops != NULL)
{
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
/* Handle softlinks differently. Just call stat() recursively on the
* target of the softlink.
@@ -124,39 +119,42 @@ static inline int statpseudo(FAR struct inode *inode, FAR struct stat *buf)
}
else
#endif
{
}
}
else if (inode->u.i_ops != NULL)
{
/* Determine read/write privileges based on the existence of read
* and write methods.
*/
if (inode->u.i_ops->read)
{
/* Determine read/write privileges based on the existence of read
* and write methods.
*/
buf->st_mode = S_IROTH | S_IRGRP | S_IRUSR;
}
if (inode->u.i_ops->read)
{
buf->st_mode = S_IROTH | S_IRGRP | S_IRUSR;
}
if (inode->u.i_ops->write)
{
buf->st_mode |= S_IWOTH | S_IWGRP | S_IWUSR;
}
if (inode->u.i_ops->write)
{
buf->st_mode |= S_IWOTH | S_IWGRP | S_IWUSR;
}
/* Determine the type of the inode */
/* Determine the type of the inode */
if (INODE_IS_MOUNTPT(inode))
{
buf->st_mode |= S_IFDIR;
}
else if (INODE_IS_BLOCK(inode))
{
/* What is if also has child inodes? */
if (INODE_IS_MOUNTPT(inode))
{
buf->st_mode |= S_IFDIR;
}
else if (INODE_IS_BLOCK(inode))
{
/* What is if also has child inodes? */
buf->st_mode |= S_IFBLK;
}
else /* if (INODE_IS_DRIVER(inode)) */
{
/* What is it if it also has child inodes? */
buf->st_mode |= S_IFBLK;
}
else /* if (INODE_IS_DRIVER(inode)) */
{
/* What is it if it also has child inodes? */
buf->st_mode |= S_IFCHR;
}
buf->st_mode |= S_IFCHR;
}
}
else
+6
View File
@@ -130,7 +130,13 @@ int unlink(FAR const char *pathname)
* or a soft link, then rm should remove the node.
*/
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
/* A soft link is the only "specal" file that we can remove via unlink(). */
if (!INODE_IS_SPECIAL(inode) || INODE_IS_SOFTLINK(inode))
#else
if (!INODE_IS_SPECIAL(inode))
#endif
{
/* If this is a pseudo-file node (i.e., it has no operations)
* then unlink should remove the node.