Lines Matching refs:iter
115 blkid_dev_iterate iter; in blkid_dev_iterate_begin() local
117 iter = malloc(sizeof(struct blkid_struct_dev_iterate)); in blkid_dev_iterate_begin()
118 if (iter) { in blkid_dev_iterate_begin()
119 iter->magic = DEV_ITERATE_MAGIC; in blkid_dev_iterate_begin()
120 iter->cache = cache; in blkid_dev_iterate_begin()
121 iter->p = cache->bic_devs.next; in blkid_dev_iterate_begin()
122 iter->search_type = 0; in blkid_dev_iterate_begin()
123 iter->search_value = 0; in blkid_dev_iterate_begin()
125 return (iter); in blkid_dev_iterate_begin()
128 extern int blkid_dev_set_search(blkid_dev_iterate iter, in blkid_dev_set_search() argument
133 if (!iter || iter->magic != DEV_ITERATE_MAGIC || !search_type || in blkid_dev_set_search()
145 free(iter->search_type); in blkid_dev_set_search()
146 free(iter->search_value); in blkid_dev_set_search()
147 iter->search_type = new_type; in blkid_dev_set_search()
148 iter->search_value = new_value; in blkid_dev_set_search()
155 extern int blkid_dev_next(blkid_dev_iterate iter, in blkid_dev_next() argument
161 if (!iter || iter->magic != DEV_ITERATE_MAGIC) in blkid_dev_next()
163 while (iter->p != &iter->cache->bic_devs) { in blkid_dev_next()
164 dev = list_entry(iter->p, struct blkid_struct_dev, bid_devs); in blkid_dev_next()
165 iter->p = iter->p->next; in blkid_dev_next()
166 if (iter->search_type && in blkid_dev_next()
167 !blkid_dev_has_tag(dev, iter->search_type, in blkid_dev_next()
168 iter->search_value)) in blkid_dev_next()
176 extern void blkid_dev_iterate_end(blkid_dev_iterate iter) in blkid_dev_iterate_end() argument
178 if (!iter || iter->magic != DEV_ITERATE_MAGIC) in blkid_dev_iterate_end()
180 iter->magic = 0; in blkid_dev_iterate_end()
181 free(iter); in blkid_dev_iterate_end()
201 blkid_dev_iterate iter; in main() local
240 iter = blkid_dev_iterate_begin(cache); in main()
242 blkid_dev_set_search(iter, search_type, search_value); in main()
243 while (blkid_dev_next(iter, &dev) == 0) { in main()
246 blkid_dev_iterate_end(iter); in main()