Lines Matching refs:node

36 	struct block_cache_node *node;  in cache_find()  local
38 list_for_each_entry(node, &block_cache, lh) in cache_find()
39 if ((node->iftype == iftype) && in cache_find()
40 (node->devnum == devnum) && in cache_find()
41 (node->blksz == blksz) && in cache_find()
42 (node->start <= start) && in cache_find()
43 (node->start + node->blkcnt >= start + blkcnt)) { in cache_find()
44 if (block_cache.next != &node->lh) { in cache_find()
46 list_del(&node->lh); in cache_find()
47 list_add(&node->lh, &block_cache); in cache_find()
49 return node; in cache_find()
58 struct block_cache_node *node = cache_find(iftype, devnum, start, in blkcache_read() local
60 if (node) { in blkcache_read()
61 const char *src = node->cache + (start - node->start) * blksz; in blkcache_read()
80 struct block_cache_node *node; in blkcache_fill() local
92 node = (struct block_cache_node *)block_cache.prev; in blkcache_fill()
93 list_del(&node->lh); in blkcache_fill()
96 node->start, node->blkcnt); in blkcache_fill()
97 if (node->blkcnt * node->blksz < bytes) { in blkcache_fill()
98 free(node->cache); in blkcache_fill()
99 node->cache = 0; in blkcache_fill()
102 node = malloc(sizeof(*node)); in blkcache_fill()
103 if (!node) in blkcache_fill()
105 node->cache = 0; in blkcache_fill()
108 if (!node->cache) { in blkcache_fill()
109 node->cache = malloc(bytes); in blkcache_fill()
110 if (!node->cache) { in blkcache_fill()
111 free(node); in blkcache_fill()
119 node->iftype = iftype; in blkcache_fill()
120 node->devnum = devnum; in blkcache_fill()
121 node->start = start; in blkcache_fill()
122 node->blkcnt = blkcnt; in blkcache_fill()
123 node->blksz = blksz; in blkcache_fill()
124 memcpy(node->cache, buffer, bytes); in blkcache_fill()
125 list_add(&node->lh, &block_cache); in blkcache_fill()
132 struct block_cache_node *node; in blkcache_invalidate() local
135 node = (struct block_cache_node *)entry; in blkcache_invalidate()
136 if ((node->iftype == iftype) && in blkcache_invalidate()
137 (node->devnum == devnum)) { in blkcache_invalidate()
139 free(node->cache); in blkcache_invalidate()
140 free(node); in blkcache_invalidate()
148 struct block_cache_node *node; in blkcache_configure() local
153 node = (struct block_cache_node *)block_cache.next; in blkcache_configure()
154 list_del(&node->lh); in blkcache_configure()
155 free(node->cache); in blkcache_configure()
156 free(node); in blkcache_configure()