Denis Vlasenko | c4f623e | 2006-12-26 01:30:59 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * blkid.h - Interface for libblkid, a library to identify block devices |
| 4 | * |
| 5 | * Copyright (C) 2001 Andreas Dilger |
| 6 | * Copyright (C) 2003 Theodore Ts'o |
| 7 | * |
| 8 | * %Begin-Header% |
| 9 | * This file may be redistributed under the terms of the |
| 10 | * GNU Lesser General Public License. |
| 11 | * %End-Header% |
| 12 | */ |
| 13 | |
| 14 | #ifndef _BLKID_BLKID_H |
| 15 | #define _BLKID_BLKID_H |
| 16 | |
| 17 | #include <sys/types.h> |
| 18 | #include <linux/types.h> |
| 19 | |
| 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
| 24 | #define BLKID_VERSION "1.0.0" |
| 25 | #define BLKID_DATE "12-Feb-2003" |
| 26 | |
| 27 | typedef struct blkid_struct_dev *blkid_dev; |
| 28 | typedef struct blkid_struct_cache *blkid_cache; |
| 29 | typedef __s64 blkid_loff_t; |
| 30 | |
| 31 | typedef struct blkid_struct_tag_iterate *blkid_tag_iterate; |
| 32 | typedef struct blkid_struct_dev_iterate *blkid_dev_iterate; |
| 33 | |
| 34 | /* |
| 35 | * Flags for blkid_get_dev |
| 36 | * |
| 37 | * BLKID_DEV_CREATE Create an empty device structure if not found |
| 38 | * in the cache. |
| 39 | * BLKID_DEV_VERIFY Make sure the device structure corresponds |
| 40 | * with reality. |
| 41 | * BLKID_DEV_FIND Just look up a device entry, and return NULL |
| 42 | * if it is not found. |
| 43 | * BLKID_DEV_NORMAL Get a valid device structure, either from the |
| 44 | * cache or by probing the device. |
| 45 | */ |
| 46 | #define BLKID_DEV_FIND 0x0000 |
| 47 | #define BLKID_DEV_CREATE 0x0001 |
| 48 | #define BLKID_DEV_VERIFY 0x0002 |
| 49 | #define BLKID_DEV_NORMAL (BLKID_DEV_CREATE | BLKID_DEV_VERIFY) |
| 50 | |
| 51 | /* cache.c */ |
| 52 | extern void blkid_put_cache(blkid_cache cache); |
| 53 | extern int blkid_get_cache(blkid_cache *cache, const char *filename); |
| 54 | |
| 55 | /* dev.c */ |
| 56 | extern const char *blkid_dev_devname(blkid_dev dev); |
| 57 | |
| 58 | extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache); |
| 59 | extern int blkid_dev_set_search(blkid_dev_iterate iter, |
| 60 | char *search_type, char *search_value); |
| 61 | extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev); |
| 62 | extern void blkid_dev_iterate_end(blkid_dev_iterate iterate); |
| 63 | |
| 64 | /* devno.c */ |
| 65 | extern char *blkid_devno_to_devname(dev_t devno); |
| 66 | |
| 67 | /* devname.c */ |
| 68 | extern int blkid_probe_all(blkid_cache cache); |
| 69 | extern int blkid_probe_all_new(blkid_cache cache); |
| 70 | extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, |
| 71 | int flags); |
| 72 | |
| 73 | /* getsize.c */ |
| 74 | extern blkid_loff_t blkid_get_dev_size(int fd); |
| 75 | |
| 76 | /* probe.c */ |
| 77 | int blkid_known_fstype(const char *fstype); |
| 78 | extern blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev); |
| 79 | |
| 80 | /* read.c */ |
| 81 | |
| 82 | /* resolve.c */ |
| 83 | extern char *blkid_get_tag_value(blkid_cache cache, const char *tagname, |
| 84 | const char *devname); |
| 85 | extern char *blkid_get_devname(blkid_cache cache, const char *token, |
| 86 | const char *value); |
| 87 | |
| 88 | /* tag.c */ |
| 89 | extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev); |
| 90 | extern int blkid_tag_next(blkid_tag_iterate iterate, |
| 91 | const char **type, const char **value); |
| 92 | extern void blkid_tag_iterate_end(blkid_tag_iterate iterate); |
| 93 | extern int blkid_dev_has_tag(blkid_dev dev, const char *type, |
| 94 | const char *value); |
| 95 | extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache, |
| 96 | const char *type, |
| 97 | const char *value); |
| 98 | extern int blkid_parse_tag_string(const char *token, char **ret_type, |
| 99 | char **ret_val); |
| 100 | |
| 101 | #ifdef __cplusplus |
| 102 | } |
| 103 | #endif |
| 104 | |
| 105 | #endif /* _BLKID_BLKID_H */ |