blob: c051b2b859a6dbfb21266185097de719043a080e [file] [log] [blame]
Mike Frysinger38a33f92005-05-09 22:13:22 +00001/*
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
20extern "C" {
21#endif
22
23#define BLKID_VERSION "1.0.0"
24#define BLKID_DATE "12-Feb-2003"
25
26typedef struct blkid_struct_dev *blkid_dev;
27typedef struct blkid_struct_cache *blkid_cache;
28typedef __s64 blkid_loff_t;
29
30typedef struct blkid_struct_tag_iterate *blkid_tag_iterate;
31typedef 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
Tim Rikerc1ef7bd2006-01-25 00:08:53 +000037 * in the cache.
Mike Frysinger38a33f92005-05-09 22:13:22 +000038 * BLKID_DEV_VERIFY Make sure the device structure corresponds
Tim Rikerc1ef7bd2006-01-25 00:08:53 +000039 * with reality.
Mike Frysinger38a33f92005-05-09 22:13:22 +000040 * BLKID_DEV_FIND Just look up a device entry, and return NULL
Tim Rikerc1ef7bd2006-01-25 00:08:53 +000041 * if it is not found.
Mike Frysinger38a33f92005-05-09 22:13:22 +000042 * BLKID_DEV_NORMAL Get a valid device structure, either from the
Tim Rikerc1ef7bd2006-01-25 00:08:53 +000043 * cache or by probing the device.
Mike Frysinger38a33f92005-05-09 22:13:22 +000044 */
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 */
51extern void blkid_put_cache(blkid_cache cache);
52extern int blkid_get_cache(blkid_cache *cache, const char *filename);
53
54/* dev.c */
55extern const char *blkid_dev_devname(blkid_dev dev);
56
57extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache);
Mike Frysinger874af852006-03-08 07:03:27 +000058extern int blkid_dev_set_search(blkid_dev_iterate iter,
59 char *search_type, char *search_value);
Mike Frysinger38a33f92005-05-09 22:13:22 +000060extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev);
61extern void blkid_dev_iterate_end(blkid_dev_iterate iterate);
62
63/* devno.c */
64extern char *blkid_devno_to_devname(dev_t devno);
65
66/* devname.c */
67extern int blkid_probe_all(blkid_cache cache);
Mike Frysinger874af852006-03-08 07:03:27 +000068extern int blkid_probe_all_new(blkid_cache cache);
Mike Frysinger38a33f92005-05-09 22:13:22 +000069extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname,
70 int flags);
71
72/* getsize.c */
73extern blkid_loff_t blkid_get_dev_size(int fd);
74
75/* probe.c */
76int blkid_known_fstype(const char *fstype);
77extern blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev);
78
79/* read.c */
80
81/* resolve.c */
82extern char *blkid_get_tag_value(blkid_cache cache, const char *tagname,
83 const char *devname);
84extern char *blkid_get_devname(blkid_cache cache, const char *token,
85 const char *value);
86
87/* tag.c */
88extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev);
89extern int blkid_tag_next(blkid_tag_iterate iterate,
90 const char **type, const char **value);
91extern void blkid_tag_iterate_end(blkid_tag_iterate iterate);
Mike Frysinger874af852006-03-08 07:03:27 +000092extern int blkid_dev_has_tag(blkid_dev dev, const char *type,
93 const char *value);
Mike Frysinger38a33f92005-05-09 22:13:22 +000094extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
95 const char *type,
96 const char *value);
97extern int blkid_parse_tag_string(const char *token, char **ret_type,
98 char **ret_val);
99
100/* version.c */
101extern int blkid_parse_version_string(const char *ver_string);
102extern int blkid_get_library_version(const char **ver_string,
103 const char **date_string);
104
105#ifdef __cplusplus
106}
107#endif
108
109#endif /* _BLKID_BLKID_H */