Home
last modified time | relevance | path

Searched refs:fifo (Results 1 – 6 of 6) sorted by relevance

/DragonOS-0.1.3/kernel/src/libs/
Dkfifo.c15 int kfifo_alloc(struct kfifo_t *fifo, uint32_t size, uint64_t reserved) in kfifo_alloc() argument
17 memset(fifo, 0, sizeof(struct kfifo_t)); in kfifo_alloc()
18 fifo->buffer = kmalloc(size, 0); in kfifo_alloc()
19 if (fifo->buffer == NULL) in kfifo_alloc()
22 fifo->total_size = size; in kfifo_alloc()
35 void kfifo_init(struct kfifo_t *fifo, void *buffer, uint32_t size) in kfifo_init() argument
37 memset(fifo, 0, sizeof(struct kfifo_t)); in kfifo_init()
39 fifo->buffer = buffer; in kfifo_init()
40 fifo->total_size = size; in kfifo_init()
51 uint32_t kfifo_in(struct kfifo_t *fifo, const void *from, uint32_t size) in kfifo_in() argument
[all …]
Dbitree.c208 struct kfifo_t fifo; in bt_destroy_tree() local
209 kfifo_alloc(&fifo, ((root->size + 1) / 2) * sizeof(struct bt_node_t *), 0); in bt_destroy_tree()
210 kfifo_in(&fifo, (void *)&(root->bt_node), sizeof(struct bt_node_t *)); in bt_destroy_tree()
213 while (!kfifo_empty(&fifo)) in bt_destroy_tree()
217 int count = kfifo_out(&fifo, &nd, sizeof(uint64_t)); in bt_destroy_tree()
221 kfifo_in(&fifo, (void *)&(nd->left), sizeof(struct bt_node_t *)); in bt_destroy_tree()
224 kfifo_in(&fifo, (void *)&(nd->right), sizeof(struct bt_node_t *)); in bt_destroy_tree()
231 kfifo_free_alloc(&fifo); in bt_destroy_tree()
/DragonOS-0.1.3/kernel/src/ktest/
Dtest-kfifo.c11 struct kfifo_t fifo; in ktest_kfifo_case0_1() local
13 assert(kfifo_alloc(&fifo, fifo_size, 0) == 0); in ktest_kfifo_case0_1()
17 kfifo_init(&fifo, buf, fifo_size); in ktest_kfifo_case0_1()
20 assert(fifo.buffer != NULL); in ktest_kfifo_case0_1()
21 assert(fifo.total_size == fifo_size); in ktest_kfifo_case0_1()
22 assert(kfifo_total_size(&fifo) == fifo_size); in ktest_kfifo_case0_1()
23 assert(fifo.size == 0); in ktest_kfifo_case0_1()
24 assert(kfifo_size(&fifo) == 0); in ktest_kfifo_case0_1()
25 assert(fifo.in_offset == 0); in ktest_kfifo_case0_1()
26 assert(fifo.out_offset == 0); in ktest_kfifo_case0_1()
[all …]
/DragonOS-0.1.3/kernel/src/common/
Dkfifo.h19 #define kfifo_reset(fifo) (void)({ \ argument
20 (fifo)->size = 0; \
21 (fifo)->in_offset = 0; \
22 (fifo)->out_offset = 0; \
29 #define kfifo_reset_out(fifo) (void)({ \ argument
30 (fifo)->size = 0; \
31 (fifo)->out_offset = (fifo)->in_offset; \
40 #define kfifo_total_size(fifo) ((fifo)->total_size) argument
47 #define kfifo_size(fifo) ((fifo)->size) argument
55 #define kfifo_empty(fifo) (((fifo)->size == 0) ? 1 : 0) argument
[all …]
/DragonOS-0.1.3/kernel/src/filesystem/vfs/
Ddcache.c17 struct kfifo_t fifo = {0}; in vfs_dentry_put() local
34 retval = kfifo_alloc(&fifo, 1024 * sizeof(uint64_t), 0); in vfs_dentry_put()
41 kfifo_in(&fifo, &in_value, sizeof(uint64_t)); in vfs_dentry_put()
44 while (!kfifo_empty(&fifo)) in vfs_dentry_put()
47 kfifo_out(&fifo, &dentry, sizeof(uint64_t)); in vfs_dentry_put()
58 kfifo_in(&fifo, &in_value, sizeof(uint64_t)); in vfs_dentry_put()
86 kfifo_free_alloc(&fifo); in vfs_dentry_put()
107 if (fifo.buffer != NULL) in vfs_dentry_put()
108 kfifo_free_alloc(&fifo); in vfs_dentry_put()
/DragonOS-0.1.3/docs/kernel/core_api/
Ddata_structures.md8   kfifo先进先出缓冲区定义于`common/kfifo.h`中。您可以使用它,创建指定大小的fifo缓冲区(最大大小为4GB)
12 `int kfifo_alloc(struct kfifo_t *fifo, uint32_t size, uint64_t reserved)`
16   通过动态方式初始化kfifo缓冲队列。fifo缓冲区的buffer将由该函数进行申请。
20 **fifo**
38 `void kfifo_init(struct kfifo_t *fifo, void *buffer, uint32_t size)`
46 **fifo**
60 `void kfifo_free_alloc(struct kfifo_t* fifo)`
64   释放通过kfifo_alloc创建的fifo缓冲区. 请勿通过该函数释放其他方式创建的kfifo缓冲区。
68 **fifo**
74 `uint32_t kfifo_in(struct kfifo_t *fifo, const void *from, uint32_t size)`
[all …]