提交 e1c32d59 编写于 作者: O openharmony_ci 提交者: Gitee

!11 VM模块裁剪

Merge pull request !11 from JerryH/vm
...@@ -227,7 +227,9 @@ int block_proxy(FAR const char *blkdev, int oflags) ...@@ -227,7 +227,9 @@ int block_proxy(FAR const char *blkdev, int oflags)
VnodeDrop(); VnodeDrop();
/* Block char device is no need for file mapping */ /* Block char device is no need for file mapping */
#ifdef LOSCFG_KERNEL_VM
(void)remove_mapping(chardev); (void)remove_mapping(chardev);
#endif
/* Free the allocate character driver name and return the open file /* Free the allocate character driver name and return the open file
* descriptor. * descriptor.
......
...@@ -507,7 +507,6 @@ int files_allocate(struct Vnode *vnode_ptr, int oflags, off_t pos, void *priv, i ...@@ -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) static int files_close_internal(int fd, LosProcessCB *processCB)
{ {
int ret = OK; int ret = OK;
struct file *filep = NULL;
struct filelist *list = NULL; struct filelist *list = NULL;
struct files_struct *process_files = NULL; struct files_struct *process_files = NULL;
...@@ -544,15 +543,18 @@ static int files_close_internal(int fd, LosProcessCB *processCB) ...@@ -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. /* 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 */ so, upon closing the filep in current process, relevant region must be released immediately */
#ifdef LOSCFG_KERNEL_VM
filep = &list->fl_files[fd]; struct file *filep = &list->fl_files[fd];
OsVmmFileRegionFree(filep, processCB); OsVmmFileRegionFree(filep, processCB);
#endif
list->fl_files[fd].f_refcount--; list->fl_files[fd].f_refcount--;
if (list->fl_files[fd].f_refcount == 0) if (list->fl_files[fd].f_refcount == 0)
{ {
#ifdef LOSCFG_KERNEL_VM
dec_mapping_nolock(filep->f_mapping); dec_mapping_nolock(filep->f_mapping);
#endif
ret = _files_close(&list->fl_files[fd]); ret = _files_close(&list->fl_files[fd]);
if (ret == OK) if (ret == OK)
{ {
......
...@@ -305,7 +305,9 @@ int fp_open(char *fullpath, int oflags, mode_t mode) ...@@ -305,7 +305,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 /* we do not bother to handle the NULL scenario, if so, page-cache feature will not be used
* when we do the file fault */ * when we do the file fault */
#ifdef LOSCFG_KERNEL_VM
add_mapping(filep, fullpath); add_mapping(filep, fullpath);
#endif
return fd; return fd;
......
...@@ -140,7 +140,9 @@ int do_unlink(int dirfd, const char *pathname) ...@@ -140,7 +140,9 @@ int do_unlink(int dirfd, const char *pathname)
VnodeFree(vnode); VnodeFree(vnode);
VnodeDrop(); VnodeDrop();
#ifdef LOSCFG_KERNEL_VM
(void)remove_mapping(fullpath); (void)remove_mapping(fullpath);
#endif
/* Successfully unlinked */ /* Successfully unlinked */
free(fullpath); free(fullpath);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册