更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
jffs2_hash.c 文件参考

浏览源代码.

函数

int Jffs2HashInit (LosMux *lock, LOS_DL_LIST *heads)
 
int Jffs2HashDeinit (LosMux *lock)
 
void Jffs2HashDump (LosMux *lock, LOS_DL_LIST *heads)
 
static LOS_DL_LISTJffs2HashBucket (LOS_DL_LIST *heads, const uint32_t ino)
 
int Jffs2HashGet (LosMux *lock, LOS_DL_LIST *heads, const void *sb, const uint32_t ino, struct jffs2_inode **ppNode)
 
void Jffs2HashRemove (LosMux *lock, struct jffs2_inode *node)
 
int Jffs2HashInsert (LosMux *lock, LOS_DL_LIST *heads, struct jffs2_inode *node, const uint32_t ino)
 

函数说明

◆ Jffs2HashBucket()

static LOS_DL_LIST * Jffs2HashBucket ( LOS_DL_LIST heads,
const uint32_t  ino 
)
static

在文件 jffs2_hash.c79 行定义.

80{
81 LOS_DL_LIST *head = &(heads[ino & JFFS2_NODE_HASH_MASK]);
82 return head;
83}
这是这个函数的调用关系图:

◆ Jffs2HashDeinit()

int Jffs2HashDeinit ( LosMux lock)

在文件 jffs2_hash.c51 行定义.

52{
53 int ret;
54 ret = LOS_MuxDestroy(lock);
55 if (ret != LOS_OK) {
56 PRINT_ERR("Destroy mutex for vnode hash list fail, status: %d", ret);
57 return ret;
58 }
59
60 return LOS_OK;
61}
LITE_OS_SEC_TEXT UINT32 LOS_MuxDestroy(LosMux *mutex)
销毁互斥锁
Definition: los_mux.c:289
函数调用图:

◆ Jffs2HashDump()

void Jffs2HashDump ( LosMux lock,
LOS_DL_LIST heads 
)

在文件 jffs2_hash.c63 行定义.

64{
65 PRINTK("-------->Jffs2HashDump in\n");
66 (void)LOS_MuxLock(lock, LOS_WAIT_FOREVER);
67 for (int i = 0; i < JFFS2_NODE_HASH_BUCKETS; i++) {
68 LIST_HEAD *nhead = &heads[i];
69 struct jffs2_inode *node = NULL;
70
71 LOS_DL_LIST_FOR_EACH_ENTRY(node, nhead, struct jffs2_inode, i_hashlist) {
72 PRINTK(" vnode dump: col %d item %p\n", i, node);
73 }
74 }
75 (void)LOS_MuxUnlock(lock);
76 PRINTK("-------->Jffs2HashDump out\n");
77}
LITE_OS_SEC_TEXT UINT32 LOS_MuxUnlock(LosMux *mutex)
释放锁
Definition: los_mux.c:559
LITE_OS_SEC_TEXT UINT32 LOS_MuxLock(LosMux *mutex, UINT32 timeout)
拿互斥锁,
Definition: los_mux.c:437
ARG_NUM_3 ARG_NUM_1 ARG_NUM_2 ARG_NUM_2 ARG_NUM_3 ARG_NUM_1 ARG_NUM_4 ARG_NUM_2 ARG_NUM_2 ARG_NUM_5 ARG_NUM_2 void
函数调用图:

◆ Jffs2HashGet()

int Jffs2HashGet ( LosMux lock,
LOS_DL_LIST heads,
const void sb,
const uint32_t  ino,
struct jffs2_inode **  ppNode 
)

在文件 jffs2_hash.c85 行定义.

86{
87 struct jffs2_inode *node = NULL;
88
89 while (1) {
90 (void)LOS_MuxLock(lock, LOS_WAIT_FOREVER);
91 LOS_DL_LIST *list = Jffs2HashBucket(heads, ino);
92 LOS_DL_LIST_FOR_EACH_ENTRY(node, list, struct jffs2_inode, i_hashlist) {
93 if (node->i_ino != ino)
94 continue;
95 if (node->i_sb != sb)
96 continue;
97 (void)LOS_MuxUnlock(lock);
98 *ppNode = node;
99 return 0;
100 }
101 (void)LOS_MuxUnlock(lock);
102 *ppNode = NULL;
103 return 0;
104 }
105}
static LOS_DL_LIST * Jffs2HashBucket(LOS_DL_LIST *heads, const uint32_t ino)
Definition: jffs2_hash.c:79
函数调用图:

◆ Jffs2HashInit()

int Jffs2HashInit ( LosMux lock,
LOS_DL_LIST heads 
)

在文件 jffs2_hash.c35 行定义.

36{
37 int ret;
38 for (int i = 0; i < JFFS2_NODE_HASH_BUCKETS; i++) {
39 LOS_ListInit(&heads[i]);
40 }
41
42 ret = LOS_MuxInit(lock, NULL);
43 if (ret != LOS_OK) {
44 PRINT_ERR("Create mutex for vnode hash list fail, status: %d", ret);
45 return ret;
46 }
47
48 return LOS_OK;
49}
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit(LOS_DL_LIST *list)
Definition: los_list.h:104
LITE_OS_SEC_TEXT UINT32 LOS_MuxInit(LosMux *mutex, const LosMuxAttr *attr)
初始化互斥锁
Definition: los_mux.c:262
函数调用图:

◆ Jffs2HashInsert()

int Jffs2HashInsert ( LosMux lock,
LOS_DL_LIST heads,
struct jffs2_inode *  node,
const uint32_t  ino 
)

在文件 jffs2_hash.c114 行定义.

115{
116 (void)LOS_MuxLock(lock, LOS_WAIT_FOREVER);
117 LOS_ListHeadInsert(Jffs2HashBucket(heads, ino), &node->i_hashlist);
118 (void)LOS_MuxUnlock(lock);
119 return 0;
120}
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListHeadInsert(LOS_DL_LIST *list, LOS_DL_LIST *node)
Insert a node to the head of a doubly linked list.
Definition: los_list.h:268
函数调用图:

◆ Jffs2HashRemove()

void Jffs2HashRemove ( LosMux lock,
struct jffs2_inode *  node 
)

在文件 jffs2_hash.c107 行定义.

108{
109 (void)LOS_MuxLock(lock, LOS_WAIT_FOREVER);
110 LOS_ListDelete(&node->i_hashlist);
111 (void)LOS_MuxUnlock(lock);
112}
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelete(LOS_DL_LIST *node)
Definition: los_list.h:292
函数调用图: