xiaoxiang781216 commented on code in PR #8000:
URL: https://github.com/apache/nuttx/pull/8000#discussion_r1060039139


##########
fs/romfs/fs_romfs.c:
##########
@@ -618,6 +608,34 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
   return -ENOTTY;
 }
 
+static int romfs_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map)
+{
+  FAR struct romfs_mountpt_s *rm;
+  FAR struct romfs_file_s    *rf;
+  int ret = -EINVAL;
+
+  /* Sanity checks */
+
+  DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL);
+
+  /* Recover our private data from the struct file instance */
+
+  rf = filep->f_priv;
+  rm = filep->f_inode->i_private;
+
+  /* Return the address on the media corresponding to the start of
+   * the file.
+   */
+
+  if (map && rm && rm->rm_xipbase && rf)

Review Comment:
   if (rm->rm_xipbase && offset + length <= rf->rf_size)
     {
       map->vaddr = rm->rm_xipbase + rf->rf_startoffset + offset;
     }



##########
fs/romfs/fs_romfs.c:
##########
@@ -618,6 +608,34 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
   return -ENOTTY;
 }
 
+static int romfs_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map)
+{
+  FAR struct romfs_mountpt_s *rm;
+  FAR struct romfs_file_s    *rf;
+  int ret = -EINVAL;
+
+  /* Sanity checks */
+
+  DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL);
+
+  /* Recover our private data from the struct file instance */
+
+  rf = filep->f_priv;
+  rm = filep->f_inode->i_private;
+
+  /* Return the address on the media corresponding to the start of
+   * the file.
+   */
+
+  if (map && rm && rm->rm_xipbase && rf)

Review Comment:
   ```
   if (rm->rm_xipbase && offset + length <= rf->rf_size)
     {
       map->vaddr = rm->rm_xipbase + rf->rf_startoffset + offset;
     }
   ```



-- 
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