fs: Add parent node of inode
N/A Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com> Change-Id: I006c6172ced8edd47b9d4661880e04d3a4274854
This commit is contained in:
parent
ee767021b3
commit
b7653e2fae
@ -94,7 +94,8 @@ FAR struct inode *inode_unlink(FAR const char *path)
|
|||||||
desc.parent->i_child = node->i_peer;
|
desc.parent->i_child = node->i_peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
node->i_peer = NULL;
|
node->i_peer = NULL;
|
||||||
|
node->i_parent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RELEASE_SEARCH(&desc);
|
RELEASE_SEARCH(&desc);
|
||||||
|
@ -98,8 +98,9 @@ static void inode_insert(FAR struct inode *node,
|
|||||||
|
|
||||||
if (peer)
|
if (peer)
|
||||||
{
|
{
|
||||||
node->i_peer = peer->i_peer;
|
node->i_peer = peer->i_peer;
|
||||||
peer->i_peer = node;
|
node->i_parent = parent;
|
||||||
|
peer->i_peer = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then it must go at the head of parent's list of children. */
|
/* Then it must go at the head of parent's list of children. */
|
||||||
@ -108,6 +109,7 @@ static void inode_insert(FAR struct inode *node,
|
|||||||
{
|
{
|
||||||
DEBUGASSERT(parent != NULL);
|
DEBUGASSERT(parent != NULL);
|
||||||
node->i_peer = parent->i_child;
|
node->i_peer = parent->i_child;
|
||||||
|
node->i_parent = parent;
|
||||||
parent->i_child = node;
|
parent->i_child = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,8 @@ next_subdir:
|
|||||||
|
|
||||||
/* Remove all of the children from the unlinked inode */
|
/* Remove all of the children from the unlinked inode */
|
||||||
|
|
||||||
oldinode->i_child = NULL;
|
oldinode->i_child = NULL;
|
||||||
|
oldinode->i_parent = NULL;
|
||||||
ret = OK;
|
ret = OK;
|
||||||
|
|
||||||
errout_with_sem:
|
errout_with_sem:
|
||||||
|
@ -347,6 +347,7 @@ union inode_ops_u
|
|||||||
|
|
||||||
struct inode
|
struct inode
|
||||||
{
|
{
|
||||||
|
FAR struct inode *i_parent; /* Link to parent level inode */
|
||||||
FAR struct inode *i_peer; /* Link to same level inode */
|
FAR struct inode *i_peer; /* Link to same level inode */
|
||||||
FAR struct inode *i_child; /* Link to lower level inode */
|
FAR struct inode *i_child; /* Link to lower level inode */
|
||||||
int16_t i_crefs; /* References to inode */
|
int16_t i_crefs; /* References to inode */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user