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 #ifndef _VFS_CONFIG_H_ 33 #define _VFS_CONFIG_H_ 34 35 #define PATH_MAX 256 36 #define CONFIG_DISABLE_MQUEUE // disable posix mqueue inode configure 37 38 /* file system configur */ 39 40 #define CONFIG_FS_WRITABLE // enable file system can be written 41 #define CONFIG_FS_READABLE // enable file system can be read 42 #define CONFIG_DEBUG_FS // enable vfs debug function 43 44 45 /* fatfs cache configur */ 46 /* config block size for fat file system, only can be 0,32,64,128,256,512,1024 */ 47 #define CONFIG_FS_FAT_SECTOR_PER_BLOCK 64 48 49 /* config block num for fat file system */ 50 #define CONFIG_FS_FAT_READ_NUMS 7 51 #define CONFIG_FS_FAT_BLOCK_NUMS 28 52 53 #ifdef LOSCFG_FS_FAT_CACHE_SYNC_THREAD 54 55 /* config the priority of sync task */ 56 57 #define CONFIG_FS_FAT_SYNC_THREAD_PRIO 10 58 59 /* config dirty ratio of bcache for fat file system */ 60 61 #define CONFIG_FS_FAT_DIRTY_RATIO 60 62 63 /* config time interval of sync thread for fat file system, in milliseconds */ 64 65 #define CONFIG_FS_FAT_SYNC_INTERVAL 5000 66 #endif 67 68 #define CONFIG_FS_FLASH_BLOCK_NUM 1 69 70 #define CONFIG_FS_MAX_LNK_CNT 40 71 72 /* nfs configure */ 73 74 #define CONFIG_NFS_MACHINE_NAME "IPC" // nfs device name is IPC 75 #define CONFIG_NFS_MACHINE_NAME_SIZE 3 // size of nfs machine name 76 77 78 /* file descriptors configure */ 79 80 #define CONFIG_NFILE_STREAMS 1 // enable file stream 81 #define CONFIG_STDIO_BUFFER_SIZE 0 82 #define CONFIG_NUNGET_CHARS 0 83 #define MIN_START_FD 3 // 0,1,2 are used for stdin,stdout,stderr respectively 84 85 /* net configure */ 86 87 #ifdef LOSCFG_NET_LWIP_SACK // enable socket and net function 88 #include "lwip/lwipopts.h" 89 #define CONFIG_NSOCKET_DESCRIPTORS LWIP_CONFIG_NUM_SOCKETS // max numbers of socket descriptor 90 #define CONFIG_NET_SENDFILE 1 // enable sendfile function 91 #define CONFIG_NET_TCP 1 // enable sendfile and send function 92 #else 93 #define CONFIG_NSOCKET_DESCRIPTORS 0 94 #define CONFIG_NET_SENDFILE 0 // disable sendfile function 95 #define CONFIG_NET_TCP 0 // disable sendfile and send function 96 #endif 97 98 /* max numbers of other descriptors except socket descriptors */ 99 100 #ifdef LOSCFG_FS_FAT 101 #include "fatfs_conf.h" 102 #define __FAT_NFILE FAT_MAX_OPEN_FILES 103 #else 104 #define __FAT_NFILE 0 105 #endif 106 107 #ifdef LOSCFG_FS_LITTLEFS 108 #include "lfs_conf.h" 109 #define __LFS_NFILE LOSCFG_LFS_MAX_OPEN_FILES 110 #else 111 #define __LFS_NFILE 0 112 #endif 113 114 #define CONFIG_NFILE_DESCRIPTORS (__FAT_NFILE + __LFS_NFILE) 115 116 #define NR_OPEN_DEFAULT CONFIG_NFILE_DESCRIPTORS 117 118 /* time configure */ 119 120 #define CONFIG_NTIME_DESCRIPTORS 0 121 122 /* mqueue configure */ 123 124 #define CONFIG_NQUEUE_DESCRIPTORS 256 125 126 #define TIMER_FD_OFFSET (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS) 127 #define CONFIG_NEXPANED_DESCRIPTORS (CONFIG_NTIME_DESCRIPTORS + CONFIG_NQUEUE_DESCRIPTORS) 128 #define FD_SET_TOTAL_SIZE (TIMER_FD_OFFSET + CONFIG_NEXPANED_DESCRIPTORS) 129 #define MQUEUE_FD_OFFSET (TIMER_FD_OFFSET + CONFIG_NTIME_DESCRIPTORS) 130 131 /* directory configure */ 132 133 #define VFS_USING_WORKDIR // enable current working directory 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 /* max number of open directories */ 142 #ifndef LOSCFG_MAX_OPEN_DIRS 143 #define LOSCFG_MAX_OPEN_DIRS 10 144 #endif 145 146 #endif 147