Soft links: Fix compile problems on first build with soft links enabled.
This commit is contained in:
parent
bdc002fadc
commit
35d738d85f
6 changed files with 19 additions and 17 deletions
|
@ -42,8 +42,7 @@ config DISABLE_PSEUDOFS_OPERATIONS
|
|||
|
||||
config PSEUDOFS_SOFTLINKS
|
||||
bool "Pseudo-filesystem soft links"
|
||||
default y if DEFAULT_SMALL
|
||||
default n if !DEFAULT_SMALL
|
||||
default n
|
||||
depends on !DISABLE_PSEUDOFS_OPERATIONS
|
||||
---help---
|
||||
Enable support for soft links in the pseudeo file system. Soft
|
||||
|
|
|
@ -196,7 +196,8 @@ _inode_dereference(FAR struct inode *node, FAR struct inode **peer,
|
|||
|
||||
while (node != NULL && INODE_IS_SOFTLINK(node))
|
||||
{
|
||||
node = inode_search_nofollow(node->u.i_link, peer, parent, relpath);
|
||||
node = inode_search_nofollow((FAR const char **)&node->u.i_link,
|
||||
peer, parent, relpath);
|
||||
if (++count > SYMLOOP_MAX)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -526,8 +527,8 @@ void inode_free(FAR struct inode *node)
|
|||
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
|
||||
/* Symbol links should never have peers or children */
|
||||
|
||||
DEBUGASSERT(!INODE_IS_SOFTLINK(node)) ||
|
||||
(node->i_peer == NULL && node->i_child == NULL)
|
||||
DEBUGASSERT(!INODE_IS_SOFTLINK(node) ||
|
||||
(node->i_peer == NULL && node->i_child == NULL));
|
||||
#endif
|
||||
|
||||
/* Free all peers and children of this i_node */
|
||||
|
@ -540,7 +541,7 @@ void inode_free(FAR struct inode *node)
|
|||
* entity.
|
||||
*/
|
||||
|
||||
if (INODE_IS_SOFTLINK(node) && inode->u.i_link != NULL)
|
||||
if (INODE_IS_SOFTLINK(node) && node->u.i_link != NULL)
|
||||
{
|
||||
kmm_free(node->u.i_link);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath)
|
|||
|
||||
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
|
||||
FAR struct inode *inode_find_nofollow(FAR const char *path,
|
||||
FARconst char **relpath)
|
||||
FAR const char **relpath)
|
||||
{
|
||||
FAR struct inode *node;
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ FAR struct inode *inode_search(FAR const char **path,
|
|||
FAR struct inode *inode_search_nofollow(FAR const char **path,
|
||||
FAR struct inode **peer,
|
||||
FAR struct inode **parent,
|
||||
FAR const char **relpath)
|
||||
FAR const char **relpath);
|
||||
#else
|
||||
# define inode_search_nofollow(p,l,a,r) inode_search(p,l,a,r)
|
||||
#endif
|
||||
|
@ -234,7 +234,7 @@ FAR struct inode *inode_find(FAR const char *path, FAR const char **relpath);
|
|||
|
||||
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
|
||||
FAR struct inode *inode_find_nofollow(FAR const char *path,
|
||||
FARconst char **relpath);
|
||||
FAR const char **relpath);
|
||||
#else
|
||||
# define inode_find_nofollow(p,r) inode_find(p,r)
|
||||
#endif
|
||||
|
|
|
@ -41,8 +41,10 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "inode/inode.h"
|
||||
|
@ -94,7 +96,7 @@ int link(FAR const char *path1, FAR const char *path2)
|
|||
|
||||
if (path2 == NULL || *path2 != '/')
|
||||
{
|
||||
errode = EINVAL;
|
||||
errcode = EINVAL;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
@ -102,7 +104,7 @@ int link(FAR const char *path1, FAR const char *path2)
|
|||
* does not lie on a mounted volume.
|
||||
*/
|
||||
|
||||
inode = inode_find(pathname, NULL);
|
||||
inode = inode_find(path1, NULL);
|
||||
if (inode != NULL)
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
|
@ -110,7 +112,7 @@ int link(FAR const char *path1, FAR const char *path2)
|
|||
|
||||
if (INODE_IS_MOUNTPT(inode))
|
||||
{
|
||||
/* Symbol links within the mounted volume are not supported */
|
||||
/* Symbolic links within the mounted volume are not supported */
|
||||
|
||||
errcode = ENOSYS;
|
||||
}
|
||||
|
@ -119,7 +121,7 @@ int link(FAR const char *path1, FAR const char *path2)
|
|||
{
|
||||
/* A node already exists in the pseudofs at 'path2' */
|
||||
|
||||
errorcode = EEXIST;
|
||||
errcode = EEXIST;
|
||||
}
|
||||
|
||||
goto errout_with_inode;
|
||||
|
@ -133,7 +135,7 @@ int link(FAR const char *path1, FAR const char *path2)
|
|||
{
|
||||
/* Copy path2 */
|
||||
|
||||
FAR char newpath2 = strdup(path2);
|
||||
FAR char *newpath2 = strdup(path2);
|
||||
if (newpath2 == NULL)
|
||||
{
|
||||
errcode = ENOMEM;
|
||||
|
@ -146,12 +148,12 @@ int link(FAR const char *path1, FAR const char *path2)
|
|||
*/
|
||||
|
||||
inode_semtake();
|
||||
ret = inode_reserve(pathname, &inode);
|
||||
ret = inode_reserve(path1, &inode);
|
||||
inode_semgive();
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
kmm_free(newpath2)
|
||||
kmm_free(newpath2);
|
||||
errcode = -ret;
|
||||
goto errout;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
#define INODE_SET_DRIVER(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_DRIVER)
|
||||
#define INODE_SET_BLOCK(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_BLOCK)
|
||||
#define INODE_SET_MOUNTPT(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_MOUNTPT)
|
||||
#define (i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_SOFTLINK)
|
||||
#define INODE_SET_SOFTLINK(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_SOFTLINK)
|
||||
#define INODE_SET_NAMEDSEM(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_NAMEDSEM)
|
||||
#define INODE_SET_MQUEUE(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_MQUEUE)
|
||||
#define INODE_SET_SHM(i) INODE_SET_TYPE(i,FSNODEFLAG_TYPE_SHM)
|
||||
|
|
Loading…
Reference in a new issue