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