Lines Matching refs:iter
117 blkid_dev_iterate iter; in blkid_dev_iterate_begin() local
119 iter = malloc(sizeof(struct blkid_struct_dev_iterate)); in blkid_dev_iterate_begin()
120 if (iter) { in blkid_dev_iterate_begin()
121 iter->magic = DEV_ITERATE_MAGIC; in blkid_dev_iterate_begin()
122 iter->cache = cache; in blkid_dev_iterate_begin()
123 iter->p = cache->bic_devs.next; in blkid_dev_iterate_begin()
124 iter->search_type = 0; in blkid_dev_iterate_begin()
125 iter->search_value = 0; in blkid_dev_iterate_begin()
127 return (iter); in blkid_dev_iterate_begin()
130 extern int blkid_dev_set_search(blkid_dev_iterate iter, in blkid_dev_set_search() argument
135 if (!iter || iter->magic != DEV_ITERATE_MAGIC || !search_type || in blkid_dev_set_search()
147 free(iter->search_type); in blkid_dev_set_search()
148 free(iter->search_value); in blkid_dev_set_search()
149 iter->search_type = new_type; in blkid_dev_set_search()
150 iter->search_value = new_value; in blkid_dev_set_search()
157 extern int blkid_dev_next(blkid_dev_iterate iter, in blkid_dev_next() argument
163 if (!iter || iter->magic != DEV_ITERATE_MAGIC) in blkid_dev_next()
165 while (iter->p != &iter->cache->bic_devs) { in blkid_dev_next()
166 dev = list_entry(iter->p, struct blkid_struct_dev, bid_devs); in blkid_dev_next()
167 iter->p = iter->p->next; in blkid_dev_next()
168 if (iter->search_type && in blkid_dev_next()
169 !blkid_dev_has_tag(dev, iter->search_type, in blkid_dev_next()
170 iter->search_value)) in blkid_dev_next()
178 extern void blkid_dev_iterate_end(blkid_dev_iterate iter) in blkid_dev_iterate_end() argument
180 if (!iter || iter->magic != DEV_ITERATE_MAGIC) in blkid_dev_iterate_end()
182 iter->magic = 0; in blkid_dev_iterate_end()
183 free(iter); in blkid_dev_iterate_end()
203 blkid_dev_iterate iter; in main() local
242 iter = blkid_dev_iterate_begin(cache); in main()
244 blkid_dev_set_search(iter, search_type, search_value); in main()
245 while (blkid_dev_next(iter, &dev) == 0) { in main()
248 blkid_dev_iterate_end(iter); in main()