struct snap_cache *snap_find_cache(kdev_t dev)
{
struct snap_cache *cache;
- struct list_head *lh, *tmp;
+ struct list_head *lh;
- lh = tmp = &(snap_caches[snap_cache_hash(dev)]);
+ lh = &(snap_caches[snap_cache_hash(dev)]);
list_for_each_entry(cache, lh, cache_chain) {
- if ( cache->cache_dev == dev )
+ if (cache->cache_dev == dev)
return cache;
}
return NULL;
}
return cache;
}
+/*walk through the cache structure*/
+int snap_cache_process(snap_cache_cb_t cb, void* in, unsigned long* out)
+{
+ int i = 0;
+
+ for (i = 0; i < CACHES_SIZE; i++) {
+ struct snap_cache *cache;
+ struct list_head *lh = &(snap_caches[i]);
+ list_for_each_entry(cache, lh, cache_chain) {
+ if (cb(cache, in, out))
+ goto exit;
+ }
+ }
+exit:
+ return 0;
+}
+
/* free a cache structure and all of the memory it is pointing to */
inline void snap_free_cache(struct snap_cache *cache)