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


The following commit(s) were added to refs/heads/master by this push:
     new d09c4b5c3c6 inode:use inode_addref API instead of atomic API
d09c4b5c3c6 is described below

commit d09c4b5c3c6677e6086cf3b3ececb3e2f313dff6
Author: guohao15 <[email protected]>
AuthorDate: Wed Jun 25 17:05:47 2025 +0800

    inode:use inode_addref API instead of atomic API
    
    The open paths of named events, message queues, named semaphores and
    shared memory objects took the inode reference with an open-coded
    atomic_add() on i_crefs.  Use inode_addref(), the helper the rest of
    the VFS uses for this.  No functional change.
    
    Signed-off-by: guohao15 <[email protected]>
    Signed-off-by: jingfei <[email protected]>
---
 fs/event/event_open.c   | 2 +-
 fs/mqueue/mq_open.c     | 2 +-
 fs/semaphore/sem_open.c | 2 +-
 fs/shm/shm_open.c       | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/event/event_open.c b/fs/event/event_open.c
index f6d40d7b953..0459b75775e 100644
--- a/fs/event/event_open.c
+++ b/fs/event/event_open.c
@@ -188,7 +188,7 @@ int nxevent_open(FAR nxevent_t **event, FAR const char 
*name,
           /* Initialize the inode */
 
           INODE_SET_NAMEDEVENT(inode);
-          atomic_add(&inode->i_crefs, 1);
+          inode_addref(inode);
 
           /* Initialize the event groups */
 
diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c
index 203522062f6..0d3e5de1c3f 100644
--- a/fs/mqueue/mq_open.c
+++ b/fs/mqueue/mq_open.c
@@ -336,7 +336,7 @@ retry:
 
           /* Set the initial reference count on this inode to one */
 
-          atomic_add(&inode->i_crefs, 1);
+          inode_addref(inode);
         }
 
       inode_unlock();
diff --git a/fs/semaphore/sem_open.c b/fs/semaphore/sem_open.c
index f39f6f2e5e3..f4a635d93b5 100644
--- a/fs/semaphore/sem_open.c
+++ b/fs/semaphore/sem_open.c
@@ -213,7 +213,7 @@ int nxsem_open(FAR sem_t **sem, FAR const char *name, int 
oflags, ...)
           /* Initialize the inode */
 
           INODE_SET_NAMEDSEM(inode);
-          atomic_add(&inode->i_crefs, 1);
+          inode_addref(inode);
 
           /* Initialize the semaphore */
 
diff --git a/fs/shm/shm_open.c b/fs/shm/shm_open.c
index e2a963ba9ec..3e9fb035973 100644
--- a/fs/shm/shm_open.c
+++ b/fs/shm/shm_open.c
@@ -158,7 +158,7 @@ static int file_shm_open(FAR struct file *shm, FAR const 
char *name,
       INODE_SET_SHM(inode);
       inode->u.i_ops = &g_shmfs_operations;
       inode->i_private = NULL;
-      atomic_add(&inode->i_crefs, 1);
+      inode_addref(inode);
     }
 
   /* Associate the inode with a file structure */

Reply via email to