Abhishekmishra2808 commented on code in PR #19599:
URL: https://github.com/apache/nuttx/pull/19599#discussion_r3698949542


##########
fs/inode/fs_inode.c:
##########
@@ -214,71 +214,117 @@ void inode_runlock(void)
 }
 
 /****************************************************************************
- * Name: inode_checkperm
+ * Name: inode_permission
  *
  * Description:
- *   Check 'inode' for 'amode' access on pseudo-filesystem inodes.
- *   NULL 'inode' (root) and mountpoints are exempt.
- *
- * Input Parameters:
- *   inode - Inode to check, or NULL for a root-level path
- *   amode - Access mode bitmask (R_OK / W_OK / X_OK)
- *
- * Returned Value:
- *   Zero (OK) on success, or -EACCES if permission is denied.
+ *   Generic access-mode check against an inode's stored owner/group/mode.
+ *   Applies to pseudoFS nodes and to mountpoint inodes (whose i_mode gates
+ *   traversal into the mounted filesystem).  Optional mountpt_operations
+ *   .permission may expose the same policy for in-volume paths; the VFS
+ *   does not call that hook for mount-crossing.
  *
  ****************************************************************************/
 
+int inode_permission(FAR struct inode *inode, int amode)
+{
+#ifdef CONFIG_FS_PERMISSION
+  if (inode == NULL)
+    {
+      return OK;
+    }
+
+  return fs_checkmode(inode->i_owner, inode->i_group, inode->i_mode, amode);
+#else
+  UNUSED(inode);
+  UNUSED(amode);
+  return OK;
+#endif
+}
+
 /****************************************************************************
- * Name: inode_checkperm
+ * Name: inode_checksearchpath
+ *
+ * Description:
+ *   Require X_OK on every ancestor of 'inode', and on 'inode' itself when
+ *   it is a directory or mountpoint that must be traversed.
+ *
  ****************************************************************************/
 
-int inode_checkperm(FAR struct inode *inode, int amode)
+int inode_checksearchpath(FAR struct inode *inode)

Review Comment:
   Done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to