jlaitine commented on code in PR #8026: URL: https://github.com/apache/nuttx/pull/8026#discussion_r1063317621
########## fs/mmap/fs_rammap.c: ########## @@ -44,12 +41,81 @@ * Public Data ****************************************************************************/ -/* This is the list of all mapped files */ +/**************************************************************************** + * Private Functions + ****************************************************************************/ -struct fs_allmaps_s g_rammaps = +static int unmap_rammap(FAR struct task_group_s *group, + FAR struct mm_map_entry_s *map_entry, + FAR void *start, + size_t length) { - NXMUTEX_INITIALIZER -}; + FAR void *newaddr; + unsigned int offset; + bool kernel = map_entry->priv.i != 0 ? true : false; + + /* Get the offset from the beginning of the region and the actual number + * of bytes to "unmap". All mappings must extend to the end of the region. + * There is no support for free a block of memory but leaving a block of + * memory at the end. This is a consequence of using kumm_realloc() to + * simulate the unmapping. + */ + + offset = start - map_entry->vaddr; + if (offset + length < map_entry->length) + { + ferr("ERROR: Cannot umap without unmapping to the end\n"); + return -ENOSYS; + } + + /* Okay.. the region is beging umapped to the end. Make sure the length Review Comment: supposed to be "unmapped", thanks, fixed :) ########## fs/mmap/fs_rammap.h: ########## @@ -18,25 +18,7 @@ * ****************************************************************************/ -#ifndef __FS_MMAP_FS_RAMMAP_H -#define __FS_MMAP_FS_RAMMAP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <sys/types.h> -#include <nuttx/mutex.h> - -#ifdef CONFIG_FS_RAMMAP - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This structure describes one file that has been copied to memory and +/* This driver manages files that has been copied to memory and Review Comment: fixed -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org