Add macros support that will eventually allow dynamic allocation of strings need to support soft links.

This commit is contained in:
Gregory Nutt
2017-02-05 14:25:45 -06:00
parent 8f2c7198ed
commit 45fd98da88
24 changed files with 316 additions and 258 deletions
+6 -2
View File
@@ -133,8 +133,7 @@ mqd_t mq_open(FAR const char *mq_name, int oflags, ...)
* have incremented the reference count on the inode.
*/
RESET_SEARCH(&desc);
desc.path = fullpath;
SETUP_SEARCH(&desc, fullpath, false);
ret = inode_find(&desc);
if (ret >= 0)
@@ -236,16 +235,21 @@ mqd_t mq_open(FAR const char *mq_name, int oflags, ...)
inode->i_crefs = 1;
}
RELEASE_SEARCH(&desc);
sched_unlock();
return mqdes;
errout_with_msgq:
mq_msgqfree(msgq);
inode->u.i_mqueue = NULL;
errout_with_inode:
inode_release(inode);
errout_with_lock:
RELEASE_SEARCH(&desc);
sched_unlock();
errout:
set_errno(errcode);
return (mqd_t)ERROR;
+7 -4
View File
@@ -87,8 +87,7 @@ int mq_unlink(FAR const char *mq_name)
/* Get the inode for this message queue. */
RESET_SEARCH(&desc);
desc.path = fullpath;
SETUP_SEARCH(&desc, fullpath, false);
sched_lock();
ret = inode_find(&desc);
@@ -97,7 +96,7 @@ int mq_unlink(FAR const char *mq_name)
/* There is no inode that includes in this path */
errcode = -ret;
goto errout;
goto errout_with_search;
}
/* Get the search results */
@@ -149,14 +148,18 @@ int mq_unlink(FAR const char *mq_name)
inode_semgive();
mq_inode_release(inode);
RELEASE_SEARCH(&desc);
sched_unlock();
return OK;
errout_with_semaphore:
inode_semgive();
errout_with_inode:
inode_release(inode);
errout:
errout_with_search:
RELEASE_SEARCH(&desc);
set_errno(errcode);
sched_unlock();
return ERROR;