2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
7 * This copyrighted material is made available to anyone wishing to use,
8 * modify, copy, or redistribute it subject to the terms and conditions
9 * of the GNU Lesser General Public License v.2.1.
11 * You should have received a copy of the GNU Lesser General Public License
12 * along with this program; if not, write to the Free Software Foundation,
13 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 #ifndef _LVM_DEV_CACHE_H
17 #define _LVM_DEV_CACHE_H
22 * predicate for devices.
25 int (*passes_filter) (struct dev_filter * f, struct device * dev);
26 void (*destroy) (struct dev_filter * f);
32 * The global device cache.
35 int dev_cache_init(struct cmd_context *cmd);
36 void dev_cache_exit(void);
38 /* Trigger(1) or avoid(0) a scan */
39 void dev_cache_scan(int do_scan);
40 int dev_cache_has_scanned(void);
42 int dev_cache_add_dir(const char *path);
43 int dev_cache_add_loopfile(const char *path);
44 struct device *dev_cache_get(const char *name, struct dev_filter *f);
46 void dev_set_preferred_name(struct str_list *sl, struct device *dev);
49 * Object for iterating through the cache.
52 struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan);
53 void dev_iter_destroy(struct dev_iter *iter);
54 struct device *dev_iter_get(struct dev_iter *iter);
56 void dev_reset_error_count(struct cmd_context *cmd);