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