Whamcloud - gitweb
Internal changes to the blkid library:
[tools/e2fsprogs.git] / lib / blkid / blkid.h
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 <blkid/blkid_types.h>
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 #define BLKID_VERSION   "1.0.0"
23 #define BLKID_DATE      "12-Feb-2003"
24
25 typedef struct blkid_struct_dev *blkid_dev;
26 typedef struct blkid_struct_cache *blkid_cache;
27 typedef __s64 blkid_loff_t;
28
29 typedef struct blkid_struct_tag_iterate *blkid_tag_iterate;
30 typedef struct blkid_struct_dev_iterate *blkid_dev_iterate;
31
32 /*
33  * Flags for blkid_get_dev
34  *
35  * BLKID_DEV_CREATE     Create an empty device structure if not found
36  *                      in the cache.
37  * BLKID_DEV_VERIFY     Make sure the device structure corresponds
38  *                      with reality.
39  * BLKID_DEV_FIND       Just look up a device entry, and return NULL
40  *                      if it is not found.
41  * BLKID_DEV_NORMAL     Get a valid device structure, either from the
42  *                      cache or by probing the device.
43  */
44 #define BLKID_DEV_FIND          0x0000
45 #define BLKID_DEV_CREATE        0x0001
46 #define BLKID_DEV_VERIFY        0x0002
47 #define BLKID_DEV_NORMAL        (BLKID_DEV_CREATE | BLKID_DEV_VERIFY)
48
49 /* cache.c */
50 extern void blkid_put_cache(blkid_cache cache);
51 extern int blkid_get_cache(blkid_cache *cache, const char *filename);
52
53 /* dev.c */
54 extern const char *blkid_dev_devname(blkid_dev dev);
55
56 extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache);
57 extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev);
58 extern void blkid_dev_iterate_end(blkid_dev_iterate iterate);
59
60 /* devno.c */
61 extern char *blkid_devno_to_devname(dev_t devno);
62
63 /* devname.c */
64 extern int blkid_probe_all(blkid_cache cache);
65 extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname,
66                                int flags);
67
68 /* getsize.c */
69 extern blkid_loff_t blkid_get_dev_size(int fd);
70
71 /* read.c */
72
73 /* resolve.c */
74 extern char *blkid_get_tagname_devname(blkid_cache cache, const char *tagname,
75                                        const char *devname);
76 extern char *blkid_get_devname(blkid_cache cache, const char *token,
77                                const char *value);
78
79 /* tag.c */
80 extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev);
81 extern int blkid_tag_next(blkid_tag_iterate iterate,
82                               const char **type, const char **value);
83 extern void blkid_tag_iterate_end(blkid_tag_iterate iterate);
84
85 extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
86                                          const char *type,
87                                          const char *value);
88 extern int blkid_parse_tag_string(const char *token, char **ret_type,
89                                   char **ret_val);
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95 #endif /* _BLKID_BLKID_H */