Imported Upstream version 2.6.1
[platform/upstream/cryptsetup.git] / lib / utils_blkid.h
1 /*
2  * blkid probe utilities
3  *
4  * Copyright (C) 2018-2023 Red Hat, Inc. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef _UTILS_BLKID_H
22 #define _UTILS_BLKID_H
23
24 #include <sys/types.h>
25
26 struct blkid_handle;
27
28 typedef enum { PRB_OK = 0, PRB_EMPTY, PRB_AMBIGUOUS, PRB_FAIL } blk_probe_status;
29
30 int blk_init_by_path(struct blkid_handle **h, const char *path);
31
32 void blk_free(struct blkid_handle *h);
33
34 /*
35  * WARNING: This will reset file description offset as if
36  *          lseek(devfd, 0, SEEK_SET) was called!
37  */
38 int blk_init_by_fd(struct blkid_handle **h, int fd);
39
40 void blk_set_chains_for_wipes(struct blkid_handle *h);
41
42 void blk_set_chains_for_full_print(struct blkid_handle *h);
43
44 void blk_set_chains_for_superblocks(struct blkid_handle *h);
45
46 void blk_set_chains_for_fast_detection(struct blkid_handle *h);
47
48 int blk_superblocks_filter_luks(struct blkid_handle *h);
49 int blk_superblocks_only_luks(struct blkid_handle *h);
50
51 blk_probe_status blk_safeprobe(struct blkid_handle *h);
52
53 blk_probe_status blk_probe(struct blkid_handle *h);
54
55 int blk_is_partition(struct blkid_handle *h);
56
57 int blk_is_superblock(struct blkid_handle *h);
58
59 const char *blk_get_partition_type(struct blkid_handle *h);
60
61 const char *blk_get_superblock_type(struct blkid_handle *h);
62
63 int blk_do_wipe(struct blkid_handle *h);
64
65 int blk_supported(void);
66
67 unsigned blk_get_block_size(struct blkid_handle *h);
68
69 #endif