鸿蒙研究站
|
官方文档
|
源码分析
== 鸿蒙内核参考手册 ==
内核注释
|
论坛
|
赞助作者
更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
函数
|
变量
mount.c 文件参考
浏览源代码.
函数
struct
Mount
*
MountAlloc
(struct
Vnode
*vnodeBeCovered, struct
MountOps
*fsop)
LIST_HEAD
*
GetMountList
()
获取装载链表,并初始化
更多...
变量
static
LIST_HEAD
*
g_mountList
= NULL
函数说明
◆
GetMountList()
LIST_HEAD
* GetMountList
(
void
)
获取装载链表,并初始化
在文件
mount.c
第
71
行定义.
72
{
73
if
(
g_mountList
== NULL) {
74
g_mountList
=
zalloc
(
sizeof
(
LIST_HEAD
));
//分配内存, 小内存分配用 zalloc
75
if
(
g_mountList
== NULL) {
76
PRINT_ERR(
"init mount list failed, no memory."
);
77
return
NULL;
78
}
79
LOS_ListInit
(
g_mountList
);
//初始化全局链表
80
}
81
return
g_mountList
;
//所有文件系统的挂载信息
82
}
LOS_ListInit
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit(LOS_DL_LIST *list)
Definition:
los_list.h:104
zalloc
void * zalloc(size_t size)
Definition:
malloc.c:91
g_mountList
static LIST_HEAD * g_mountList
Definition:
mount.c:40
LOS_DL_LIST
Definition:
los_list.h:82
函数调用图:
这是这个函数的调用关系图:
◆
MountAlloc()
struct
Mount
* MountAlloc
(
struct
Vnode
*
vnodeBeCovered
,
struct
MountOps
*
fsop
)
在文件
mount.c
第
48
行定义.
49
{
50
struct
Mount
* mnt = (
struct
Mount
*)
zalloc
(
sizeof
(
struct
Mount
));
//申请一个mount结构体内存,小内存分配用 zalloc
51
if
(mnt == NULL) {
52
PRINT_ERR(
"MountAlloc failed no memory!\n"
);
53
return
NULL;
54
}
55
56
LOS_ListInit
(&mnt->
activeVnodeList
);
//初始化激活索引节点链表
57
LOS_ListInit
(&mnt->
vnodeList
);
//初始化索引节点链表
58
59
mnt->
vnodeBeCovered
=
vnodeBeCovered
;
//设备将装载到vnodeBeCovered节点上
60
vnodeBeCovered
->
newMount
= mnt;
//该节点不再是虚拟节点,而作为 设备结点
61
#ifdef LOSCFG_DRIVERS_RANDOM
//随机值 驱动模块
62
HiRandomHwInit();
//随机值初始化
63
(VOID)HiRandomHwGetInteger(&mnt->
hashseed
);
//用于生成哈希种子
64
HiRandomHwDeinit();
//随机值反初始化
65
#else
66
mnt->
hashseed
= (uint32_t)random();
//随机生成哈子种子
67
#endif
68
return
mnt;
69
}
Mount
举例: mount /dev/mmcblk0p0 /bin1/vs/sd vfat 将/dev/mmcblk0p0 挂载到/bin1/vs/sd目录
Definition:
mount.h:68
Mount::vnodeList
LIST_HEAD vnodeList
Definition:
mount.h:74
Mount::activeVnodeList
LIST_HEAD activeVnodeList
Definition:
mount.h:76
Mount::vnodeBeCovered
struct Vnode * vnodeBeCovered
Definition:
mount.h:71
Mount::hashseed
uint32_t hashseed
Definition:
mount.h:79
Vnode::newMount
struct Mount * newMount
Definition:
vnode.h:181
函数调用图:
这是这个函数的调用关系图:
变量说明
◆
g_mountList
LIST_HEAD
* g_mountList = NULL
static
在文件
mount.c
第
40
行定义.
fs
vfs
mount.c
公众号:鸿蒙研究站(weharmonyos)
|
论坛: bbs.weharmonyos.com
| 制作者
鸿蒙研究站 | weharmonyos.com