diff --git a/fs/include/fs/fs_operation.h b/fs/include/fs/fs_operation.h
index ab9287bf..0f1e6967 100644
--- a/fs/include/fs/fs_operation.h
+++ b/fs/include/fs/fs_operation.h
@@ -163,30 +163,6 @@ void clear_fd(int fd);
extern char *rindex(const char *s, int c);
-/**
- * @ingroup fs
- * @brief list directory contents.
- *
- * @par Description:
- * Get the volume label of the FAT partition.
- *
- * @attention
- *
- * - The function support FAT filesystem only.
- * - The label must allocated more than 11 charactors space first
- *
- *
- * @param target [IN] Type #const char* The file pathname.
- * @param label [OUT] Type #const char* The string pointer transform the label massge back.
- *
- * @retval #int Point the status which is successed or failed.
- *
- * @par Dependency:
- * - fs.h: the header file that contains the API declaration.
- */
-
-int getlabel(const char *target, char *label);
-
/**
* @ingroup fs
*
@@ -349,40 +325,6 @@ int fscheck(const char *path);
extern int virstatfs(const char *path, struct statfs *buf);
-/**
- * @ingroup fs
- * @set the virtual partition information.
- *
- * @par Description:
- * The los_set_virpartparam() function use for set virtual partition parameter.
- * The parameter include virtual partition number, virtual partition percent, virtual partition name
- * and the partition path which need mount virtual partition.
- *
- * @attention
- *
- * - This function only support for FAT32.
- * - This function only support for the virtual partition feature.
- * - This function only can be used before mount function.
- * - The function can be invoked once before umount partition.
- * - Now support set single partition,the partition information will be replaced
- * if it used for set another partition name.
- * - The function has no effert if virtual partition information is already in the partition.
- *
- *
- * @param virtualinfo [IN] Type #virpartinfo The struct which include virtual partition information.
- *
- * @retval #0 los_set_virpartparam success.
- * @retval #-1 los_set_virpartparam failed.
- *
- * @par Dependency:
- * - fs.h: the header file that contains the API declaration.
- * @see
- *
- */
-#ifdef VFS_IMPL_LATER
-int los_set_virpartparam(virpartinfo virtualinfo);
-#endif
-
#endif
/**
diff --git a/fs/vfs/disk/disk.c b/fs/vfs/disk/disk.c
index 07be82c6..071b1d90 100644
--- a/fs/vfs/disk/disk.c
+++ b/fs/vfs/disk/disk.c
@@ -1148,15 +1148,16 @@ ERROR_HANDLE:
INT32 los_disk_cache_clear(INT32 drvID)
{
INT32 result;
+ los_part *part = get_part(drvID);
los_disk *disk = NULL;
- result = OsSdSync(drvID);
+ result = OsSdSync(part->disk_id);
if (result != 0) {
PRINTK("[ERROR]disk_cache_clear SD sync failed!\n");
return result;
}
- disk = get_disk(drvID);
+ disk = get_disk(part->disk_id);
if (disk == NULL) {
return -1;
}
diff --git a/fs/vfs/operation/fs_getlabel.c b/fs/vfs/operation/fs_getlabel.c
deleted file mode 100644
index b36ad195..00000000
--- a/fs/vfs/operation/fs_getlabel.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
- * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors may be used
- * to endorse or promote products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include "vfs_config.h"
-
-#include "sys/mount.h"
-#include "errno.h"
-#include "fs/fs.h"
-
-#include "stdlib.h"
-
-#include "string.h"
-#include "disk.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Public Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: getlabel()
- *
- * Description:
- * getlabel() get the volume label of partition(disk) from FAT filesystem by
- * the 'target' path
- *
- * Parameters:
- * target : the path which is the mount point of FAT filesystem device.
- * label : the string var pointer, by which passed out label string.
- *
- * Return:
- * Zero is returned on success; -1 is returned on an error and errno is
- * set appropriately:
- *
- * ENOMEM There is no memory for allocated space for var.
- * EFAULT The pointer 'target' does not pass in corretly.
- * ENOENT The pointer 'target' pointed to a wrong location.
- * EPERM The pointer 'target' does not point to a mount inode.
- * EINVAL The pointer 'label' does not pass in correctly.
- * EACCES The filesystem which 'target' point to is not supported.
- *
- ****************************************************************************/
-
-int getlabel(const char *target, char *label)
-{
-#ifdef VFS_IMPL_LATER
- struct inode *mountpt_inode = NULL;
- int errcode = OK;
- int status;
- char *fullpath = NULL;
- struct inode_search_s desc;
- int ret;
- /* Verify required pointer arguments */
-
- if (target == NULL || label == NULL) {
- errcode = EFAULT;
- goto errout;
- }
-
- /* Get a absolute path */
-
- errcode = vfs_normalize_path((const char *)NULL, target, &fullpath);
- if (errcode < 0) {
- errcode = -errcode;
- goto errout;
- }
-
- /* Find the mountpt */
- SETUP_SEARCH(&desc, fullpath, false);
- ret = inode_find(&desc);
- if (ret < 0) {
- errcode = EACCES;
- goto errout_with_fullpath;
- }
- mountpt_inode = desc.node;
-
- /* Verfy the path is a mountpoint path or file path */
-
- if (!INODE_IS_MOUNTPT(mountpt_inode) && !INODE_IS_BLOCK(mountpt_inode)) {
- errcode = EPERM;
- goto errout_with_release;
- }
-
- if (mountpt_inode->u.i_mops) {
- status = LOS_OK;
- if (status < 0) {
- /* The inode is unhappy with the blkdrvr for some reason */
-
- errcode = -status;
- goto errout_with_release;
- }
- inode_release(mountpt_inode);
- free(fullpath);
- return OK;
- } else {
- errcode = EACCES;
- goto errout_with_release;
- }
-
- /* A lot of goto's! But they make the error handling much simpler */
-
-errout_with_release:
- inode_release(mountpt_inode);
-errout_with_fullpath:
- free(fullpath);
-errout:
- set_errno(errcode);
- return VFS_ERROR;
-#endif
- return 0;
-}
diff --git a/fs/vfs/operation/fs_virstatfs.c b/fs/vfs/operation/fs_virstatfs.c
index e9363e4d..2028faaa 100644
--- a/fs/vfs/operation/fs_virstatfs.c
+++ b/fs/vfs/operation/fs_virstatfs.c
@@ -53,101 +53,7 @@
#ifdef LOSCFG_FS_FAT_VIRTUAL_PARTITION
int virstatfs(const char *path, struct statfs *buf)
{
-#ifdef VFS_IMPL_LATER
- struct inode *inode = NULL;
- int ret = OK;
- char *fullpath = NULL;
- struct inode_search_s desc;
-
- /* Sanity checks */
-
- if (!path || !buf)
- {
- ret = EFAULT;
- goto errout;
- }
-
- if (!path[0])
- {
- ret = ENOENT;
- goto errout;
- }
-
- ret = vfs_normalize_path((const char *)NULL, path, &fullpath);
- if (ret < 0)
- {
- ret = -ret;
- goto errout;
- }
-
- /* Get an inode for this file */
- SETUP_SEARCH(&desc, fullpath, false);
- ret = inode_find(&desc);
- if (ret < 0)
- {
- /* This name does not refer to a psudeo-inode and there is no
- * mountpoint that includes in this path.
- */
-
- ret = EACCES;
- free(fullpath);
- goto errout;
- }
- inode = desc.node;
-
- /* The way we handle the statfs depends on the type of inode that we
- * are dealing with.
- */
-
-#ifndef CONFIG_DISABLE_MOUNTPOINT
- if (INODE_IS_MOUNTPT(inode))
- {
- /* The node is a file system mointpoint. Verify that the mountpoint
- * supports the statfs() method
- */
-
- if (inode->u.i_mops)
- {
- /* Perform the statfs() operation */
-
- ret = LOS_OK;
- }
- else
- {
- ret = EINVAL;
- goto errout_with_inode;
- }
- }
- else
-#endif
- {
- ret = EINVAL;
- goto errout_with_inode;
- }
-
- /* Check if the statfs operation was successful */
-
- if (ret < 0)
- {
- ret = -ret;
- goto errout_with_inode;
- }
-
- /* Successfully statfs'ed the file */
-
- inode_release(inode);
- free(fullpath);
- return OK;
-
- /* Failure conditions always set the errno appropriately */
-
-errout_with_inode:
- inode_release(inode);
- free(fullpath);
-errout:
- set_errno(ret);
- return VFS_ERROR;
-#endif
- return 0;
+ //currently not implemented
+ return LOS_OK;
}
#endif
diff --git a/kernel/base/vm/los_vm_filemap.c b/kernel/base/vm/los_vm_filemap.c
index 86070302..9447b3da 100644
--- a/kernel/base/vm/los_vm_filemap.c
+++ b/kernel/base/vm/los_vm_filemap.c
@@ -123,149 +123,6 @@ VOID OsDeletePageCacheLru(LosFilePage *page)
OsPageCacheDel(page);
}
-#if VFS_IMPL_LATER
-STATIC LosFilePage *OsPagecacheGetPageAndFill(struct file *filp, VM_OFFSET_T pgOff, size_t *readSize, VADDR_T *kvaddr)
-{
- LosFilePage *page = NULL;
- struct page_mapping *mapping = filp->f_mapping;
-
- page = OsFindGetEntry(mapping, pgOff);
- if (page != NULL) {
- OsSetPageLocked(page->vmPage);
- OsPageRefIncLocked(page);
- *kvaddr = (VADDR_T)(UINTPTR)OsVmPageToVaddr(page->vmPage);
- *readSize = PAGE_SIZE;
- } else {
- page = OsPageCacheAlloc(mapping, pgOff);
- if (page == NULL) {
- VM_ERR("Failed to alloc a page frame");
- return page;
- }
- OsSetPageLocked(page->vmPage);
- *kvaddr = (VADDR_T)(UINTPTR)OsVmPageToVaddr(page->vmPage);
-
- file_seek(filp, pgOff << PAGE_SHIFT, SEEK_SET);
- /* "ReadPage" func exists definitely in this procedure */
- *readSize = filp->f_vnode->u.i_mops->readpage(filp, (char *)(UINTPTR)*kvaddr, PAGE_SIZE);
- if (*readSize == 0) {
- VM_ERR("read 0 bytes");
- OsCleanPageLocked(page->vmPage);
- }
- OsAddToPageacheLru(page, mapping, pgOff);
- }
-
- return page;
-}
-
-
-ssize_t OsMappingRead(struct file *filp, char *buf, size_t size)
-{
- INT32 ret;
- vaddr_t kvaddr = 0;
- UINT32 intSave;
- struct stat bufStat;
- size_t readSize = 0;
- size_t readTotal = 0;
- size_t readLeft = size;
- LosFilePage *page = NULL;
- VM_OFFSET_T pos = file_seek(filp, 0, SEEK_CUR);
- VM_OFFSET_T pgOff = pos >> PAGE_SHIFT;
- INT32 offInPage = pos % PAGE_SIZE;
- struct page_mapping *mapping = filp->f_mapping;
- INT32 nPages = (ROUNDUP(pos + size, PAGE_SIZE) - ROUNDDOWN(pos, PAGE_SIZE)) >> PAGE_SHIFT;
-
- ret = stat(filp->f_path, &bufStat);
- if (ret != OK) {
- VM_ERR("Get file size failed. (filepath=%s)", filp->f_path);
- return 0;
- }
-
- if (pos >= bufStat.st_size) {
- PRINT_INFO("%s filp->f_pos >= bufStat.st_size (pos=%ld, fileSize=%ld)\n", filp->f_path, pos, bufStat.st_size);
- return 0;
- }
-
- LOS_SpinLockSave(&mapping->list_lock, &intSave);
-
- for (INT32 i = 0; (i < nPages) && readLeft; i++, pgOff++) {
- page = OsPagecacheGetPageAndFill(filp, pgOff, &readSize, &kvaddr);
- if ((page == NULL) || (readSize == 0)) {
- break;
- }
- if (readSize < PAGE_SIZE) {
- readLeft = readSize;
- }
-
- readSize = MIN2((PAGE_SIZE - offInPage), readLeft);
-
- (VOID)memcpy_s((VOID *)buf, readLeft, (char *)(UINTPTR)kvaddr + offInPage, readSize);
- buf += readSize;
- readLeft -= readSize;
- readTotal += readSize;
-
- offInPage = 0;
-
- OsCleanPageLocked(page->vmPage);
- }
-
- LOS_SpinUnlockRestore(&mapping->list_lock, intSave);
- file_seek(filp, pos + readTotal, SEEK_SET);
-
- return readTotal;
-}
-#endif
-
-ssize_t OsMappingWrite(struct file *filp, const char *buf, size_t size)
-{
- VADDR_T kvaddr;
- UINT32 intSave;
- INT32 writeSize = 0;
- size_t writeLeft = size;
- VM_OFFSET_T pos = file_seek(filp, 0, SEEK_CUR);
- VM_OFFSET_T pgOff = pos >> PAGE_SHIFT;
- INT32 offInPage = pos % PAGE_SIZE;
- LosFilePage *page = NULL;
- struct page_mapping *mapping = filp->f_mapping;
- INT32 nPages = (ROUNDUP(pos + size, PAGE_SIZE) - ROUNDDOWN(pos, PAGE_SIZE)) >> PAGE_SHIFT;
-
- LOS_SpinLockSave(&mapping->list_lock, &intSave);
-
- for (INT32 i = 0; i < nPages; i++, pgOff++) {
- page = OsFindGetEntry(mapping, pgOff);
- if (page) {
- kvaddr = (VADDR_T)(UINTPTR)OsVmPageToVaddr(page->vmPage);
- OsSetPageLocked(page->vmPage);
- OsPageRefIncLocked(page);
- } else {
- page = OsPageCacheAlloc(mapping, pgOff);
- if (page == NULL) {
- VM_ERR("Failed to alloc a page frame");
- break;
- }
- kvaddr = (VADDR_T)(UINTPTR)OsVmPageToVaddr(page->vmPage);
- OsAddToPageacheLru(page, mapping, pgOff);
- OsSetPageLocked(page->vmPage);
- }
-
- writeSize = MIN2((PAGE_SIZE - offInPage), writeLeft);
-
- (VOID)memcpy_s((char *)(UINTPTR)kvaddr + offInPage, writeLeft, buf, writeSize);
- buf += writeSize;
- writeLeft -= writeSize;
-
- OsMarkPageDirty(page, NULL, offInPage, writeSize);
-
- offInPage = 0;
-
- OsCleanPageLocked(page->vmPage);
- }
-
- LOS_SpinUnlockRestore(&mapping->list_lock, intSave);
-
- file_seek(filp, pos + size - writeLeft, SEEK_SET);
- return (size - writeLeft);
-}
-
STATIC VOID OsPageCacheUnmap(LosFilePage *fpage, LosArchMmu *archMmu, VADDR_T vaddr)
{
UINT32 intSave;