Abhishekmishra2808 commented on code in PR #19165:
URL: https://github.com/apache/nuttx/pull/19165#discussion_r3433622941
##########
fs/tmpfs/fs_tmpfs.c:
##########
@@ -555,12 +561,174 @@ static int tmpfs_add_dirent(FAR struct tmpfs_directory_s
*tdo,
return OK;
}
+#if defined(CONFIG_FS_PERMISSION)
+
+/****************************************************************************
+ * Name: tmpfs_init_object
+ ****************************************************************************/
+
+static void tmpfs_init_object(FAR struct tmpfs_object_s *to, mode_t mode)
+{
+ FAR struct tcb_s *rtcb;
+
+ to->to_mode = mode & 07777;
+ rtcb = nxsched_self();
+ if ((rtcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL ||
+ rtcb->group == NULL)
+ {
+ to->to_uid = 0;
+ to->to_gid = 0;
+ }
+ else
+ {
+ to->to_uid = rtcb->group->tg_euid;
+ to->to_gid = rtcb->group->tg_egid;
+ }
+}
+
+/****************************************************************************
+ * Name: tmpfs_check_pathperm
+ ****************************************************************************/
+
+static int tmpfs_check_pathperm(FAR struct tmpfs_s *fs,
+ FAR const char *relpath, size_t relpathlen,
+ int final_amode)
+{
+ FAR struct tmpfs_directory_s *tdo;
+ FAR struct tmpfs_object_s *to;
+ size_t begin;
+ size_t end;
+ int ret;
+
+ begin = 0;
Review Comment:
Done
##########
fs/tmpfs/fs_tmpfs.c:
##########
@@ -2853,6 +3119,49 @@ static int tmpfs_stat(FAR struct inode *mountpt, FAR
const char *relpath,
return ret;
}
+/****************************************************************************
+ * Name: tmpfs_chstat
+ ****************************************************************************/
+
+static int tmpfs_chstat(FAR struct inode *mountpt, FAR const char *relpath,
+ FAR const struct stat *buf, int flags)
+{
+ FAR struct tmpfs_s *fs;
+ FAR struct tmpfs_object_s *to;
+ int ret;
+
+ DEBUGASSERT(mountpt != NULL && relpath != NULL && buf != NULL);
+
+#ifndef CONFIG_FS_PERMISSION
+ UNUSED(flags);
+ return -ENOSYS;
+#else
+ fs = mountpt->i_private;
+ DEBUGASSERT(fs != NULL);
+
+ ret = tmpfs_lock(fs);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ for (; *relpath == '/'; relpath++);
Review Comment:
Moved
--
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]