commit
36e5124c0a
|
@ -1 +0,0 @@
|
|||
../../../../../../third_party/NuttX/include/nuttx/usb/storage.h
|
|
@ -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(§, 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(§, 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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../../../../third_party/NuttX/include/nuttx/compiler.h
|
|
@ -1 +0,0 @@
|
|||
../../../../third_party/NuttX/include/debug.h
|
|
@ -1 +0,0 @@
|
|||
../../../../../third_party/NuttX/include/nuttx/fs/automount.h
|
|
@ -0,0 +1,298 @@
|
|||
/****************************************************************************
|
||||
* 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_ */
|
|
@ -1 +0,0 @@
|
|||
../../../../../third_party/NuttX/include/nuttx/fs/file.h
|
|
@ -0,0 +1,594 @@
|
|||
/****************************************************************************
|
||||
* include/fs/file.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 __INCLUDE_FS_FILE_H
|
||||
#define __INCLUDE_FS_FILE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "vfs_config.h"
|
||||
|
||||
#include "sys/types.h"
|
||||
#include "sys/stat.h"
|
||||
#include "semaphore.h"
|
||||
#include "poll.h"
|
||||
#include "los_vm_map.h"
|
||||
#include "los_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifndef VFS_ERROR
|
||||
#define VFS_ERROR -1
|
||||
#endif
|
||||
|
||||
#ifndef OK
|
||||
#define OK 0
|
||||
#endif
|
||||
|
||||
/* This is the underlying representation of an open file. A file
|
||||
* descriptor is an index into an array of such types. The type associates
|
||||
* the file descriptor to the file state and to a set of vnode operations.
|
||||
*/
|
||||
|
||||
struct Vnode;
|
||||
|
||||
struct file
|
||||
{
|
||||
unsigned int f_magicnum; /* file magic number */
|
||||
int f_oflags; /* Open mode flags */
|
||||
struct Vnode *f_vnode; /* Driver interface */
|
||||
loff_t f_pos; /* File position */
|
||||
unsigned long f_refcount; /* reference count */
|
||||
char *f_path; /* File fullpath */
|
||||
void *f_priv; /* Per file driver private data */
|
||||
const char *f_relpath; /* realpath */
|
||||
struct page_mapping *f_mapping; /* mapping file to memory */
|
||||
void *f_dir; /* DIR struct for iterate the directory if open a directory */
|
||||
const struct file_operations_vfs *ops;
|
||||
int fd;
|
||||
};
|
||||
|
||||
/* This defines a list of files indexed by the file descriptor */
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
struct filelist
|
||||
{
|
||||
sem_t fl_sem; /* Manage access to the file list */
|
||||
struct file fl_files[CONFIG_NFILE_DESCRIPTORS];
|
||||
};
|
||||
|
||||
extern struct filelist tg_filelist;
|
||||
#endif
|
||||
|
||||
/* This structure is provided by devices when they are registered with the
|
||||
* system. It is used to call back to perform device specific operations.
|
||||
*/
|
||||
|
||||
struct file_operations_vfs
|
||||
{
|
||||
/* The device driver open method differs from the mountpoint open method */
|
||||
|
||||
int (*open)(struct file *filep);
|
||||
|
||||
/* The following methods must be identical in signature and position because
|
||||
* the struct file_operations and struct mountp_operations are treated like
|
||||
* unions.
|
||||
*/
|
||||
|
||||
int (*close)(struct file *filep);
|
||||
ssize_t (*read)(struct file *filep, char *buffer, size_t buflen);
|
||||
ssize_t (*write)(struct file *filep, const char *buffer, size_t buflen);
|
||||
off_t (*seek)(struct file *filep, off_t offset, int whence);
|
||||
int (*ioctl)(struct file *filep, int cmd, unsigned long arg);
|
||||
int (*mmap)(struct file* filep, struct VmMapRegion *region);
|
||||
/* The two structures need not be common after this point */
|
||||
|
||||
#ifndef CONFIG_DISABLE_POLL
|
||||
int (*poll)(struct file *filep, poll_table *fds);
|
||||
#endif
|
||||
int (*stat)(struct file *filep, struct stat* st);
|
||||
int (*fallocate)(struct file* filep, int mode, off_t offset, off_t len);
|
||||
int (*fallocate64)(struct file *filep, int mode, off64_t offset, off64_t len);
|
||||
int (*fsync)(struct file *filep);
|
||||
ssize_t (*readpage)(struct file *filep, char *buffer, size_t buflen);
|
||||
int (*unlink)(struct Vnode *vnode);
|
||||
};
|
||||
|
||||
/* file mapped in VMM pages */
|
||||
struct page_mapping {
|
||||
LOS_DL_LIST page_list; /* all pages */
|
||||
SPIN_LOCK_S list_lock; /* lock protecting it */
|
||||
LosMux mux_lock; /* mutex lock */
|
||||
unsigned long nrpages; /* number of total pages */
|
||||
unsigned long flags;
|
||||
Atomic ref; /* reference counting */
|
||||
struct file *host; /* owner of this mapping */
|
||||
};
|
||||
|
||||
/* map: full_path(owner) <-> mapping */
|
||||
struct file_map {
|
||||
LOS_DL_LIST head;
|
||||
LosMux lock; /* lock to protect this mapping */
|
||||
struct page_mapping mapping;
|
||||
int name_len;
|
||||
char *rename;
|
||||
char owner[0]; /* owner: full path of file */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Name: files_initlist
|
||||
*
|
||||
* Description:
|
||||
* Initializes the list of files for a new task
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
void files_initlist(struct filelist *list);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: files_releaselist
|
||||
*
|
||||
* Description:
|
||||
* Release a reference to the file list
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
void files_releaselist(struct filelist *list);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_dup2
|
||||
*
|
||||
* Description:
|
||||
* Assign an vnode to a specific files structure. This is the heart of
|
||||
* dup2.
|
||||
*
|
||||
* Equivalent to the non-standard fs_dupfd2() function except that it
|
||||
* accepts struct file instances instead of file descriptors and it does
|
||||
* not set the errno variable.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is return on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
int file_dup2(struct file *filep1, struct file *filep2);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fs_dupfd OR dup
|
||||
*
|
||||
* Description:
|
||||
* Clone a file descriptor 'fd' to an arbitrary descriptor number (any value
|
||||
* greater than or equal to 'minfd'). If socket descriptors are
|
||||
* implemented, then this is called by dup() for the case of file
|
||||
* descriptors. If socket descriptors are not implemented, then this
|
||||
* function IS dup().
|
||||
*
|
||||
* This alternative naming is used when dup could operate on both file and
|
||||
* socket descriptors to avoid drawing unused socket support into the link.
|
||||
*
|
||||
* Returned Value:
|
||||
* fs_dupfd is sometimes an OS internal function and sometimes is a direct
|
||||
* substitute for dup(). So it must return an errno value as though it
|
||||
* were dup().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
int fs_dupfd(int fd, int minfd);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_dup
|
||||
*
|
||||
* Description:
|
||||
* Equivalent to the non-standard fs_dupfd() function except that it
|
||||
* accepts a struct file instance instead of a file descriptor and does
|
||||
* not set the errno variable.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int file_dup(struct file *filep, int minfd);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fs_dupfd2 OR dup2
|
||||
*
|
||||
* Description:
|
||||
* Clone a file descriptor to a specific descriptor number. If socket
|
||||
* descriptors are implemented, then this is called by dup2() for the
|
||||
* case of file descriptors. If socket descriptors are not implemented,
|
||||
* then this function IS dup2().
|
||||
*
|
||||
* This alternative naming is used when dup2 could operate on both file and
|
||||
* socket descriptors to avoid drawing unused socket support into the link.
|
||||
*
|
||||
* Returned Value:
|
||||
* fs_dupfd2 is sometimes an OS internal function and sometimes is a direct
|
||||
* substitute for dup2(). So it must return an errno value as though it
|
||||
* were dup2().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
int fs_dupfd2(int fd1, int fd2);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fs_ioctl
|
||||
*
|
||||
* Description:
|
||||
* Perform device specific operations.
|
||||
*
|
||||
* Input Parameters:
|
||||
* fd File/socket descriptor of device
|
||||
* req The ioctl command
|
||||
* arg The argument of the ioctl cmd
|
||||
*
|
||||
* Returned Value:
|
||||
* >=0 on success (positive non-zero values are cmd-specific)
|
||||
* -1 on failure with errno set properly:
|
||||
*
|
||||
* EBADF
|
||||
* 'fd' is not a valid descriptor.
|
||||
* EFAULT
|
||||
* 'arg' references an inaccessible memory area.
|
||||
* EINVAL
|
||||
* 'cmd' or 'arg' is not valid.
|
||||
* ENOTTY
|
||||
* 'fd' is not associated with a character special device.
|
||||
* ENOTTY
|
||||
* The specified request does not apply to the kind of object that the
|
||||
* descriptor 'fd' references.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifdef CONFIG_LIBC_IOCTL_VARIADIC
|
||||
int fs_ioctl(int fd, int req, unsigned long arg);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_sendfile
|
||||
*
|
||||
* Description:
|
||||
* Transfer a file
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_SENDFILE
|
||||
ssize_t lib_sendfile(int outfd, int infd, off_t *offset, size_t count);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fs_getfilep
|
||||
*
|
||||
* Description:
|
||||
* Given a file descriptor, return the corresponding instance of struct
|
||||
* file. NOTE that this function will currently fail if it is provided
|
||||
* with a socket descriptor.
|
||||
*
|
||||
* Input Parameters:
|
||||
* fd - The file descriptor
|
||||
* filep - The location to return the struct file instance
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
int fs_getfilep(int fd, struct file **filep);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_read
|
||||
*
|
||||
* Description:
|
||||
* file_read() is an internal OS interface. It is functionally similar to
|
||||
* the standard read() interface except:
|
||||
*
|
||||
* - It does not modify the errno variable,
|
||||
* - It is not a cancellation point,
|
||||
* - It does not handle socket descriptors, and
|
||||
* - It accepts a file structure instance instead of file descriptor.
|
||||
*
|
||||
* Input Parameters:
|
||||
* filep - File structure instance
|
||||
* buf - User-provided to save the data
|
||||
* nbytes - The maximum size of the user-provided buffer
|
||||
*
|
||||
* Returned Value:
|
||||
* The positive non-zero number of bytes read on success, 0 on if an
|
||||
* end-of-file condition, or a negated errno value on any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
ssize_t file_read(struct file *filep, void *buf, size_t nbytes);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_write
|
||||
*
|
||||
* Description:
|
||||
* Equivalent to the standard write() function except that is accepts a
|
||||
* struct file instance instead of a file descriptor. Currently used
|
||||
* only by aio_write();
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
ssize_t file_write(struct file *filep, const void *buf, size_t nbytes);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_pread
|
||||
*
|
||||
* Description:
|
||||
* Equivalent to the standard pread function except that is accepts a
|
||||
* struct file instance instead of a file descriptor. Currently used
|
||||
* only by aio_read();
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
ssize_t file_pread(struct file *filep, void *buf, size_t nbytes,
|
||||
off_t offset);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_pwrite
|
||||
*
|
||||
* Description:
|
||||
* Equivalent to the standard pwrite function except that is accepts a
|
||||
* struct file instance instead of a file descriptor. Currently used
|
||||
* only by aio_write();
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
ssize_t file_pwrite(struct file *filep, const void *buf,
|
||||
size_t nbytes, off_t offset);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_seek
|
||||
*
|
||||
* Description:
|
||||
* Equivalent to the standard lseek() function except that is accepts a
|
||||
* struct file instance instead of a file descriptor. Currently used
|
||||
* only by net_sendfile()
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
off_t file_seek(struct file *filep, off_t offset, int whence);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_fsync
|
||||
*
|
||||
* Description:
|
||||
* Equivalent to the standard fsync() function except that is accepts a
|
||||
* struct file instance instead of a file descriptor and it does not set
|
||||
* the errno variable.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
int file_fsync(struct file *filep);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_vfcntl
|
||||
*
|
||||
* Description:
|
||||
* Similar to the standard vfcntl function except that is accepts a struct
|
||||
* struct file instance instead of a file descriptor.
|
||||
*
|
||||
* Input Parameters:
|
||||
* filep - Instance for struct file for the opened file.
|
||||
* cmd - Indentifies the operation to be performed.
|
||||
* ap - Variable argument following the command.
|
||||
*
|
||||
* Returned Value:
|
||||
* The nature of the return value depends on the command. Non-negative
|
||||
* values indicate success. Failures are reported as negated errno
|
||||
* values.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
int file_vfcntl(struct file *filep, int cmd, va_list ap);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: file_seek64
|
||||
*
|
||||
* Description:
|
||||
* Equivalent to the standard lseek64() function except that is accepts a
|
||||
* struct file instance instead of a file descriptor. Currently used
|
||||
* only by net_sendfile()
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
off64_t file_seek64(struct file *filep, off64_t offset, int whence);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: files_allocate
|
||||
*
|
||||
* Description:
|
||||
* Allocate a struct files instance and associate it with an vnode instance.
|
||||
* Returns the file descriptor == index into the files array.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int files_allocate(struct Vnode *vnode, int oflags, off_t pos,void *priv, int minfd);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: files_close
|
||||
*
|
||||
* Description:
|
||||
* Close an vnode (if open)
|
||||
*
|
||||
* Assumuptions:
|
||||
* Caller holds the list semaphore because the file descriptor will be freed.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int files_close(int fd);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: files_release
|
||||
*
|
||||
* Assumuptions:
|
||||
* Similar to files_close(). Called only from open() logic on error
|
||||
* conditions.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void files_release(int fd);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: files_initialize
|
||||
*
|
||||
* Description:
|
||||
* This is called from the FS initialization logic to configure the files.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void WEAK files_initialize(void);
|
||||
|
||||
int vfs_normalize_path(const char *directory, const char *filename, char **pathname);
|
||||
int vfs_normalize_pathat(int fd, const char *filename, char **pathname);
|
||||
|
||||
struct filelist *sched_getfiles(void);
|
||||
|
||||
/* fs/fs_sendfile.c *************************************************/
|
||||
/****************************************************************************
|
||||
* Name: sendfile
|
||||
*
|
||||
* Description:
|
||||
* Copy data between one file descriptor and another.
|
||||
*
|
||||
****************************************************************************/
|
||||
ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count);
|
||||
|
||||
/**
|
||||
* @ingroup fs
|
||||
* @brief get the path by a given file fd.
|
||||
*
|
||||
* @par Description:
|
||||
* The function is used for getting the path by a given file fd.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>Only support file fd, not any dir fd.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param fd [IN] Type #int file fd.
|
||||
* @param path [IN] Type #char ** address of the location to return the path reference.
|
||||
*
|
||||
* @retval #0 get path success
|
||||
* @retval #~0 get path failed
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>fs.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
*
|
||||
* @since 2020-1-8
|
||||
*/
|
||||
|
||||
int get_path_from_fd(int fd, char **path);
|
||||
|
||||
bool get_bit(int i);
|
||||
|
||||
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);
|
||||
|
||||
void lsfd(void);
|
||||
|
||||
void set_sd_sync_fn(int (*sync_fn)(int));
|
||||
|
||||
struct Vnode *files_get_openfile(int fd);
|
||||
|
||||
void poll_wait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p);
|
||||
|
||||
int follow_symlink(int dirfd, const char *path, struct Vnode **vnode, char **fullpath);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __INCLUDE_FS_FILE_H */
|
|
@ -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
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* 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_ */
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../../../../../third_party/NuttX/fs/inode/inode.h
|
|
@ -1 +0,0 @@
|
|||
../../../../../third_party/NuttX/include/nuttx/net/net.h
|
|
@ -1 +0,0 @@
|
|||
../../../../third_party/NuttX/include/syslog.h
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
* 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
|
|
@ -1,61 +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.
|
||||
*/
|
||||
|
||||
#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
|
|
@ -1,70 +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.
|
||||
*/
|
||||
|
||||
#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);
|
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
* 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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,59 +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/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);
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue