This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI 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 0763e0467f6 fs/inode: inline inode_addref
0763e0467f6 is described below
commit 0763e0467f66597c8e37a2487cb4c10ea05c981d
Author: zhangyu117 <[email protected]>
AuthorDate: Tue Mar 31 14:31:04 2026 +0800
fs/inode: inline inode_addref
Make the small inode reference increment helper available to its callers
through the private inode header. Keep its null check and atomic operation
unchanged, and remove the unused source file from both build systems.
Signed-off-by: zhangyu117 <[email protected]>
Signed-off-by: jingfei <[email protected]>
---
fs/inode/CMakeLists.txt | 1 -
fs/inode/Make.defs | 2 +-
fs/inode/fs_inodeaddref.c | 52 -----------------------------------------------
fs/inode/inode.h | 8 +++++++-
4 files changed, 8 insertions(+), 55 deletions(-)
diff --git a/fs/inode/CMakeLists.txt b/fs/inode/CMakeLists.txt
index 52a12b424d2..c2ba02385ef 100644
--- a/fs/inode/CMakeLists.txt
+++ b/fs/inode/CMakeLists.txt
@@ -25,7 +25,6 @@ target_sources(
PRIVATE fs_files.c
fs_foreachinode.c
fs_inode.c
- fs_inodeaddref.c
fs_inodebasename.c
fs_inodefind.c
fs_inodefree.c
diff --git a/fs/inode/Make.defs b/fs/inode/Make.defs
index 353ed11c3b1..c147755de9d 100644
--- a/fs/inode/Make.defs
+++ b/fs/inode/Make.defs
@@ -20,7 +20,7 @@
#
############################################################################
-CSRCS += fs_files.c fs_foreachinode.c fs_inode.c fs_inodeaddref.c
+CSRCS += fs_files.c fs_foreachinode.c fs_inode.c
CSRCS += fs_inodebasename.c fs_inodefind.c fs_inodefree.c fs_inodegetpath.c
CSRCS += fs_inoderelease.c fs_inoderemove.c fs_inodereserve.c fs_inodesearch.c
diff --git a/fs/inode/fs_inodeaddref.c b/fs/inode/fs_inodeaddref.c
deleted file mode 100644
index 2481de918e9..00000000000
--- a/fs/inode/fs_inodeaddref.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
- * fs/inode/fs_inodeaddref.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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/config.h>
-
-#include <errno.h>
-#include <nuttx/fs/fs.h>
-#include "inode/inode.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: inode_addref
- *
- * Description:
- * Increment the reference count on an inode (as when a file descriptor
- * is dup'ed).
- *
- ****************************************************************************/
-
-void inode_addref(FAR struct inode *inode)
-{
- if (inode)
- {
- atomic_add(&inode->i_crefs, 1);
- }
-}
diff --git a/fs/inode/inode.h b/fs/inode/inode.h
index 2ecdde4ea9d..008d94688bb 100644
--- a/fs/inode/inode.h
+++ b/fs/inode/inode.h
@@ -431,7 +431,13 @@ int inode_remove(FAR const char *path);
*
****************************************************************************/
-void inode_addref(FAR struct inode *inode);
+static inline void inode_addref(FAR struct inode *inode)
+{
+ if (inode)
+ {
+ atomic_add(&inode->i_crefs, 1);
+ }
+}
/****************************************************************************
* Name: inode_release