From 78c24f0879241e62de6a0bed53c08da092ce349b Mon Sep 17 00:00:00 2001 From: YOUR_NAME Date: Mon, 29 Mar 2021 14:34:55 +0800 Subject: [PATCH] IssueNo:#I3EOI0 Description:Delete VM to support only kernel mode. Sig:liteos_a Feature or Bugfix:Feature Binary Source:No Change-Id: Ie1029c8fbc0c1b85c138663933118d2d148b7769 --- fs/driver/fs_blockproxy.c | 2 ++ fs/inode/fs_files.c | 8 +++++--- fs/vfs/fs_open.c | 2 ++ fs/vfs/fs_unlink.c | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/driver/fs_blockproxy.c b/fs/driver/fs_blockproxy.c index 2950a5f..9bfedd4 100755 --- a/fs/driver/fs_blockproxy.c +++ b/fs/driver/fs_blockproxy.c @@ -227,7 +227,9 @@ int block_proxy(FAR const char *blkdev, int oflags) VnodeDrop(); /* Block char device is no need for file mapping */ +#ifdef LOSCFG_KERNEL_VM (void)remove_mapping(chardev); +#endif /* Free the allocate character driver name and return the open file * descriptor. diff --git a/fs/inode/fs_files.c b/fs/inode/fs_files.c index 35164a4..8d4179b 100644 --- a/fs/inode/fs_files.c +++ b/fs/inode/fs_files.c @@ -507,7 +507,6 @@ int files_allocate(struct Vnode *vnode_ptr, int oflags, off_t pos, void *priv, i static int files_close_internal(int fd, LosProcessCB *processCB) { int ret = OK; - struct file *filep = NULL; struct filelist *list = NULL; struct files_struct *process_files = NULL; @@ -544,15 +543,18 @@ static int files_close_internal(int fd, LosProcessCB *processCB) /* The filep->f_refcount may not be zero here, when the filep is shared in parent-child processes. so, upon closing the filep in current process, relevant region must be released immediately */ - - filep = &list->fl_files[fd]; +#ifdef LOSCFG_KERNEL_VM + struct file *filep = &list->fl_files[fd]; OsVmmFileRegionFree(filep, processCB); +#endif list->fl_files[fd].f_refcount--; if (list->fl_files[fd].f_refcount == 0) { +#ifdef LOSCFG_KERNEL_VM dec_mapping_nolock(filep->f_mapping); +#endif ret = _files_close(&list->fl_files[fd]); if (ret == OK) { diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c index a9adcf0..3abd9d4 100755 --- a/fs/vfs/fs_open.c +++ b/fs/vfs/fs_open.c @@ -303,7 +303,9 @@ int fp_open(char *fullpath, int oflags, mode_t mode) /* we do not bother to handle the NULL scenario, if so, page-cache feature will not be used * when we do the file fault */ +#ifdef LOSCFG_KERNEL_VM add_mapping(filep, fullpath); +#endif return fd; diff --git a/fs/vfs/fs_unlink.c b/fs/vfs/fs_unlink.c index 4936457..1388867 100644 --- a/fs/vfs/fs_unlink.c +++ b/fs/vfs/fs_unlink.c @@ -140,7 +140,9 @@ int do_unlink(int dirfd, const char *pathname) VnodeFree(vnode); VnodeDrop(); +#ifdef LOSCFG_KERNEL_VM (void)remove_mapping(fullpath); +#endif /* Successfully unlinked */ free(fullpath); -- GitLab