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
+12 -4
View File
@@ -89,8 +89,8 @@
mqd_t mq_open(FAR const char *mq_name, int oflags, ...)
{
FAR struct inode *inode;
FAR const char *relpath = NULL;
FAR struct mqueue_inode_s *msgq;
struct inode_search_s desc;
char fullpath[MAX_MQUEUE_PATH];
va_list ap;
struct mq_attr *attr;
@@ -133,10 +133,18 @@ mqd_t mq_open(FAR const char *mq_name, int oflags, ...)
* have incremented the reference count on the inode.
*/
inode = inode_find(fullpath, &relpath, false);
if (inode)
RESET_SEARCH(&desc);
desc.path = fullpath;
ret = inode_find(&desc);
if (ret >= 0)
{
/* It exists. Verify that the inode is a message queue */
/* Something exists at this path. Get the search results */
inode = desc.node;
DEBUGASSERT(inode != NULL);
/* Verify that the inode is a message queue */
if (!INODE_IS_MQUEUE(inode))
{