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