提交 73a77777 编写于 作者: M mucor

fix: remove redundant headfile

1.remove redundant headfile in kernel, such as:
  compiler.h;debug.h;automount.h;inode.h;syslog.h;net.h;
2.split fs.h to file.h and driver.h
3.move vnode.h and path_cache.h to vfs/include
4.remove redundant interface and defines

close: #I3RTNR
Signed-off-by: Nmucor <mucorwang@gmail.com>
上级 dca42b9e
../../../../../../third_party/NuttX/include/nuttx/usb/storage.h
\ No newline at end of file
......@@ -38,7 +38,7 @@
#include "los_memory.h"
#include "los_vm_map.h"
#include "los_process_pri.h"
#include "fs_file.h"
#include "fs/file.h"
#include "user_copy.h"
......
......@@ -31,7 +31,7 @@ include $(LITEOSTOPDIR)/config.mk
MODULE_NAME := $(notdir $(shell pwd))
LOCAL_SRCS := $(wildcard *.c)
LOCAL_SRCS := $(wildcard src/*.c)
LOCAL_INCLUDE := \
......
......@@ -37,7 +37,7 @@
#ifndef _DISK_H
#define _DISK_H
#include "fs/fs.h"
#include "fs/driver.h"
#include "los_base.h"
#include "pthread.h"
......
......@@ -37,7 +37,7 @@
****************************************************************************/
#include "vfs_config.h"
#include "fs/fs.h"
#include "fs/file.h"
#ifdef __cplusplus
......
......@@ -35,7 +35,7 @@
#include "unistd.h"
#include "sys/mount.h"
#include "linux/spinlock.h"
#include "fs/path_cache.h"
#include "path_cache.h"
los_disk g_sysDisk[SYS_MAX_DISK];
los_part g_sysPart[SYS_MAX_PART];
......
......@@ -36,7 +36,7 @@
#include "disk.h"
#include "shcmd.h"
#include "shell.h"
#include "fs/path_cache.h"
#include "path_cache.h"
INT32 osShellCmdPartInfo(INT32 argc, const CHAR **argv)
{
......
......@@ -31,6 +31,7 @@
#include "fcntl.h"
#include "linux/kernel.h"
#include "fs/driver.h"
static int MemOpen(struct file *filep)
{
......@@ -42,17 +43,17 @@ static int MemClose(struct file *filep)
return 0;
}
static ssize_t MemRead(FAR struct file *filep, FAR char *buffer, size_t buflen)
static ssize_t MemRead(struct file *filep, char *buffer, size_t buflen)
{
return 0;
}
static ssize_t MemWrite(FAR struct file *filep, FAR const char *buffer, size_t buflen)
static ssize_t MemWrite(struct file *filep, const char *buffer, size_t buflen)
{
return 0;
}
static ssize_t MemMap(FAR struct file *filep, FAR LosVmMapRegion *region)
static ssize_t MemMap(struct file *filep, LosVmMapRegion *region)
{
#ifdef LOSCFG_KERNEL_VM
size_t size = region->range.size;
......
......@@ -33,7 +33,8 @@
#include "fcntl.h"
#include "linux/kernel.h"
#include "los_process_pri.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "fs/driver.h"
EVENT_CB_S g_qsEvent;
static SysteminitHook g_systemInitFunc[QS_STAGE_CNT] = {0};
......
......@@ -32,6 +32,7 @@
#include "los_random.h"
#include "fcntl.h"
#include "linux/kernel.h"
#include "fs/driver.h"
static unsigned long g_randomMax = 0x7FFFFFFF;
......@@ -91,7 +92,7 @@ ssize_t RanRead(struct file *filep, char *buffer, size_t buflen)
return (buflen - len); /* return a successful len */
}
static ssize_t RanMap(FAR struct file *filep, FAR LosVmMapRegion *region)
static ssize_t RanMap(struct file *filep, LosVmMapRegion *region)
{
PRINTK("%s %d, mmap is not support\n", __FUNCTION__, __LINE__);
return 0;
......
......@@ -33,6 +33,7 @@
#include "fcntl.h"
#include "hisoc/random.h"
#include "linux/kernel.h"
#include "fs/driver.h"
static RandomOperations g_randomOp;
void RandomOperationsInit(const RandomOperations *r)
......@@ -89,7 +90,7 @@ static ssize_t RandomHwRead(struct file *filep, char *buffer, size_t buflen)
return ret;
}
static ssize_t RandomMap(FAR struct file *filep, FAR LosVmMapRegion *region)
static ssize_t RandomMap(struct file *filep, LosVmMapRegion *region)
{
PRINTK("%s %d, mmap is not support\n", __FUNCTION__, __LINE__);
return 0;
......
......@@ -35,6 +35,7 @@ LOCAL_SRCS := $(wildcard src/*.c)
LOCAL_INCLUDE := \
-I $(LITEOSTOPDIR)/fs/jffs2/include \
-I $(LITEOSTOPDIR)/drivers/mtd/multi_partition/include \
-I $(LITEOSTOPDIR)/../../device/hisilicon/drivers/include/mtd/common/include
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
......
......@@ -36,7 +36,7 @@
#include "mtd_list.h"
#include "los_config.h"
#include "los_mux.h"
#include "fs/driver.h"
#include "mtd_common.h"
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
......
......@@ -37,7 +37,6 @@
#include "errno.h"
#include "shcmd.h"
#include "shell.h"
#include "fs/fs.h"
#include "fatfs.h"
int osShellCmdFormat(int argc, char **argv)
......@@ -77,45 +76,5 @@ int osShellCmdFormat(int argc, char **argv)
return 0;
}
#ifdef LOSCFG_FS_FAT_VIRTUAL_PARTITION
int osShellCmdVirstatfs(int argc, char** argv)
{
struct statfs sfs;
unsigned long long totalSize, freeSize;
int result;
(void)memset_s(&sfs, sizeof(sfs), 0, sizeof(sfs));
if (argc != 1) {
perror("virstatfs error");
PRINTK("Usage :\n");
PRINTK(" virstatfs <virtual_entry>\n");
PRINTK(" virtual_entry : the path of the virtual partition entry\n");
PRINTK("Example:\n");
PRINTK(" virstatfs /mnt/sd/virpart0\n");
return FAT_ERROR;
}
result = virstatfs(argv[0], &sfs);
if (result < 0) {
set_errno(-result);
perror("virstatfs failed");
return FAT_ERROR;
}
totalSize = (unsigned long long)sfs.f_bsize * sfs.f_blocks;
freeSize = (unsigned long long)sfs.f_bsize * sfs.f_bfree;
PRINTK("Virtual partition \"%s\" Info:\n", argv[0]);
PRINTK(" f_type = %d\n cluster_size = %d\n total_clusters = 0x%llx\n ",
sfs.f_type, sfs.f_bsize, sfs.f_blocks);
PRINTK("free_clusters = 0x%llx\n avail_clusters = 0x%llx\n f_namelen = %d\n",
sfs.f_bfree, sfs.f_bavail, sfs.f_namelen);
PRINTK("\n%s\n total size: %4llu Bytes\n free size: %4llu Bytes\n", argv[0], totalSize, freeSize);
return 0;
}
#endif
#if defined(LOSCFG_FS_FAT_VIRTUAL_PARTITION) && defined(LOSCFG_SHELL_CMD_DEBUG)
SHELLCMD_ENTRY(virstatfs_shellcmd, CMD_TYPE_EX, "virstatfs", XARGS, (CmdCallBackFunc)osShellCmdVirstatfs);
#endif
SHELLCMD_ENTRY(format_shellcmd, CMD_TYPE_EX, "format", XARGS, (CmdCallBackFunc)osShellCmdFormat);
#endif
......@@ -32,15 +32,13 @@
#include "fatfs.h"
#ifdef LOSCFG_FS_FAT
#include "ff.h"
#include "fs/vfs_util.h"
#include "disk_pri.h"
#include "diskio.h"
#include "fs/fs.h"
#include "fs/dirent_fs.h"
#include "fs_other.h"
#include "fs/mount.h"
#include "fs/vnode.h"
#include "fs/path_cache.h"
#include "vnode.h"
#include "path_cache.h"
#ifdef LOSCFG_FS_FAT_VIRTUAL_PARTITION
#include "virpartff.h"
#include "errcode_fat.h"
......@@ -55,6 +53,7 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "los_hash.h"
struct VnodeOps fatfs_vops; /* forward define */
......@@ -214,10 +213,10 @@ int fatfs_hash_cmp(struct Vnode *vp, void *arg)
static DWORD fatfs_hash(QWORD sect, DWORD dptr, DWORD sclst)
{
DWORD hash = FNV1_32_INIT;
hash = fnv_32_buf(&sect, sizeof(QWORD), hash);
hash = fnv_32_buf(&dptr, sizeof(DWORD), hash);
hash = fnv_32_buf(&sclst, sizeof(DWORD), hash);
DWORD hash = FNV1_32A_INIT;
hash = LOS_HashFNV32aBuf(&sect, sizeof(QWORD), hash);
hash = LOS_HashFNV32aBuf(&dptr, sizeof(DWORD), hash);
hash = LOS_HashFNV32aBuf(&sclst, sizeof(DWORD), hash);
return hash;
}
......
......@@ -33,7 +33,7 @@
#define _FATFS_H
#include "ff.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "disk.h"
#include "unistd.h"
#include "string.h"
......@@ -107,6 +107,12 @@ extern "C" {
#define FDEBUG(...)
#endif
/* Format options (3rd argument of format) */
#define FMT_FAT 0x01
#define FMT_FAT32 0x02
#define FMT_ANY 0x07
#define FMT_ERASE 0x08
int fatfs_2_vfs(int result);
int fatfs_lookup(struct Vnode *parent, const char *name, int len, struct Vnode **vpp);
int fatfs_create(struct Vnode *parent, const char *name, int mode, struct Vnode **vpp);
......
......@@ -32,9 +32,19 @@
#ifndef _VIRPART_H
#define _VIRPART_H
#include "ff.h"
#include "integer.h"
#include "disk.h"
#define _MAX_ENTRYLENGTH 16 /* MAX virtual partition name length */
#define _MAX_VIRVOLUMES 5 /* MAX virtual partition number */
typedef struct virtual_partition_info
{
char *devpartpath; /* need set virtual partition, e.g. /dev/mmcblk0p0 */
int virpartnum; /* virtual partition numbers, MAX number is 5 */
double virpartpercent[_MAX_VIRVOLUMES]; /* every virtual partition percent,e.g 0.6,0.3,0.1 */
char virpartname[_MAX_VIRVOLUMES][_MAX_ENTRYLENGTH + 1]; /* every virtual partition name, MAX length is 16 */
} virpartinfo;
extern char g_devPartName[DISK_NAME + 1];
INT FatFsBindVirPart(void *handle, BYTE vol);
......@@ -43,4 +53,4 @@ INT FatFsUnbindVirPart(void *handle);
INT FatFsMakeVirPart(void *handle, BYTE vol);
#endif /* _VIRPART_H */
\ No newline at end of file
#endif /* _VIRPART_H */
......@@ -34,15 +34,16 @@
#include "fatfs.h"
#include "errcode_fat.h"
#include "disk.h"
#include "fs/mount.h"
#ifdef LOSCFG_FS_FAT_CACHE
#include "bcache.h"
#endif
#ifdef LOSCFG_FS_FAT_VIRTUAL_PARTITION
#include "virpartff.h"
#ifdef LOSCFG_FS_FAT_VIRTUAL_PARTITION
char g_devPartName[DISK_NAME + 1] = {0};
static INT FatFsCheckPercent(virpartinfo *virtualinfo)
......
../../../../third_party/NuttX/include/nuttx/compiler.h
\ No newline at end of file
../../../../third_party/NuttX/include/debug.h
\ No newline at end of file
../../../../../third_party/NuttX/include/nuttx/fs/automount.h
\ No newline at end of file
/****************************************************************************
* include/fs/fs.h
*
* Copyright (C) 2007-2009, 2011-2013, 2015-2018 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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 NuttX 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 OWNER 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.
*
****************************************************************************/
#ifndef _FS_DRIVER_H_
#define _FS_DRIVER_H_
#include <sys/stat.h>
#include "vnode.h"
#include "fs/file.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
/* This structure provides information about the state of a block driver */
struct geometry
{
bool geo_available; /* true: The device is available */
bool geo_mediachanged; /* true: The media has changed since last query */
bool geo_writeenabled; /* true: It is okay to write to this device */
unsigned long long geo_nsectors; /* Number of sectors on the device */
size_t geo_sectorsize; /* Size of one sector */
};
/* This structure is provided by block devices when they register with the
* system. It is used by file systems to perform filesystem transfers. It
* differs from the normal driver vtable in several ways -- most notably in
* that it deals in struct Vnode vs. struct filep.
*/
struct block_operations
{
int (*open)(struct Vnode *vnode);
int (*close)(struct Vnode *vnode);
ssize_t (*read)(struct Vnode *vnode, unsigned char *buffer,
unsigned long long start_sector, unsigned int nsectors);
ssize_t (*write)(struct Vnode *vnode, const unsigned char *buffer,
unsigned long long start_sector, unsigned int nsectors);
int (*geometry)(struct Vnode *vnode, struct geometry *geometry);
int (*ioctl)(struct Vnode *vnode, int cmd, unsigned long arg);
int (*unlink)(struct Vnode *vnode);
};
struct drv_data
{
const void *ops;
mode_t mode;
void *priv;
};
/****************************************************************************
* Name: register_driver
*
* Description:
* Register a character driver vnode the pseudo file system.
*
* Input Parameters:
* path - The path to the vnode to create
* fops - The file operations structure
* mode - Access privileges (not used)
* priv - Private, user data that will be associated with the vnode.
*
* Returned Value:
* Zero on success (with the vnode point in 'vnode'); A negated errno
* value is returned on a failure (all error values returned by
* vnode_reserve):
*
* EINVAL - 'path' is invalid for this operation
* EEXIST - An vnode already exists at 'path'
* ENOMEM - Failed to allocate in-memory resources for the operation
*
* Attention:
* This function should be called after los_vfs_init has been called.
* The parameter path must point a valid string, which end with the terminating null byte.
* The total length of parameter path must less than the value defined by PATH_MAX.
* The prefix of the parameter path must be /dev/.
* The fops must pointed the right functions, otherwise the system will crash when the device is being operated.
*
****************************************************************************/
int register_driver(const char *path,
const struct file_operations_vfs *fops, mode_t mode,
void *priv);
/****************************************************************************
* Name: register_blockdriver
*
* Description:
* Register a block driver vnode the pseudo file system.
*
* Attention:
* This function should be called after los_vfs_init has been called.
* The parameter path must point a valid string, which end with the terminating null byte.
* The length of parameter path must be less than the value defined by PATH_MAX.
* The prefix of the parameter path must be '/dev/'.
* The bops must pointed the right functions, otherwise the system will crash when the device is being operated.
*
* Input Parameters:
* path - The path to the vnode to create
* bops - The block driver operations structure
* mode - Access privileges (not used)
* priv - Private, user data that will be associated with the vnode.
*
* Returned Value:
* Zero on success (with the vnode point in 'vnode'); A negated errno
* value is returned on a failure (all error values returned by
* vnode_reserve):
*
* EINVAL - 'path' is invalid for this operation
* EEXIST - An vnode already exists at 'path'
* ENOMEM - Failed to allocate in-memory resources for the operation
*
****************************************************************************/
int register_blockdriver(const char *path,
const struct block_operations *bops,
mode_t mode, void *priv);
/****************************************************************************
* Name: unregister_driver
*
* Description:
* Remove the character driver vnode at 'path' from the pseudo-file system
*
* Returned Value:
* Zero on success (with the vnode point in 'vnode'); A negated errno
* value is returned on a failure (all error values returned by
* vnode_reserve):
*
* EBUSY - Resource is busy ,not permit for this operation.
* ENOENT - 'path' is invalid for this operation.
*
* Attention:
* This function should be called after register_blockdriver has been called.
* The parameter path must point a valid string, which end with the terminating null byte.
* The total length of parameter path must less than the value defined by PATH_MAX.
* The block device node referred by parameter path must be really exist.
****************************************************************************/
int unregister_driver(const char *path);
/****************************************************************************
* Name: unregister_blockdriver
*
* Description:
* Remove the block driver vnode at 'path' from the pseudo-file system
*
* Input Parameters:
* path - The path that the vnode to be destroyed.
*
* Returned Value:
* Zero on success (with the vnode point in 'vnode'); A negated errno
* value is returned on a failure (all error values returned by
* vnode_reserve):
*
* EBUSY - Resource is busy ,not permit for this operation.
* ENOENT - 'path' is invalid for this operation.
*
* Attention:
* This function should be called after register_blockdriver has been called.
* The parameter path must point a valid string, which end with the terminating null byte.
* The total length of parameter path must less than the value defined by PATH_MAX.
* The block device node referred by parameter path must be really exist.
*
****************************************************************************/
int unregister_blockdriver(const char *path);
/****************************************************************************
* Name: open_blockdriver
*
* Description:
* Return the vnode of the block driver specified by 'pathname'
*
* Input Parameters:
* pathname - the full path to the block driver to be opened
* mountflags - if MS_RDONLY is not set, then driver must support write
* operations (see include/sys/mount.h)
* ppvnode - address of the location to return the vnode reference
*
* Returned Value:
* Returns zero on success or a negated errno on failure:
*
* EINVAL - pathname or pvnode is NULL
* ENOENT - No block driver of this name is registered
* ENOTBLK - The vnode associated with the pathname is not a block driver
* EACCESS - The MS_RDONLY option was not set but this driver does not
* support write access
*
* Aattention:
* The parameter path must point a valid string, which end with the terminating null byte.
* The total length of parameter path must less than the value defined by PATH_MAX.
* The parameter ppvnode must point a valid memory, which size must be enough for storing struct Vnode.
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int open_blockdriver(const char *pathname, int mountflags,
struct Vnode **ppvnode);
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: find_blockdriver
*
* Description:
* Return the inode of the block driver specified by 'pathname'
*
* Input Parameters:
* pathname - The full path to the block driver to be located
* mountflags - If MS_RDONLY is not set, then driver must support write
* operations (see include/sys/mount.h)
* ppinode - Address of the location to return the inode reference
*
* Returned Value:
* Returns zero on success or a negated errno on failure:
*
* ENOENT - No block driver of this name is registered
* ENOTBLK - The inode associated with the pathname is not a block driver
* EACCESS - The MS_RDONLY option was not set but this driver does not
* support write access
*
****************************************************************************/
int find_blockdriver(const char *pathname, int mountflags,
struct Vnode **vpp);
/****************************************************************************
* Name: close_blockdriver
*
* Description:
* Call the close method and release the vnode
*
* Input Parameters:
* vnode - reference to the vnode of a block driver opened by open_blockdriver
*
* Returned Value:
* Returns zero on success or a negated errno on failure:
*
* EINVAL - vnode is NULL
* ENOTBLK - The vnode is not a block driver
*
* Attention:
* This function should be called after open_blockdriver has been called.
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
int close_blockdriver(struct Vnode *vnode);
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _FS_DRIVER_H_ */
../../../../../third_party/NuttX/include/nuttx/fs/file.h
\ No newline at end of file
此差异已折叠。
......@@ -32,7 +32,7 @@
#ifndef FS_OPERATION_H
#define FS_OPERATION_H
#include "fs/fs.h"
#include "fs/file.h"
#ifdef __cplusplus
#if __cplusplus
......@@ -269,64 +269,6 @@ extern void ls(const char *pathname);
extern int los_set_systime_status(BOOL b_status);
/**
* @ingroup fs
* @check the three latest files in path
*
* @par Description:
* The fscheck() function check the latest three files in path and subdirectories.
* The function will fix the FAT when the file size info of directory is not matched with FAT.
*
* @attention
* <ul>
* <li>This function only support for FAT32.</li>
* </ul>
*
* @param path [IN] Type #const char * The path of the directory to be checked.
*
* @retval #0 truncate success.
* @retval #-1 truncate failed.
*
* @par Dependency:
* <ul><li>fs.h: the header file that contains the API declaration.</li></ul>
* @see
*
*/
int fscheck(const char *path);
#ifdef LOSCFG_FS_FAT_VIRTUAL_PARTITION
/**
* @ingroup fs
* @get the virtual partitions' or free space information in virtual parition feature.
*
* @par Description:
* The virstatfs() function returns the information about the a virtual partition or the free space
* outside the virtual partition.
*
* @attention
* <ul>
* <li>This function only support for FAT32.</li>
* <li>This function only support for the virtual partition feature.</li>
* <li>The parameter 'buf' need to be allocate enough memeory space outside the function first.</li>
* </ul>
*
* @param path [IN] Type #const char * The path which virtual partition or free space to be checked.
* @param buf [OUT] Type #struct statfs * The statfs buffer saving the information.
*
* @retval #0 virstatfs success.
* @retval #-1 virstatfs failed.
*
* @par Dependency:
* <ul><li>fs.h: the header file that contains the API declaration.</li></ul>
* @see
*
*/
extern int virstatfs(const char *path, struct statfs *buf);
#endif
/**
* @ingroup fs
*
......
......@@ -31,11 +31,12 @@
#ifndef _MOUNT_H_
#define _MOUNT_H_
#include "los_mux.h"
#include "fs/vfs_util.h"
#include "fs/vnode.h"
#include <sys/stat.h>
#include <limits.h>
#include <sys/statfs.h>
#include "vnode.h"
#define MS_RDONLY 1
#define MS_NOSYNC 2
struct MountOps;
......@@ -60,6 +61,11 @@ struct MountOps {
int (*Statfs)(struct Mount *mount, struct statfs *sbp);
};
typedef int (*foreach_mountpoint_t)(const char *mountpoint,
struct statfs *statbuf,
void *arg);
struct Mount* MountAlloc(struct Vnode* vnode, struct MountOps* mop);
LIST_HEAD* GetMountList(void);
int foreach_mountpoint(foreach_mountpoint_t handler, void *arg);
#endif
/*
* Copyright (c) 2021-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.
*/
#ifndef _VFS_UTIL_H_
#define _VFS_UTIL_H_
#include "los_list.h"
typedef LOS_DL_LIST LIST_HEAD;
typedef LOS_DL_LIST LIST_ENTRY;
#define FNV1_32_INIT ((uint32_t) 33554467UL)
#define FNV1_64_INIT ((uint64_t) 0xcbf29ce484222325ULL)
#define FNV_32_PRIME ((uint32_t) 0x01000193UL)
#define FNV_64_PRIME ((uint64_t) 0x100000001b3ULL)
#define V_CREATE 0x0001
#define V_CACHE 0x0002
#define V_DUMMY 0x0004
static __inline uint32_t fnv_32_buf(const void *buf, size_t len, uint32_t hval)
{
const uint8_t *s = (const uint8_t *)buf;
while (len-- != 0) {
hval *= FNV_32_PRIME;
hval ^= *s++;
}
return hval;
}
int vfs_normalize_path(const char *directory, const char *filename, char **pathname);
int vfs_normalize_pathat(int fd, const char *filename, char **pathname);
#endif /* !_VFS_UTIL_H_ */
......@@ -28,102 +28,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _VNODE_H_
#define _VNODE_H_
#include <sys/stat.h>
#include "fs/fs_operation.h"
#include "fs/file.h"
#include "fs/vfs_util.h"
#include "fs/path_cache.h"
#define VNODE_FLAG_MOUNT_NEW 1
#define VNODE_FLAG_MOUNT_ORIGIN 2
#define DEV_PATH_LEN 5
/*
* Vnode types. VNODE_TYPE_UNKNOWN means no type.
*/
enum VnodeType {
VNODE_TYPE_UNKNOWN, /* unknown type */
VNODE_TYPE_REG, /* regular fle */
VNODE_TYPE_DIR, /* directory */
VNODE_TYPE_BLK, /* block device */
VNODE_TYPE_CHR, /* char device */
VNODE_TYPE_BCHR, /* block char mix device */
VNODE_TYPE_FIFO, /* pipe */
VNODE_TYPE_LNK, /* link */
};
struct fs_dirent_s;
struct VnodeOps;
struct IATTR;
struct Vnode {
enum VnodeType type; /* vnode type */
int useCount; /* ref count of users */
uint32_t hash; /* vnode hash */
uint uid; /* uid for dac */
uint gid; /* gid for dac */
mode_t mode; /* mode for dac */
LIST_HEAD parentPathCaches; /* pathCaches point to parents */
LIST_HEAD childPathCaches; /* pathCaches point to children */
struct Vnode *parent; /* parent vnode */
struct VnodeOps *vop; /* vnode operations */
struct file_operations_vfs *fop; /* file operations */
void *data; /* private data */
uint32_t flag; /* vnode flag */
LIST_ENTRY hashEntry; /* list entry for bucket in hash table */
LIST_ENTRY actFreeEntry; /* vnode active/free list entry */
struct Mount *originMount; /* fs info about this vnode */
struct Mount *newMount; /* fs info about who mount on this vnode */
};
struct VnodeOps {
int (*Create)(struct Vnode *parent, const char *name, int mode, struct Vnode **vnode);
int (*Lookup)(struct Vnode *parent, const char *name, int len, struct Vnode **vnode);
int (*Open)(struct Vnode *vnode, int fd, int mode, int flags);
int (*Close)(struct Vnode *vnode);
int (*Reclaim)(struct Vnode *vnode);
int (*Unlink)(struct Vnode *parent, struct Vnode *vnode, const char *fileName);
int (*Rmdir)(struct Vnode *parent, struct Vnode *vnode, const char *dirName);
int (*Mkdir)(struct Vnode *parent, const char *dirName, mode_t mode, struct Vnode **vnode);
int (*Readdir)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Opendir)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Rewinddir)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Closedir)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Getattr)(struct Vnode *vnode, struct stat *st);
int (*Setattr)(struct Vnode *vnode, struct stat *st);
int (*Chattr)(struct Vnode *vnode, struct IATTR *attr);
int (*Rename)(struct Vnode *src, struct Vnode *dstParent, const char *srcName, const char *dstName);
int (*Truncate)(struct Vnode *vnode, off_t len);
int (*Truncate64)(struct Vnode *vnode, off64_t len);
int (*Fscheck)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Link)(struct Vnode *src, struct Vnode *dstParent, struct Vnode **dst, const char *dstName);
int (*Symlink)(struct Vnode *parentVnode, struct Vnode **newVnode, const char *path, const char *target);
ssize_t (*Readlink)(struct Vnode *vnode, char *buffer, size_t bufLen);
};
typedef int VfsHashCmp(struct Vnode *vnode, void *arg);
int VnodesInit(void);
int VnodeDevInit(void);
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **vnode);
int VnodeFree(struct Vnode *vnode);
int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags);
int VnodeHold(void);
int VnodeDrop(void);
void VnodeRefDec(struct Vnode *vnode);
int VnodeFreeAll(const struct Mount *mnt);
int VnodeHashInit(void);
uint32_t VfsHashIndex(struct Vnode *vnode);
int VfsHashGet(const struct Mount *mount, uint32_t hash, struct Vnode **vnode, VfsHashCmp *fun, void *arg);
void VfsHashRemove(struct Vnode *vnode);
int VfsHashInsert(struct Vnode *vnode, uint32_t hash);
void ChangeRoot(struct Vnode *newRoot);
BOOL VnodeInUseIter(const struct Mount *mount);
struct Vnode *VnodeGetRoot(void);
void VnodeMemoryDump(void);
int VnodeDestory(struct Vnode *vnode);
#ifndef _FS_VNODE_H_
#define _FS_VNODE_H_
#include "../../vfs/include/vnode.h" /* for hdf compatibility, should remove later */
#endif /* !_VNODE_H_ */
../../../../../third_party/NuttX/fs/inode/inode.h
\ No newline at end of file
../../../../../third_party/NuttX/include/nuttx/net/net.h
\ No newline at end of file
../../../../third_party/NuttX/include/syslog.h
\ No newline at end of file
......@@ -41,6 +41,7 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#define PATH_MAX 256
#define CONFIG_DISABLE_MQUEUE // disable posix mqueue inode configure
/* file system configur */
......@@ -88,6 +89,7 @@ extern "C" {
#define CONFIG_NFILE_STREAMS 1 // enable file stream
#define CONFIG_STDIO_BUFFER_SIZE 0
#define CONFIG_NUNGET_CHARS 0
#define MIN_START_FD 3 // 0,1,2 are used for stdin,stdout,stderr respectively
#define FD_SET_TOTAL_SIZE (FD_SETSIZE + CONFIG_NEXPANED_DESCRIPTORS)
#define FD_SETSIZE (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS)
......@@ -127,6 +129,12 @@ extern "C" {
#define VFS_USING_WORKDIR // enable current working directory
/* permission configure */
#define DEFAULT_DIR_MODE 0777
#define DEFAULT_FILE_MODE 0666
#define MAX_DIRENT_NUM 14 // 14 means 4096 length buffer can store 14 dirent, see struct DIR
#ifdef __cplusplus
#if __cplusplus
}
......
......@@ -35,6 +35,7 @@ LOCAL_SRCS := $(wildcard src/*.c) \
$(wildcard $(LITEOSTHIRDPARTY)/Linux_Kernel/fs/jffs2/*.c)
LOCAL_INCLUDE := \
-I $(LITEOSTOPDIR)/fs/jffs2/include \
-I $(LITEOSTOPDIR)/drivers/mtd/multi_partition/include \
-I $(LITEOSTHIRDPARTY)/Linux_Kernel/fs/jffs2 \
-I $(LITEOSTHIRDPARTY)/Linux_Kernel/fs
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS)
......
......@@ -46,7 +46,8 @@
#include "fs/dirent_fs.h"
#include "fs/fs.h"
#include "fs/vnode.h"
#include "fs/driver.h"
#include "vnode.h"
#include "mtd_list.h"
#include "mtd_partition.h"
#include "jffs2_hash.h"
......
......@@ -32,6 +32,7 @@ include $(LITEOSTOPDIR)/config.mk
MODULE_NAME := $(notdir $(shell pwd))
LOCAL_SRCS := $(wildcard $(LITEOSTHIRDPARTY)/NuttX/fs/nfs/*.c)
LOCAL_INCLUDE := -I $(wildcard $(LITEOSTHIRDPARTY)/NuttX/include)
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS)
......
......@@ -40,6 +40,7 @@
#ifdef LOSCFG_FS_PROC
#include "linux/spinlock.h"
#include "asm/atomic.h"
#include "vnode.h"
#include "fs/file.h"
#include "los_seq_buf.h"
......
......@@ -35,7 +35,7 @@
#include <sys/mount.h>
#include <sys/statfs.h>
#include "fs/file.h"
#include "fs/mount.h"
#include "internal.h"
static int ShowType(const char *mountPoint, struct statfs *statBuf, void *arg)
......
......@@ -38,6 +38,9 @@
#ifdef LOSCFG_FS_PROC
#define PROCFS_MOUNT_POINT "/proc"
#define PROCFS_MOUNT_POINT_SIZE (sizeof(PROCFS_MOUNT_POINT) - 1)
void ProcFsInit(void)
{
int ret;
......
......@@ -36,6 +36,8 @@
#include <unistd.h>
#include "fs/dirent_fs.h"
#include "fs/mount.h"
#include "fs/fs.h"
#include "los_tables.h"
#include "internal.h"
......
......@@ -45,7 +45,6 @@
#include "shcmd.h"
#include "proc_file.h"
#include "dirent.h"
#include "fs/fs.h"
#include "proc_fs.h"
#define WRITEPROC_ARGC 3
......
......@@ -32,6 +32,7 @@ include $(LITEOSTOPDIR)/config.mk
MODULE_NAME := $(notdir $(shell pwd))
LOCAL_SRCS := $(wildcard $(LITEOSTHIRDPARTY)/NuttX/fs/tmpfs/*.c)
LOCAL_INCLUDE := -I $(wildcard $(LITEOSTHIRDPARTY)/NuttX/include)
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS)
......
......@@ -30,7 +30,6 @@
include $(LITEOSTOPDIR)/config.mk
MODULE_NAME := $(notdir $(shell pwd))
LOCAL_SRCS := \
$(LITEOSTOPDIR)/fs/vfs/mount.c \
$(LITEOSTOPDIR)/fs/vfs/vnode.c \
......@@ -71,7 +70,6 @@ $(LITEOSTHIRDPARTY)/NuttX/fs/vfs/fs_write.c \
$(wildcard operation/*.c) \
\
$(LITEOSTHIRDPARTY)/NuttX/fs/inode/fs_files.c \
$(LITEOSTHIRDPARTY)/NuttX/fs/inode/fs_inode.c \
\
$(LITEOSTHIRDPARTY)/NuttX/fs/dirent/fs_closedir.c \
$(LITEOSTHIRDPARTY)/NuttX/fs/dirent/fs_opendir.c \
......@@ -84,7 +82,6 @@ $(LITEOSTHIRDPARTY)/NuttX/fs/mount/fs_mount.c \
$(LITEOSTHIRDPARTY)/NuttX/fs/mount/fs_umount.c \
\
$(LITEOSTHIRDPARTY)/NuttX/fs/driver/fs_blockproxy.c \
$(LITEOSTHIRDPARTY)/NuttX/fs/driver/fs_devsyslog.c \
$(LITEOSTHIRDPARTY)/NuttX/fs/mount/fs_foreachmountpoint.c \
$(LITEOSTHIRDPARTY)/NuttX/fs/driver/fs_findblockdriver.c \
$(LITEOSTHIRDPARTY)/NuttX/fs/driver/fs_openblockdriver.c \
......@@ -99,11 +96,10 @@ $(wildcard vfs_cmd/*.c)
LOCAL_INCLUDE := \
-I $(LITEOSTOPDIR)/fs/vfs/include \
-I $(LITEOSTOPDIR)/fs/vfs/include/bcache\
-I $(LITEOSTOPDIR)/fs/vfs/include/disk\
-I $(LITEOSTOPDIR)/fs/vfs/include/driver\
-I $(LITEOSTOPDIR)/fs/vfs/include/multi_partition\
-I $(LITEOSTOPDIR)/drivers/block/disk/include\
-I $(LITEOSTOPDIR)/drivers/char/bch/include\
-I $(LITEOSTOPDIR)/drivers/mtd/multi_partition/include\
-I $(LITEOSTOPDIR)/fs/vfs/include/operation\
-I $(LITEOSTOPDIR)/fs/include/inode\
-I $(LITEOSTOPDIR)/syscall\
ifeq ($(LOSCFG_FS_FAT), y)
......
......@@ -34,7 +34,6 @@
#include "stdlib.h"
#include "linux/delay.h"
#include "disk_pri.h"
#include "fs_other.h"
#include "user_copy.h"
#undef HALARC_ALIGNMENT
......
......@@ -35,7 +35,7 @@
#include "pthread.h"
#include "linux/rbtree.h"
#include "los_list.h"
#include "fs/vnode.h"
#include "vnode.h"
#ifdef __cplusplus
#if __cplusplus
......
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-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:
......@@ -29,21 +28,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _FS_POLL_PRI_H
#define _FS_POLL_PRI_H
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern void poll_wait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _FS_POLL_PRI_H */
#ifndef _FS_POLL_PRI_H_
#define _FS_POLL_PRI_H_
/* empty file for hdf compatibility should remove later */
#endif
/*
* 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.
*/
#ifndef FS_FILE_H
#define FS_FILE_H
#define MIN_START_FD 3 // 0,1,2 are used for stdin,stdout,stderr respectively
int AllocProcessFd(void);
int AllocLowestProcessFd(int minFd);
int AllocSpecifiedProcessFd(int procFd);
int AllocAndAssocProcessFd(int sysFd, int minFd);
int AllocAndAssocSystemFd(int procFd, int minFd);
void AssociateSystemFd(int procFd, int sysFd);
int DisassociateProcessFd(int procFd);
int GetAssociatedSystemFd(int procFd);
int CheckProcessFd(int procFd);
void FreeProcessFd(int procFd);
int CopyFdToProc(int fd, unsigned int targetPid);
int CloseProcFd(int fd, unsigned int targetPid);
#endif
/*
* 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.
*/
#ifndef _FS_OTHER_H
#define _FS_OTHER_H
#include "sys/types.h"
#include "fs/vnode.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern void lsfd(void);
extern void set_sd_sync_fn(int (*sync_fn)(int));
extern struct Vnode *files_get_openfile(int fd);
#define READ_OP 4
#define WRITE_OP 2
#define EXEC_OP 1
#define UGO_NUMS 3
#define MODE_IXUGO 0111
#define USER_MODE_SHIFT 6
#define GROUP_MODE_SHIFT 3
#define UMASK_FULL 0777
mode_t GetUmask(void);
int VfsPermissionCheck(uint fuid, uint fgid, mode_t fileMode, int accMode);
int VfsVnodePermissionCheck(const struct Vnode *node, int accMode);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _FS_OTHER_H */
......@@ -33,7 +33,7 @@
#include "los_list.h"
#include "fs/mount.h"
#include "fs/vnode.h"
#include "vnode.h"
struct PathCache {
struct Vnode *parentVnode; /* vnode points to the cache */
......@@ -48,7 +48,6 @@ struct PathCache {
int PathCacheInit(void);
int PathCacheFree(struct PathCache *cache);
struct PathCache *PathCacheAlloc(struct Vnode *parent, struct Vnode *vnode, const char *name, uint8_t len);
int PathCacheAllocDummy(struct Vnode *parent, struct Vnode **vnode, const char *name, uint8_t len);
int PathCacheLookup(struct Vnode *parent, const char *name, int len, struct Vnode **vnode);
void VnodePathCacheFree(struct Vnode *vnode);
void PathCacheMemoryDump(void);
......
/*
* Copyright (c) 2021-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.
*/
#ifndef _VNODE_H_
#define _VNODE_H_
#include <sys/stat.h>
#include "fs/fs_operation.h"
#include "fs/file.h"
#include "los_list.h"
typedef LOS_DL_LIST LIST_HEAD;
typedef LOS_DL_LIST LIST_ENTRY;
#define VNODE_FLAG_MOUNT_NEW (1 << 0) /* new mount vnode*/
#define VNODE_FLAG_MOUNT_ORIGIN (1 << 1) /* origin vnode */
#define V_CREATE (1 << 0)
#define V_DUMMY (1 << 2)
#ifndef VFS_ERROR
#define VFS_ERROR -1
#endif
#ifndef OK
#define OK 0
#endif
#define AT_REMOVEDIR 0x200
#define DEV_PATH_LEN 5
/* Permission flags */
#define READ_OP 4
#define WRITE_OP 2
#define EXEC_OP 1
#define UGO_NUMS 3
#define MODE_IXUGO 0111
#define USER_MODE_SHIFT 6
#define GROUP_MODE_SHIFT 3
#define UMASK_FULL 0777
/* Attribute flags. */
#define CHG_MODE 1
#define CHG_UID 2
#define CHG_GID 4
#define CHG_SIZE 8
#define CHG_ATIME 16
#define CHG_MTIME 32
#define CHG_CTIME 64
struct IATTR
{
/* This structure is used for record vnode attr. */
unsigned int attr_chg_valid;
unsigned int attr_chg_flags;
unsigned attr_chg_mode;
unsigned attr_chg_uid;
unsigned attr_chg_gid;
unsigned attr_chg_size;
unsigned attr_chg_atime;
unsigned attr_chg_mtime;
unsigned attr_chg_ctime;
};
/*
* Vnode types. VNODE_TYPE_UNKNOWN means no type.
*/
enum VnodeType {
VNODE_TYPE_UNKNOWN, /* unknown type */
VNODE_TYPE_REG, /* regular fle */
VNODE_TYPE_DIR, /* directory */
VNODE_TYPE_BLK, /* block device */
VNODE_TYPE_CHR, /* char device */
VNODE_TYPE_BCHR, /* block char mix device */
VNODE_TYPE_FIFO, /* pipe */
VNODE_TYPE_LNK, /* link */
};
struct fs_dirent_s;
struct VnodeOps;
struct IATTR;
struct Vnode {
enum VnodeType type; /* vnode type */
int useCount; /* ref count of users */
uint32_t hash; /* vnode hash */
uint uid; /* uid for dac */
uint gid; /* gid for dac */
mode_t mode; /* mode for dac */
LIST_HEAD parentPathCaches; /* pathCaches point to parents */
LIST_HEAD childPathCaches; /* pathCaches point to children */
struct Vnode *parent; /* parent vnode */
struct VnodeOps *vop; /* vnode operations */
struct file_operations_vfs *fop; /* file operations */
void *data; /* private data */
uint32_t flag; /* vnode flag */
LIST_ENTRY hashEntry; /* list entry for bucket in hash table */
LIST_ENTRY actFreeEntry; /* vnode active/free list entry */
struct Mount *originMount; /* fs info about this vnode */
struct Mount *newMount; /* fs info about who mount on this vnode */
};
struct VnodeOps {
int (*Create)(struct Vnode *parent, const char *name, int mode, struct Vnode **vnode);
int (*Lookup)(struct Vnode *parent, const char *name, int len, struct Vnode **vnode);
int (*Open)(struct Vnode *vnode, int fd, int mode, int flags);
int (*Close)(struct Vnode *vnode);
int (*Reclaim)(struct Vnode *vnode);
int (*Unlink)(struct Vnode *parent, struct Vnode *vnode, const char *fileName);
int (*Rmdir)(struct Vnode *parent, struct Vnode *vnode, const char *dirName);
int (*Mkdir)(struct Vnode *parent, const char *dirName, mode_t mode, struct Vnode **vnode);
int (*Readdir)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Opendir)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Rewinddir)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Closedir)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Getattr)(struct Vnode *vnode, struct stat *st);
int (*Setattr)(struct Vnode *vnode, struct stat *st);
int (*Chattr)(struct Vnode *vnode, struct IATTR *attr);
int (*Rename)(struct Vnode *src, struct Vnode *dstParent, const char *srcName, const char *dstName);
int (*Truncate)(struct Vnode *vnode, off_t len);
int (*Truncate64)(struct Vnode *vnode, off64_t len);
int (*Fscheck)(struct Vnode *vnode, struct fs_dirent_s *dir);
int (*Link)(struct Vnode *src, struct Vnode *dstParent, struct Vnode **dst, const char *dstName);
int (*Symlink)(struct Vnode *parentVnode, struct Vnode **newVnode, const char *path, const char *target);
ssize_t (*Readlink)(struct Vnode *vnode, char *buffer, size_t bufLen);
};
typedef int VfsHashCmp(struct Vnode *vnode, void *arg);
int VnodesInit(void);
int VnodeDevInit(void);
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **vnode);
int VnodeFree(struct Vnode *vnode);
int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags);
int VnodeHold(void);
int VnodeDrop(void);
void VnodeRefDec(struct Vnode *vnode);
int VnodeFreeAll(const struct Mount *mnt);
int VnodeHashInit(void);
uint32_t VfsHashIndex(struct Vnode *vnode);
int VfsHashGet(const struct Mount *mount, uint32_t hash, struct Vnode **vnode, VfsHashCmp *fun, void *arg);
void VfsHashRemove(struct Vnode *vnode);
int VfsHashInsert(struct Vnode *vnode, uint32_t hash);
void ChangeRoot(struct Vnode *newRoot);
BOOL VnodeInUseIter(const struct Mount *mount);
struct Vnode *VnodeGetRoot(void);
void VnodeMemoryDump(void);
mode_t GetUmask(void);
int VfsPermissionCheck(uint fuid, uint fgid, mode_t fileMode, int accMode);
int VfsVnodePermissionCheck(const struct Vnode *node, int accMode);
#endif /* !_VNODE_H_ */
......@@ -29,9 +29,8 @@
*/
#include "fs/mount.h"
#include "fs/vfs_util.h"
#include "fs/path_cache.h"
#include "fs/vnode.h"
#include "path_cache.h"
#include "vnode.h"
#ifdef LOSCFG_DRIVERS_RANDOM
#include "hisoc/random.h"
#else
......
......@@ -36,10 +36,11 @@
#include "capability_api.h"
#include "errno.h"
#include "fs/fs_operation.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "string.h"
#include "stdlib.h"
#include "sys/stat.h"
#include "vnode.h"
/****************************************************************************
* Static Functions
......
......@@ -42,7 +42,7 @@
#include "sys/stat.h"
#include "sys/prctl.h"
#include "fs/dirent_fs.h"
#include "fs/vnode.h"
#include "vnode.h"
/****************************************************************************
* Name: fscheck
......
......@@ -36,7 +36,7 @@
#include "assert.h"
#include "errno.h"
#include "fcntl.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "sys/types.h"
#include "sched.h"
#include "unistd.h"
......
......@@ -36,7 +36,7 @@
#include "assert.h"
#include "errno.h"
#include "fcntl.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "sched.h"
#include "sys/types.h"
#include "unistd.h"
......
......@@ -29,11 +29,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fs_file.h"
#include "fs/file.h"
#include "los_process_pri.h"
#include "fs/fd_table.h"
#include "fs/file.h"
#include "fs/fs.h"
#include "mqueue.h"
#ifdef LOSCFG_NET_LWIP_SACK
#include "lwip/sockets.h"
......@@ -477,4 +475,4 @@ int CloseProcFd(int procFd, unsigned int targetPid)
return 0;
#endif
}
\ No newline at end of file
}
......@@ -30,7 +30,7 @@
*/
#include "fs/file.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "fs/fs_operation.h"
#include "unistd.h"
#include "los_mux.h"
......
......@@ -31,17 +31,16 @@
#include "disk_pri.h"
#include "fcntl.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "fs/fs_operation.h"
#include "linux/spinlock.h"
#include "los_init.h"
#include "los_printf.h"
#include "fs/mount.h"
#include "fs/path_cache.h"
#include "path_cache.h"
#include "sys/statfs.h"
#include "unistd.h"
#include "fs/vfs_util.h"
#include "fs/vnode.h"
#include "vnode.h"
void los_vfs_init(void)
{
......
......@@ -29,7 +29,6 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fs_other.h"
#include "errno.h"
#include "stdlib.h"
#include "string.h"
......@@ -39,12 +38,12 @@
#include "sys/stat.h"
#include "sys/prctl.h"
#include "fs/fd_table.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "linux/spinlock.h"
#include "los_process_pri.h"
#include "los_task_pri.h"
#include "capability_api.h"
#include "fs/vnode.h"
#include "vnode.h"
#define MAX_DIR_ENT 1024
int fstat(int fd, struct stat *buf)
......
......@@ -34,7 +34,7 @@
#include "unistd.h"
#include "string.h"
#include "stdlib.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "user_copy.h"
#include "stdio.h"
#include "limits.h"
......
......@@ -36,11 +36,10 @@
#include "errno.h"
#include "vfs_config.h"
#include "sys/stat.h"
#include "fs/vnode.h"
#include "vnode.h"
#include "string.h"
#include "stdlib.h"
#include "utime.h"
#include "fs_other.h"
/****************************************************************************
* Global Functions
......
/*
* 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/statfs.h"
#include "string.h"
#include "sched.h"
#include "errno.h"
#include "stdlib.h"
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: statpseudo
****************************************************************************/
#ifdef LOSCFG_FS_FAT_VIRTUAL_PARTITION
int virstatfs(const char *path, struct statfs *buf)
{
//currently not implemented
return LOS_OK;
}
#endif
......@@ -34,7 +34,7 @@
#include "unistd.h"
#include "string.h"
#include "stdlib.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "user_copy.h"
#include "limits.h"
......
......@@ -28,12 +28,12 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fs/path_cache.h"
#include "path_cache.h"
#include "los_config.h"
#include "los_hash.h"
#include "stdlib.h"
#include "limits.h"
#include "fs/vfs_util.h"
#include "fs/vnode.h"
#include "vnode.h"
#define PATH_CACHE_HASH_MASK (LOSCFG_MAX_PATH_CACHE_SIZE - 1)
LIST_HEAD g_pathCacheHashEntrys[LOSCFG_MAX_PATH_CACHE_SIZE];
......@@ -81,8 +81,8 @@ void PathCacheMemoryDump(void)
static uint32_t NameHash(const char *name, int len, struct Vnode *dvp)
{
uint32_t hash;
hash = fnv_32_buf(name, len, FNV1_32_INIT);
hash = fnv_32_buf(&dvp, sizeof(struct Vnode *), hash);
hash = LOS_HashFNV32aBuf(name, len, FNV1_32A_INIT);
hash = LOS_HashFNV32aBuf(&dvp, sizeof(struct Vnode *), hash);
return hash;
}
......@@ -141,29 +141,6 @@ int PathCacheFree(struct PathCache *nc)
return LOS_OK;
}
/* alloc an empty node and awlays add it to path_cache.cache */
int PathCacheAllocDummy(struct Vnode *parent, struct Vnode **vnode, const char *name, uint8_t len)
{
int ret;
struct PathCache *dt = NULL;
ret = VnodeAlloc(NULL, vnode);
if (ret != LOS_OK) {
PRINT_ERR("pathCache alloc vnode %s failed\n", name);
return -ENOENT;
}
dt = PathCacheAlloc(parent, *vnode, name, len);
if (dt == NULL) {
PRINT_ERR("pathCache alloc pathCache %s failed\n", name);
VnodeFree(*vnode);
*vnode = NULL;
return -ENOENT;
}
return LOS_OK;
}
int PathCacheLookup(struct Vnode *parent, const char *name, int len, struct Vnode **vnode)
{
struct PathCache *nc = NULL;
......
......@@ -36,11 +36,9 @@
#include "los_typedef.h"
#include "shell.h"
#include "fs/fs.h"
#include "sys/stat.h"
#include "stdlib.h"
#include "unistd.h"
#include "fs_other.h"
#include "fcntl.h"
#include "sys/statfs.h"
#include "stdio.h"
......
......@@ -29,10 +29,9 @@
*/
#include "los_mux.h"
#include "fs/vfs_util.h"
#include "fs/vnode.h"
#include "vnode.h"
#include "fs/dirent_fs.h"
#include "fs_other.h"
#include "path_cache.h"
LIST_HEAD g_vnodeFreeList; /* free vnodes list */
LIST_HEAD g_vnodeVirtualList; /* dev vnodes list */
......@@ -183,10 +182,17 @@ int VnodeFree(struct Vnode *vnode)
vnode->vop->Reclaim(vnode);
}
memset_s(vnode, sizeof(struct Vnode), 0, sizeof(struct Vnode));
LOS_ListAdd(&g_vnodeFreeList, &vnode->actFreeEntry);
g_freeVnodeSize++;
if (vnode->vop == &g_devfsOps) {
/* for dev vnode, just free it */
free(vnode->data);
free(vnode);
g_totalVnodeSize--;
} else {
/* for normal vnode, reclaim it to g_VnodeFreeList */
memset_s(vnode, sizeof(struct Vnode), 0, sizeof(struct Vnode));
LOS_ListAdd(&g_vnodeFreeList, &vnode->actFreeEntry);
g_freeVnodeSize++;
}
VnodeDrop();
return LOS_OK;
......@@ -526,7 +532,7 @@ int VnodeDevInit()
struct Vnode *devNode = NULL;
struct Mount *devMount = NULL;
int retval = VnodeLookup("/dev", &devNode, V_CREATE | V_CACHE | V_DUMMY);
int retval = VnodeLookup("/dev", &devNode, V_CREATE | V_DUMMY);
if (retval != LOS_OK) {
PRINT_ERR("VnodeDevInit failed error %d\n", retval);
return retval;
......@@ -619,28 +625,3 @@ void VnodeMemoryDump(void)
PRINTK("Vnode number = %d\n", vnodeCount);
PRINTK("Vnode memory size = %d(B)\n", vnodeCount * sizeof(struct Vnode));
}
int VnodeDestory(struct Vnode *vnode)
{
if (vnode == NULL || vnode->vop != &g_devfsOps) {
/* destory only support dev vnode */
return -EINVAL;
}
VnodeHold();
if (vnode->useCount > 0) {
VnodeDrop();
return -EBUSY;
}
VnodePathCacheFree(vnode);
LOS_ListDelete(&(vnode->hashEntry));
LOS_ListDelete(&vnode->actFreeEntry);
free(vnode->data);
free(vnode);
g_totalVnodeSize--;
VnodeDrop();
return LOS_OK;
}
......@@ -29,7 +29,8 @@
*/
#include "los_mux.h"
#include "fs/vnode.h"
#include "vnode.h"
#include "fs/mount.h"
#define VNODE_HASH_BUCKETS 128
......@@ -134,4 +135,4 @@ int VfsHashInsert(struct Vnode *vnode, uint32_t hash)
LOS_ListHeadInsert(VfsHashBucket(vnode->originMount, hash), &vnode->hashEntry);
(void)LOS_MuxUnlock(&g_vnodeHashMux);
return LOS_OK;
}
\ No newline at end of file
}
......@@ -32,8 +32,6 @@
#ifndef ZPFS_VFS_ZPFS_H
#define ZPFS_VFS_ZPFS_H
#include <fs/fs.h>
#include "compiler.h"
#include "los_base.h"
#include "los_typedef.h"
......
......@@ -49,7 +49,7 @@
#include "los_process_pri.h"
#include "los_vm_dump.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#include "fs/file.h"
#endif
#include "los_sched_pri.h"
......
......@@ -43,7 +43,7 @@
#include "los_vm_dump.h"
#include "los_process_pri.h"
#ifdef LOSCFG_FS_VFS
#include "fs/path_cache.h"
#include "path_cache.h"
#endif
#ifdef LOSCFG_KERNEL_VM
......
......@@ -37,7 +37,7 @@
#include "los_vm_dump.h"
#include "los_mmu_descriptor_v6.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#include "fs/file.h"
#endif
#include "los_printf.h"
#include "los_vm_page.h"
......
......@@ -41,6 +41,7 @@
#include "los_vm_fault.h"
#include "los_process_pri.h"
#include "los_vm_lock.h"
#include "vnode.h"
#ifndef UNUSED
#define UNUSED(x) (VOID)x
......
......@@ -41,7 +41,7 @@
#include "los_arch_mmu.h"
#include "los_process_pri.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#include "fs/file.h"
#endif
#include "los_task.h"
#include "los_memory_pri.h"
......
......@@ -34,7 +34,7 @@ MODULE_NAME := rootfs
LOCAL_SRCS := $(wildcard los_rootfs.c)
LOCAL_INCLUDE := \
-I $(LITEOSTOPDIR)/kernel/common \
-I $(LITEOSTOPDIR)/kernel/common \
ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y)
LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/../../device/qemu/arm_virt/config/cfiflash
......
......@@ -47,10 +47,8 @@
#include "los_exc_pri.h"
#include "los_process_pri.h"
#include "los_sched_pri.h"
#include "fs/path_cache.h"
#include "fs/vfs_util.h"
#include "user_copy.h"
#include "fs/vnode.h"
#include "fs/driver.h"
#define EACH_CHAR 1
#define UART_IOC_MAGIC 'u'
......
......@@ -31,9 +31,6 @@
#include "los_base.h"
#include "los_hwi.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#endif
#ifdef LOSCFG_SHELL
#include "shcmd.h"
#endif
......
......@@ -35,7 +35,8 @@
#include "los_mux.h"
#include "los_process_pri.h"
#include "los_task_pri.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "fs/driver.h"
#include "los_vm_map.h"
#include "los_vm_lock.h"
#include "user_copy.h"
......
......@@ -42,7 +42,7 @@
#include "los_rootfs.h"
#endif
#include "mtd_list.h"
#include "fs/path_cache.h"
#include "fs/driver.h"
#ifdef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7
#include "mtd_partition.h"
......
......@@ -32,7 +32,7 @@
#include "los_partition_utils.h"
#include "sys/mount.h"
#include "fs/vnode.h"
#include "vnode.h"
#ifdef LOSCFG_PLATFORM_PATCHFS
......
......@@ -36,11 +36,9 @@
#endif
#ifdef LOSCFG_FS_VFS
#include "console.h"
#include "fs/driver.h"
#endif
#include "fs/path_cache.h"
STATIC volatile UINT32 g_serialType = 0;
STATIC struct file g_serialFilep;
......
......@@ -33,9 +33,7 @@
#define _VIRTUAL_SERIAL_H
#include "los_config.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#endif
#include "fs/file.h"
#if defined(LOSCFG_DRIVERS_USB_SERIAL_GADGET) || defined(LOSCFG_DRIVERS_USB_ETH_SER_GADGET)
#include "implementation/usb_api_pri.h"
#endif
......
......@@ -45,7 +45,7 @@
#ifdef LOSCFG_DRIVERS_TZDRIVER
#include "fs/file.h"
#endif
#include "fs/fs.h"
#include "fs/file.h"
#include "unistd.h"
#ifdef __cplusplus
......
......@@ -32,7 +32,7 @@
#include "los_load_elf.h"
#include "fcntl.h"
#include "fs/fd_table.h"
#include "fs_file.h"
#include "fs/file.h"
#include "los_config.h"
#include "los_vm_map.h"
#include "los_vm_syscall.h"
......
......@@ -31,8 +31,8 @@
#include "hm_liteipc.h"
#include "linux/kernel.h"
#include "fs/fs.h"
#include "fs_file.h"
#include "fs/file.h"
#include "fs/driver.h"
#include "los_init.h"
#include "los_mp.h"
#include "los_mux.h"
......
......@@ -47,6 +47,13 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifndef UNUSED
#define UNUSED(var) \
do { \
(void)var; \
} while (0)
#endif
/* for ARM Compiler */
#if defined ( __CC_ARM )
#ifndef ASM
......
......@@ -34,8 +34,6 @@
#include "los_config.h"
#include "linux/wait.h"
#include "fs/fs.h"
#include "fs_poll_pri.h"
#ifdef __cplusplus
#if __cplusplus
......
......@@ -47,7 +47,7 @@
#include "lwip/sockets.h"
#include "telnet_pri.h"
#include "fs/vnode.h"
#include "fs/driver.h"
/* event: there are more commands left in the FIFO to run */
#define TELNET_EVENT_MORE_CMD 0x01
......
......@@ -34,7 +34,6 @@
#include "unistd.h"
#include "fs/fd_table.h"
#include "fs/file.h"
#include "fs/fs.h"
#include "fs/fs_operation.h"
#include "sys/mount.h"
#include "los_task_pri.h"
......@@ -51,10 +50,10 @@
#include "los_vm_map.h"
#include "los_memory.h"
#include "los_strncpy_from_user.h"
#include "fs_other.h"
#include "fs_file.h"
#include "fs/file.h"
#include "capability_type.h"
#include "capability_api.h"
#include "sys/statfs.h"
#define HIGH_SHIFT_BIT 32
......
......@@ -37,7 +37,7 @@
#include "user_copy.h"
#include "los_signal.h"
#include "los_strncpy_from_user.h"
#include "fs_file.h"
#include "fs/file.h"
#define MQUEUE_FD_U2K(id) \
do { \
......
......@@ -31,7 +31,7 @@
#define _GNU_SOURCE
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#include "fs/file.h"
#include "fs/file.h"
#endif
#include "los_init.h"
......
......@@ -32,13 +32,11 @@
#ifndef _LOS_SYSCALL_H
#define _LOS_SYSCALL_H
#include <sys/statfs.h>
#include "los_typedef.h"
#include "los_task.h"
#include "los_mux.h"
#include "los_signal.h"
#ifdef LOSCFG_FS_VFS
#include "fs/fs.h"
#endif
#include "syscall.h"
#include "sysinfo.h"
#include "time_posix.h"
......@@ -60,10 +58,11 @@
#ifdef LOSCFG_FS_VFS
#include "sys/socket.h"
#include "dirent.h"
#include "fs/fs.h"
#include "fs/file.h"
#endif
#include <sys/wait.h>
#include "sys/resource.h"
#include "vnode.h"
/* process */
extern unsigned int SysGetGroupId(void);
......
......@@ -31,8 +31,7 @@
#include "syscall_pub.h"
#include "stdlib.h"
#include "fs_file.h"
#include "fs/fs.h"
#include "fs/file.h"
#include "los_process_pri.h"
#include "los_signal.h"
#include "los_syscall.h"
......
......@@ -34,7 +34,7 @@
#include "errno.h"
#include "unistd.h"
#include "los_vm_syscall.h"
#include "fs_file.h"
#include "fs/file.h"
void *SysMmap(void *addr, size_t size, int prot, int flags, int fd, size_t offset)
......
......@@ -284,14 +284,13 @@ ifeq ($(LOSCFG_FS_VFS), y)
LITEOS_BASELIB += -lvfs -lmulti_partition
ifeq ($(LOSCFG_FS_VFS_BLOCK_DEVICE), y)
LITEOS_BASELIB += -lbch
LIB_SUBDIRS += fs/vfs fs/vfs/bch
LIB_SUBDIRS += $(LITEOSTOPDIR)/drivers/char/bch
endif
LIB_SUBDIRS += fs/vfs fs/vfs/multi_partition
LIB_SUBDIRS += fs/vfs drivers/mtd/multi_partition
LITEOS_VFS_INCLUDE += -I $(LITEOSTOPDIR)/fs/include
LITEOS_VFS_INCLUDE += -I $(LITEOSTOPDIR)/fs/vfs/include/driver
LITEOS_VFS_INCLUDE += -I $(LITEOSTOPDIR)/fs/vfs/include/operation
LITEOS_VFS_MTD_INCLUDE := -I $(LITEOSTOPDIR)/fs/vfs/include/multi_partition
LITEOS_VFS_DISK_INCLUDE := -I $(LITEOSTOPDIR)/fs/vfs/include/disk
LITEOS_VFS_MTD_INCLUDE := -I $(LITEOSTOPDIR)/drivers/mtd/multi_partition/include
LITEOS_VFS_DISK_INCLUDE := -I $(LITEOSTOPDIR)/drivers/block/disk/include
endif
ifeq ($(LOSCFG_FS_FAT), y)
......@@ -308,13 +307,14 @@ endif
ifeq ($(LOSCFG_FS_FAT_DISK), y)
LITEOS_BASELIB += -ldisk
LIB_SUBDIRS += fs/vfs/disk
LIB_SUBDIRS += $(LITEOSTOPDIR)/drivers/block/disk
endif
ifeq ($(LOSCFG_FS_FAT_CACHE), y)
LITEOS_BASELIB += -lbcache
LIB_SUBDIRS += fs/vfs/bcache
LITEOS_FAT_CACHE_INCLUDE += -I $(LITEOSTOPDIR)/fs/vfs/include/bcache
LITEOS_FAT_CACHE_INCLUDE += -I $(LITEOSTOPDIR)/fs/vfs/include/bcache \
-I $(LITEOSTOPDIR)/fs/vfs/include
endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册