inode_find: Now takes struct inode_desc_s type as input. This was necessary before that structure includes some data storage. It was used within inode_find(), but that means that the life of the data was the life of inode_find(). That data must persist longer. It is now provided by the caller so that the life of the data persists for the entire life of the caller.

This commit is contained in:
Gregory Nutt
2017-02-05 09:51:42 -06:00
parent 990bed903e
commit 8f2c7198ed
20 changed files with 284 additions and 129 deletions
+14 -6
View File
@@ -62,17 +62,20 @@ static int fat_attrib(const char *path, fat_attrib_t *retattrib,
{
struct fat_mountpt_s *fs;
struct fat_dirinfo_s dirinfo;
struct inode_search_s desc;
FAR struct inode *inode;
const char *relpath = NULL;
uint8_t *direntry;
uint8_t oldattributes;
uint8_t newattributes;
int ret;
/* Get an inode for this file */
/* Find the inode for this file */
inode = inode_find(path, &relpath, false);
if (!inode)
RESET_SEARCH(&desc);
desc.path = path;
ret = inode_find(&desc);
if (ret < 0)
{
/* There is no mountpoint that includes in this path */
@@ -80,6 +83,11 @@ static int fat_attrib(const char *path, fat_attrib_t *retattrib,
goto errout;
}
/* Get the search results */
inode = desc.node;
DEBUGASSERT(inode != NULL);
/* Verify that the inode is a valid mountpoint. */
if (!INODE_IS_MOUNTPT(inode) || !inode->u.i_mops || !inode->i_private)
@@ -101,9 +109,9 @@ static int fat_attrib(const char *path, fat_attrib_t *retattrib,
goto errout_with_semaphore;
}
/* Find the file/directory entry for the oldrelpath */
/* Find the file/directory entry for the relpath */
ret = fat_finddirentry(fs, &dirinfo, relpath);
ret = fat_finddirentry(fs, &dirinfo, desc.relpath);
if (ret != OK)
{
/* Some error occurred -- probably -ENOENT */