This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 86b46210da66a9a30308e4632a2fdf70e5cd44c1
Author: ganjing <[email protected]>
AuthorDate: Wed Dec 3 20:45:51 2025 +0800

    libc/pthread: Rename the proto field of pthread_mutexattr_s to prio.
    
    The field holds one of the PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT and
    PTHREAD_PRIO_PROTECT values.  Name it prio after them, so that the
    name tells what the field selects.
    
    Assisted-by: Kiro:auto
    Signed-off-by: ganjing <[email protected]>
---
 include/pthread.h                                 | 2 +-
 libs/libc/pthread/pthread_mutex_init.c            | 4 ++--
 libs/libc/pthread/pthread_mutexattr_getprotocol.c | 4 ++--
 libs/libc/pthread/pthread_mutexattr_init.c        | 6 +++---
 libs/libc/pthread/pthread_mutexattr_setprotocol.c | 6 +++---
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/pthread.h b/include/pthread.h
index 314fc960f0e..48c6f196b76 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -265,7 +265,7 @@ struct pthread_mutexattr_s
 {
   uint8_t pshared : 1;  /* PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED */
 #if defined(CONFIG_PRIORITY_INHERITANCE) || defined(CONFIG_PRIORITY_PROTECT)
-  uint8_t proto   : 2;  /* See PTHREAD_PRIO_* definitions */
+  uint8_t prio    : 2;  /* See PTHREAD_PRIO_* definitions */
 #endif
 #ifdef CONFIG_PRIORITY_PROTECT
   uint8_t ceiling;      /* Priority ceiling */
diff --git a/libs/libc/pthread/pthread_mutex_init.c 
b/libs/libc/pthread/pthread_mutex_init.c
index 9c6529ce87a..f985c1b53b5 100644
--- a/libs/libc/pthread/pthread_mutex_init.c
+++ b/libs/libc/pthread/pthread_mutex_init.c
@@ -94,7 +94,7 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
   if (attr)
     {
       status = mutex_set_protocol(&mutex->mutex,
-                                  SEM_TYPE_MUTEX | attr->proto);
+                                  SEM_TYPE_MUTEX | attr->prio);
       if (status < 0)
         {
           mutex_destroy(&mutex->mutex);
@@ -102,7 +102,7 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
         }
 
 #  ifdef CONFIG_PRIORITY_PROTECT
-      if (attr->proto == PTHREAD_PRIO_PROTECT)
+      if (attr->prio == PTHREAD_PRIO_PROTECT)
         {
           status = mutex_setprioceiling(&mutex->mutex, attr->ceiling, NULL);
           if (status < 0)
diff --git a/libs/libc/pthread/pthread_mutexattr_getprotocol.c 
b/libs/libc/pthread/pthread_mutexattr_getprotocol.c
index f7ea7e50dd2..2a8d8727e48 100644
--- a/libs/libc/pthread/pthread_mutexattr_getprotocol.c
+++ b/libs/libc/pthread/pthread_mutexattr_getprotocol.c
@@ -56,8 +56,8 @@ int pthread_mutexattr_getprotocol(FAR const 
pthread_mutexattr_t *attr,
   DEBUGASSERT(attr != NULL && protocol != NULL);
 
 #if defined(CONFIG_PRIORITY_INHERITANCE) || defined(CONFIG_PRIORITY_PROTECT)
-  linfo("Returning %d\n", attr->proto);
-  *protocol = attr->proto;
+  linfo("Returning %d\n", attr->prio);
+  *protocol = attr->prio;
 #else
   linfo("Returning %d\n", PTHREAD_PRIO_NONE);
   *protocol = PTHREAD_PRIO_NONE;
diff --git a/libs/libc/pthread/pthread_mutexattr_init.c 
b/libs/libc/pthread/pthread_mutexattr_init.c
index 5e65b09414b..3ad9271509f 100644
--- a/libs/libc/pthread/pthread_mutexattr_init.c
+++ b/libs/libc/pthread/pthread_mutexattr_init.c
@@ -64,15 +64,15 @@ int pthread_mutexattr_init(FAR pthread_mutexattr_t *attr)
       attr->pshared = 0;
 
 #ifdef CONFIG_PRIORITY_PROTECT
-      attr->proto   = PTHREAD_PRIO_NONE;
+      attr->prio    = PTHREAD_PRIO_NONE;
       attr->ceiling = sched_get_priority_min(SCHED_FIFO);
 #endif
 
 #ifdef CONFIG_PRIORITY_INHERITANCE
 #  ifdef CONFIG_PTHREAD_MUTEX_DEFAULT_PRIO_INHERIT
-      attr->proto   = PTHREAD_PRIO_INHERIT;
+      attr->prio    = PTHREAD_PRIO_INHERIT;
 #  else
-      attr->proto   = PTHREAD_PRIO_NONE;
+      attr->prio    = PTHREAD_PRIO_NONE;
 #  endif
 #endif /* CONFIG_PRIORITY_INHERITANCE */
 
diff --git a/libs/libc/pthread/pthread_mutexattr_setprotocol.c 
b/libs/libc/pthread/pthread_mutexattr_setprotocol.c
index e38e674088f..3e8d2dff465 100644
--- a/libs/libc/pthread/pthread_mutexattr_setprotocol.c
+++ b/libs/libc/pthread/pthread_mutexattr_setprotocol.c
@@ -60,13 +60,13 @@ int pthread_mutexattr_setprotocol(FAR pthread_mutexattr_t 
*attr,
     {
       case PTHREAD_PRIO_NONE:
 #if defined(CONFIG_PRIORITY_INHERITANCE) || defined(CONFIG_PRIORITY_PROTECT)
-        attr->proto = PTHREAD_PRIO_NONE;
+        attr->prio = PTHREAD_PRIO_NONE;
 #endif
         break;
 
       case PTHREAD_PRIO_INHERIT:
 #ifdef CONFIG_PRIORITY_INHERITANCE
-        attr->proto = PTHREAD_PRIO_INHERIT;
+        attr->prio = PTHREAD_PRIO_INHERIT;
         break;
 #else
         return ENOTSUP;
@@ -74,7 +74,7 @@ int pthread_mutexattr_setprotocol(FAR pthread_mutexattr_t 
*attr,
 
       case PTHREAD_PRIO_PROTECT:
 #ifdef CONFIG_PRIORITY_PROTECT
-        attr->proto = PTHREAD_PRIO_PROTECT;
+        attr->prio = PTHREAD_PRIO_PROTECT;
         break;
 #else
         return ENOTSUP;

Reply via email to