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