鸿蒙研究站
|
官方文档
|
源码分析
== 鸿蒙内核参考手册 ==
内核注释
|
论坛
|
赞助作者
更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
vfs_config.h
浏览该文件的文档.
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
//禁用 posix mqueue inode 配置
44
#define PATH_MAX 256
45
#define CONFIG_DISABLE_MQUEUE
// disable posix mqueue inode configure
46
47
/* file system configure */
//文件系统配置
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 configure */
//fatfs缓存配置
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
//块(Block)是文件系统存取数据的最小单位
57
//64个512扇区,即 32K
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
//配置 FAT 文件系统同步线程的时间间隔,单位为毫秒
74
#define CONFIG_FS_FAT_SYNC_INTERVAL 5000
//5秒钟
75
#endif
76
77
#define CONFIG_FS_FLASH_BLOCK_NUM 1
78
79
#define CONFIG_FS_MAX_LNK_CNT 40
80
/* nfs configure */
81
82
#define CONFIG_NFS_MACHINE_NAME "IPC"
// nfs device name is IPC
83
#define CONFIG_NFS_MACHINE_NAME_SIZE 3
// size of nfs machine name
84
85
86
/* file descriptors configure */
87
88
#define CONFIG_NFILE_STREAMS 1
// enable file stream
89
#define CONFIG_STDIO_BUFFER_SIZE 0
90
#define CONFIG_NUNGET_CHARS 0
91
#define MIN_START_FD 3
// 0,1,2 are used for stdin,stdout,stderr respectively
92
93
#define FD_SET_TOTAL_SIZE (FD_SETSIZE + CONFIG_NEXPANED_DESCRIPTORS)
94
#define FD_SETSIZE (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS)
95
#define CONFIG_NEXPANED_DESCRIPTORS (CONFIG_NTIME_DESCRIPTORS + CONFIG_NQUEUE_DESCRIPTORS)
96
#define TIMER_FD_OFFSET FD_SETSIZE
97
#define MQUEUE_FD_OFFSET (FD_SETSIZE + CONFIG_NTIME_DESCRIPTORS)
98
#define EPOLL_FD_OFFSET (FD_SETSIZE + CONFIG_NTIME_DESCRIPTORS + CONFIG_NQUEUE_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
// 关闭网络开关,当然NFS的数量为0,鸿蒙和LINUX一样,一切皆为文件,而是文件就需要文件描述符(FD)
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 //禁用sendfile和send函数功能
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
#define CONFIG_EPOLL_DESCRIPTORS 32
133
134
/* permission configure */
135
#define DEFAULT_DIR_MODE 0777
136
#define DEFAULT_FILE_MODE 0666
137
138
#define MAX_DIRENT_NUM 14
// 14 means 4096 length buffer can store 14 dirent, see struct DIR
139
140
#ifdef __cplusplus
141
#if __cplusplus
142
}
143
#endif
/* __cplusplus */
144
#endif
/* __cplusplus */
145
#endif
los_config.h
lwipopts.h
fs
include
vfs_config.h
公众号:鸿蒙研究站(weharmonyos)
|
论坛: bbs.weharmonyos.com
| 制作者
鸿蒙研究站 | weharmonyos.com