Lines Matching full:node
35 struct block_cache_node *node; in cache_find() local
37 list_for_each_entry(node, &block_cache, lh) in cache_find()
38 if ((node->iftype == iftype) && in cache_find()
39 (node->devnum == devnum) && in cache_find()
40 (node->blksz == blksz) && in cache_find()
41 (node->start <= start) && in cache_find()
42 (node->start + node->blkcnt >= start + blkcnt)) { in cache_find()
43 if (block_cache.next != &node->lh) { in cache_find()
45 list_del(&node->lh); in cache_find()
46 list_add(&node->lh, &block_cache); in cache_find()
48 return node; in cache_find()
57 struct block_cache_node *node = cache_find(iftype, devnum, start, in blkcache_read() local
59 if (node) { in blkcache_read()
60 const char *src = node->cache + (start - node->start) * blksz; in blkcache_read()
79 struct block_cache_node *node; in blkcache_fill() local
91 node = (struct block_cache_node *)block_cache.prev; in blkcache_fill()
92 list_del(&node->lh); in blkcache_fill()
95 node->start, node->blkcnt); in blkcache_fill()
96 if (node->blkcnt * node->blksz < bytes) { in blkcache_fill()
97 free(node->cache); in blkcache_fill()
98 node->cache = 0; in blkcache_fill()
101 node = malloc(sizeof(*node)); in blkcache_fill()
102 if (!node) in blkcache_fill()
104 node->cache = 0; in blkcache_fill()
107 if (!node->cache) { in blkcache_fill()
108 node->cache = malloc(bytes); in blkcache_fill()
109 if (!node->cache) { in blkcache_fill()
110 free(node); in blkcache_fill()
118 node->iftype = iftype; in blkcache_fill()
119 node->devnum = devnum; in blkcache_fill()
120 node->start = start; in blkcache_fill()
121 node->blkcnt = blkcnt; in blkcache_fill()
122 node->blksz = blksz; in blkcache_fill()
123 memcpy(node->cache, buffer, bytes); in blkcache_fill()
124 list_add(&node->lh, &block_cache); in blkcache_fill()
131 struct block_cache_node *node; in blkcache_invalidate() local
134 node = (struct block_cache_node *)entry; in blkcache_invalidate()
135 if ((node->iftype == iftype) && in blkcache_invalidate()
136 (node->devnum == devnum)) { in blkcache_invalidate()
138 free(node->cache); in blkcache_invalidate()
139 free(node); in blkcache_invalidate()
147 struct block_cache_node *node; in blkcache_configure() local
152 node = (struct block_cache_node *)block_cache.next; in blkcache_configure()
153 list_del(&node->lh); in blkcache_configure()
154 free(node->cache); in blkcache_configure()
155 free(node); in blkcache_configure()