1/* 2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without modification, 6 * are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, this list of 9 * conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 * of conditions and the following disclaimer in the documentation and/or other materials 13 * provided with the distribution. 14 * 15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 16 * to endorse or promote products derived from this software without specific prior written 17 * permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 33#ifndef _VFS_CONFIG_H_ 34#define _VFS_CONFIG_H_ 35 36#include "los_config.h" 37 38#ifdef __cplusplus 39#if __cplusplus 40extern "C" { 41#endif /* __cplusplus */ 42#endif /* __cplusplus */ 43 44#define PATH_MAX 256 45#define CONFIG_DISABLE_MQUEUE // disable posix mqueue inode configure 46 47/* file system config */ 48 49#define CONFIG_FS_WRITABLE // enable file system can be written 50#define CONFIG_FS_READABLE // enable file system can be read 51#define CONFIG_DEBUG_FS // enable vfs debug function 52 53 54/* fatfs cache config */ 55/* config block size for fat file system, only can be 0,32,64,128,256,512,1024 */ 56#define CONFIG_FS_FAT_SECTOR_PER_BLOCK 64 57 58/* config block num for fat file system */ 59#define CONFIG_FS_FAT_READ_NUMS 7 60#define CONFIG_FS_FAT_BLOCK_NUMS 28 61 62#ifdef LOSCFG_FS_FAT_CACHE_SYNC_THREAD 63 64/* config the priority of sync task */ 65 66#define CONFIG_FS_FAT_SYNC_THREAD_PRIO 10 67 68/* config dirty ratio of bcache for fat file system */ 69 70#define CONFIG_FS_FAT_DIRTY_RATIO 60 71 72/* config time interval of sync thread for fat file system, in milliseconds */ 73 74#define CONFIG_FS_FAT_SYNC_INTERVAL 5000 75#endif 76 77#define CONFIG_FS_FLASH_BLOCK_NUM 1 78 79#define CONFIG_FS_MAX_LNK_CNT 40 80 81/* nfs configure */ 82 83#define CONFIG_NFS_MACHINE_NAME "IPC" // nfs device name is IPC 84#define CONFIG_NFS_MACHINE_NAME_SIZE 3 // size of nfs machine name 85 86 87/* file descriptors configure */ 88 89#define CONFIG_NFILE_STREAMS 1 // enable file stream 90#define CONFIG_STDIO_BUFFER_SIZE 0 91#define CONFIG_NUNGET_CHARS 0 92#define MIN_START_FD 3 // 0,1,2 are used for stdin,stdout,stderr respectively 93 94#define FD_SET_TOTAL_SIZE (FD_SETSIZE + CONFIG_NEXPANED_DESCRIPTORS) 95#define FD_SETSIZE (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS) 96#define CONFIG_NEXPANED_DESCRIPTORS (CONFIG_NTIME_DESCRIPTORS + CONFIG_NQUEUE_DESCRIPTORS) 97#define TIMER_FD_OFFSET FD_SETSIZE 98#define MQUEUE_FD_OFFSET (FD_SETSIZE + CONFIG_NTIME_DESCRIPTORS) 99#define EPOLL_FD_OFFSET (FD_SETSIZE + CONFIG_NTIME_DESCRIPTORS + CONFIG_NQUEUE_DESCRIPTORS) 100 101/* net configure */ 102 103#ifdef LOSCFG_NET_LWIP_SACK // enable socket and net function 104#include "lwip/lwipopts.h" 105#define CONFIG_NSOCKET_DESCRIPTORS LWIP_CONFIG_NUM_SOCKETS // max numbers of socket descriptor 106 107/* max numbers of other descriptors except socket descriptors */ 108 109#define CONFIG_NFILE_DESCRIPTORS 512 110#define CONFIG_NET_SENDFILE 1 // enable sendfile function 111#define CONFIG_NET_TCP 1 // enable sendfile and send function 112#else 113#define CONFIG_NSOCKET_DESCRIPTORS 0 114#define CONFIG_NFILE_DESCRIPTORS 512 115#define CONFIG_NET_SENDFILE 0 // disable sendfile function 116#define CONFIG_NET_TCP 0 // disable sendfile and send function 117#endif 118 119#define NR_OPEN_DEFAULT CONFIG_NFILE_DESCRIPTORS 120 121/* time configure */ 122 123#define CONFIG_NTIME_DESCRIPTORS 0 124 125/* mqueue configure */ 126 127#define CONFIG_NQUEUE_DESCRIPTORS 256 128 129/* directory configure */ 130 131#define VFS_USING_WORKDIR // enable current working directory 132 133#define CONFIG_EPOLL_DESCRIPTORS 32 134 135/* permission configure */ 136#define DEFAULT_DIR_MODE 0777 137#define DEFAULT_FILE_MODE 0666 138 139#define MAX_DIRENT_NUM 14 // 14 means 4096 length buffer can store 14 dirent, see struct DIR 140 141#ifdef __cplusplus 142#if __cplusplus 143} 144#endif /* __cplusplus */ 145#endif /* __cplusplus */ 146#endif 147