xiaoxiang781216 commented on code in PR #8645:
URL: https://github.com/apache/nuttx/pull/8645#discussion_r1125441753


##########
sched/mutex/mutex_reset.c:
##########
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * sched/mutex/mutex_reset.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/mutex.h>
+
+#include "mutex.h"
+
+#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)

Review Comment:
   don't need since the code neve build in userspace now.



##########
sched/mutex/mutex.h:
##########
@@ -0,0 +1,56 @@
+/****************************************************************************
+ * sched/mutex/mutex.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __SCHED_MUTEX_MUTEX_H
+#define __SCHED_MUTEX_MUTEX_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/mutex.h>
+
+#include <stdbool.h>
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)

Review Comment:
   remove the condition check which is redundant now.



##########
syscall/syscall.csv:
##########
@@ -70,6 +70,28 @@
 "mq_timedsend","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","FAR 
const char *","size_t","unsigned int","FAR const struct timespec *"
 "mq_unlink","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","FAR const char 
*"
 "munmap","sys/mman.h","","int","FAR void *","size_t"
+"nxmutex_init","nuttx/mutex.h","","int","FAR mutex_t *"

Review Comment:
   move after line 98 and keep the new entry in order.



##########
include/sys/syscall_lookup.h:
##########
@@ -380,3 +380,26 @@ SYSCALL_LOOKUP(munmap,                     2)
 #ifdef CONFIG_CRYPTO_RANDOM_POOL
   SYSCALL_LOOKUP(arc4random_buf,           2)
 #endif
+
+SYSCALL_LOOKUP(nxmutex_init,               1)
+SYSCALL_LOOKUP(nxmutex_destroy,            1)
+SYSCALL_LOOKUP(nxmutex_is_locked,          1)
+SYSCALL_LOOKUP(nxmutex_is_hold,            1)
+SYSCALL_LOOKUP(nxmutex_lock,               1)
+SYSCALL_LOOKUP(nxmutex_timedlock,          2)
+SYSCALL_LOOKUP(nxmutex_clocklock,          2)
+SYSCALL_LOOKUP(nxmutex_trylock,            1)
+SYSCALL_LOOKUP(nxmutex_unlock,             1)
+SYSCALL_LOOKUP(nxmutex_breaklock,          2)
+SYSCALL_LOOKUP(nxmutex_restorelock,        2)
+SYSCALL_LOOKUP(nxmutex_set_protocol,       2)
+SYSCALL_LOOKUP(nxmutex_get_protocol,       2)
+SYSCALL_LOOKUP(nxrmutex_init,              1)
+SYSCALL_LOOKUP(nxrmutex_destroy,           1)
+SYSCALL_LOOKUP(nxrmutex_lock,              1)
+SYSCALL_LOOKUP(nxrmutex_timedlock,         2)
+SYSCALL_LOOKUP(nxrmutex_clocklock,         2)
+SYSCALL_LOOKUP(nxrmutex_trylock,           1)
+SYSCALL_LOOKUP(nxrmutex_unlock,            1)
+SYSCALL_LOOKUP(nxrmutex_breaklock,         2)
+SYSCALL_LOOKUP(nxrmutex_restorelock,       2)

Review Comment:
   let's keep order



##########
include/sys/syscall_lookup.h:
##########
@@ -380,3 +380,26 @@ SYSCALL_LOOKUP(munmap,                     2)
 #ifdef CONFIG_CRYPTO_RANDOM_POOL
   SYSCALL_LOOKUP(arc4random_buf,           2)
 #endif
+
+SYSCALL_LOOKUP(nxmutex_init,               1)

Review Comment:
   function which doesn't touch kernel space data or function should move to 
libs/libc/mutex. nxmutex_init is one of example.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to