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 40 extern "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 configur */ 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 configur */ 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 100 /* net configure */ 101 102 #ifdef LOSCFG_NET_LWIP_SACK // enable socket and net function 103 #include "lwip/lwipopts.h" 104 #define CONFIG_NSOCKET_DESCRIPTORS LWIP_CONFIG_NUM_SOCKETS // max numbers of socket descriptor 105 106 /* max numbers of other descriptors except socket descriptors */ 107 108 #define CONFIG_NFILE_DESCRIPTORS 512 109 #define CONFIG_NET_SENDFILE 1 // enable sendfile function 110 #define CONFIG_NET_TCP 1 // enable sendfile and send function 111 #else 112 #define CONFIG_NSOCKET_DESCRIPTORS 0 113 #define CONFIG_NFILE_DESCRIPTORS 512 114 #define CONFIG_NET_SENDFILE 0 // disable sendfile function 115 #define CONFIG_NET_TCP 0 // disable sendfile and send function 116 #endif 117 118 #define NR_OPEN_DEFAULT CONFIG_NFILE_DESCRIPTORS 119 120 /* time configure */ 121 122 #define CONFIG_NTIME_DESCRIPTORS 0 123 124 /* mqueue configure */ 125 126 #define CONFIG_NQUEUE_DESCRIPTORS 256 127 128 /* directory configure */ 129 130 #define VFS_USING_WORKDIR // enable current working directory 131 132 /* permission configure */ 133 #define DEFAULT_DIR_MODE 0777 134 #define DEFAULT_FILE_MODE 0666 135 136 #define MAX_DIRENT_NUM 14 // 14 means 4096 length buffer can store 14 dirent, see struct DIR 137 138 #ifdef __cplusplus 139 #if __cplusplus 140 } 141 #endif /* __cplusplus */ 142 #endif /* __cplusplus */ 143 #endif 144