]> git.ipfire.org Git - thirdparty/util-linux.git/blame - libblkid/src/blkidP.h
[clang-tidy] fix mismatching declarations
[thirdparty/util-linux.git] / libblkid / src / blkidP.h
CommitLineData
a0948ffe
KZ
1/*
2 * blkidP.h - Internal interfaces for libblkid
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_BLKIDP_H
14#define _BLKID_BLKIDP_H
15
a01e15f1
KZ
16/* Always confirm that /dev/disk-by symlinks match with LABEL/UUID on device */
17/* #define CONFIG_BLKID_VERIFY_UDEV 1 */
18
a0948ffe 19#include <sys/types.h>
f38fd19d
KZ
20#include <dirent.h>
21#include <sys/stat.h>
a0948ffe 22#include <stdio.h>
ff67bea3 23#include <stdarg.h>
220c6015 24#include <stdint.h>
a0948ffe 25
c2435b94 26#ifndef UUID_STR_LEN
9f20d800
KZ
27# define UUID_STR_LEN 37
28#endif
29
33ba1099 30#include "c.h"
a109a8b7 31#include "bitops.h" /* $(top_srcdir)/include/ */
0c3508bd 32#include "blkdev.h"
33ba1099 33
ed640286 34#include "debug.h"
51410fc6
KZ
35#include "blkid.h"
36#include "list.h"
35c6ed61 37#include "encode.h"
a0948ffe 38
a0948ffe
KZ
39/*
40 * This describes the attributes of a specific device.
41 * We can traverse all of the tags by bid_tags (linking to the tag bit_names).
42 * The bid_label and bid_uuid fields are shortcuts to the LABEL and UUID tag
43 * values, if they exist.
44 */
45struct blkid_struct_dev
46{
47 struct list_head bid_devs; /* All devices in the cache */
48 struct list_head bid_tags; /* All tags for this device */
49 blkid_cache bid_cache; /* Dev belongs to this cache */
9e930041 50 char *bid_name; /* Device real path (as used in cache) */
924c93d9 51 char *bid_xname; /* Device path as used by application (maybe symlink..) */
a0948ffe
KZ
52 char *bid_type; /* Preferred device TYPE */
53 int bid_pri; /* Device priority */
54 dev_t bid_devno; /* Device major/minor number */
55 time_t bid_time; /* Last update time of device */
6c2f2b9d 56 suseconds_t bid_utime; /* Last update time (microseconds) */
a0948ffe
KZ
57 unsigned int bid_flags; /* Device status bitflags */
58 char *bid_label; /* Shortcut to device LABEL */
59 char *bid_uuid; /* Shortcut to binary UUID */
60};
61
62#define BLKID_BID_FL_VERIFIED 0x0001 /* Device data validated from disk */
63#define BLKID_BID_FL_INVALID 0x0004 /* Device is invalid */
49361dc4 64#define BLKID_BID_FL_REMOVABLE 0x0008 /* Device added by blkid_probe_all_removable() */
a0948ffe
KZ
65
66/*
67 * Each tag defines a NAME=value pair for a particular device. The tags
68 * are linked via bit_names for a single device, so that traversing the
69 * names list will get you a list of all tags associated with a device.
70 * They are also linked via bit_values for all devices, so one can easily
71 * search all tags with a given NAME for a specific value.
72 */
73struct blkid_struct_tag
74{
75 struct list_head bit_tags; /* All tags for this device */
76 struct list_head bit_names; /* All tags with given NAME */
77 char *bit_name; /* NAME of tag (shared) */
78 char *bit_val; /* value of tag */
79 blkid_dev bit_dev; /* pointer to device */
80};
81typedef struct blkid_struct_tag *blkid_tag;
82
51410fc6 83/*
924fe747 84 * Chain IDs
51410fc6 85 */
924fe747
KZ
86enum {
87 BLKID_CHAIN_SUBLKS, /* FS/RAID superblocks (enabled by default) */
cc33d693 88 BLKID_CHAIN_TOPLGY, /* Block device topology */
e4799a35 89 BLKID_CHAIN_PARTS, /* Partition tables */
51410fc6 90
924fe747
KZ
91 BLKID_NCHAINS /* number of chains */
92};
93
94struct blkid_chain {
95 const struct blkid_chaindrv *driver; /* chain driver */
96
97 int enabled; /* boolean */
98 int flags; /* BLKID_<chain>_* */
99 int binary; /* boolean */
c9f51c71 100 int idx; /* index of the current prober (or -1) */
924fe747
KZ
101 unsigned long *fltr; /* filter or NULL */
102 void *data; /* private chain data or NULL */
51410fc6
KZ
103};
104
105/*
924fe747 106 * Chain driver
51410fc6 107 */
924fe747 108struct blkid_chaindrv {
c9f51c71 109 const size_t id; /* BLKID_CHAIN_* */
924fe747
KZ
110 const char *name; /* name of chain (for debug purpose) */
111 const int dflt_flags; /* default chain flags */
112 const int dflt_enabled; /* default enabled boolean */
113 int has_fltr; /* boolean */
114
115 const struct blkid_idinfo **idinfos; /* description of probing functions */
116 const size_t nidinfos; /* number of idinfos */
117
118 /* driver operations */
119 int (*probe)(blkid_probe, struct blkid_chain *);
120 int (*safeprobe)(blkid_probe, struct blkid_chain *);
121 void (*free_data)(blkid_probe, void *);
122};
51410fc6 123
c5e3ebce
SK
124/* chains */
125extern const struct blkid_chaindrv superblocks_drv;
126extern const struct blkid_chaindrv topology_drv;
127extern const struct blkid_chaindrv partitions_drv;
128
924fe747
KZ
129/*
130 * Low-level probe result
131 */
924fe747
KZ
132struct blkid_prval
133{
6c4a7811
OO
134 const char *name; /* value name */
135 unsigned char *data; /* value data */
136 size_t len; /* length of value data */
51410fc6 137
924fe747 138 struct blkid_chain *chain; /* owner */
6c4a7811 139 struct list_head prvals; /* list of results */
51410fc6
KZ
140};
141
51410fc6
KZ
142/*
143 * Filesystem / Raid magic strings
144 */
145struct blkid_idmag
146{
147 const char *magic; /* magic string */
92838067 148 unsigned int len; /* length of magic */
51410fc6
KZ
149
150 long kboff; /* kilobyte offset of superblock */
92838067 151 unsigned int sboff; /* byte offset within superblock */
51410fc6
KZ
152};
153
154/*
155 * Filesystem / Raid description
156 */
157struct blkid_idinfo
158{
924fe747 159 const char *name; /* fs, raid or partition table name */
a2f01a1c
KZ
160 int usage; /* BLKID_USAGE_* flag */
161 int flags; /* BLKID_IDINFO_* flags */
8c2b156e 162 int minsz; /* minimal device size */
51410fc6 163
a2f01a1c 164 /* probe function */
51410fc6
KZ
165 int (*probefunc)(blkid_probe pr, const struct blkid_idmag *mag);
166
167 struct blkid_idmag magics[]; /* NULL or array with magic strings */
168};
169
288c2da1
KZ
170#define BLKID_NONE_MAGIC {{ NULL }}
171
a2f01a1c
KZ
172/*
173 * tolerant FS - can share the same device with more filesystems (e.g. typical
174 * on CD-ROMs). We need this flag to detect ambivalent results (e.g. valid fat
175 * and valid linux swap on the same device).
176 */
177#define BLKID_IDINFO_TOLERANT (1 << 1)
178
15a8fb42
KZ
179struct blkid_bufinfo {
180 unsigned char *data;
f12cd8d1
KZ
181 uint64_t off;
182 uint64_t len;
15a8fb42
KZ
183 struct list_head bufs; /* list of buffers */
184};
185
924fe747
KZ
186/*
187 * Low-level probing control struct
188 */
189struct blkid_struct_probe
190{
191 int fd; /* device file descriptor */
f12cd8d1
KZ
192 uint64_t off; /* begin of data on the device */
193 uint64_t size; /* end of data on the device */
f38db0cf 194
924fe747 195 dev_t devno; /* device number (st.st_rdev) */
601fb1c1 196 dev_t disk_devno; /* devno of the whole-disk or 0 */
924fe747
KZ
197 unsigned int blkssz; /* sector size (BLKSSZGET ioctl) */
198 mode_t mode; /* struct stat.sb_mode */
199
9e930041 200 int flags; /* private library flags */
c81e7008 201 int prob_flags; /* always zeroized by blkid_do_*() */
f38db0cf 202
f12cd8d1
KZ
203 uint64_t wipe_off; /* begin of the wiped area */
204 uint64_t wipe_size; /* size of the wiped area */
8b7eae45
KZ
205 struct blkid_chain *wipe_chain; /* superblock, partition, ... */
206
15a8fb42 207 struct list_head buffers; /* list of buffers */
924fe747
KZ
208
209 struct blkid_chain chains[BLKID_NCHAINS]; /* array of chains */
210 struct blkid_chain *cur_chain; /* current chain */
211
af17d349 212 struct list_head values; /* results */
fd9f45e1
KZ
213
214 struct blkid_struct_probe *parent; /* for clones */
215 struct blkid_struct_probe *disk_probe; /* whole-disk probing */
924fe747
KZ
216};
217
a9eef56c
KZ
218/* private flags library flags */
219#define BLKID_FL_PRIVATE_FD (1 << 1) /* see blkid_new_probe_from_filename() */
220#define BLKID_FL_TINY_DEV (1 << 2) /* <= 1.47MiB (floppy or so) */
221#define BLKID_FL_CDROM_DEV (1 << 3) /* is a CD/DVD drive */
20e1c3dc 222#define BLKID_FL_NOSCAN_DEV (1 << 4) /* do not scan this device */
d2b0c658 223#define BLKID_FL_MODIF_BUFF (1 << 5) /* cached bufferes has been modified */
a9eef56c
KZ
224
225/* private per-probing flags */
226#define BLKID_PROBE_FL_IGNORE_PT (1 << 1) /* ignore partition table */
f38db0cf 227
fd9f45e1
KZ
228extern blkid_probe blkid_clone_probe(blkid_probe parent);
229extern blkid_probe blkid_probe_get_wholedisk_probe(blkid_probe pr);
230
568871ae
KZ
231/*
232 * Evaluation methods (for blkid_eval_* API)
233 */
234enum {
235 BLKID_EVAL_UDEV = 0,
236 BLKID_EVAL_SCAN,
237
238 __BLKID_EVAL_LAST
239};
240
241/*
242 * Library config options
243 */
244struct blkid_config {
245 int eval[__BLKID_EVAL_LAST]; /* array with EVALUATION=<udev,cache> options */
246 int nevals; /* number of elems in eval array */
247 int uevent; /* SEND_UEVENT=<yes|not> option */
248 char *cachefile; /* CACHE_FILE=<path> option */
249};
250
d93ce29e
KZ
251extern struct blkid_config *blkid_read_config(const char *filename)
252 __ul_attribute__((warn_unused_result));
568871ae
KZ
253extern void blkid_free_config(struct blkid_config *conf);
254
a0948ffe
KZ
255/*
256 * Minimum number of seconds between device probes, even when reading
257 * from the cache. This is to avoid re-probing all devices which were
258 * just probed by another program that does not share the cache.
259 */
260#define BLKID_PROBE_MIN 2
261
262/*
263 * Time in seconds an entry remains verified in the in-memory cache
264 * before being reverified (in case of long-running processes that
265 * keep a cache in memory and continue to use it for a long time).
266 */
267#define BLKID_PROBE_INTERVAL 200
268
269/* This describes an entire blkid cache file and probed devices.
270 * We can traverse all of the found devices via bic_list.
271 * We can traverse all of the tag types by bic_tags, which hold empty tags
272 * for each tag type. Those tags can be used as list_heads for iterating
273 * through all devices with a specific tag type (e.g. LABEL).
274 */
275struct blkid_struct_cache
276{
277 struct list_head bic_devs; /* List head of all devices */
278 struct list_head bic_tags; /* List head of all tag types */
279 time_t bic_time; /* Last probe time */
51410fc6 280 time_t bic_ftime; /* Mod time of the cachefile */
a0948ffe
KZ
281 unsigned int bic_flags; /* Status flags of the cache */
282 char *bic_filename; /* filename of cache */
51410fc6 283 blkid_probe probe; /* low-level probing stuff */
a0948ffe
KZ
284};
285
286#define BLKID_BIC_FL_PROBED 0x0002 /* We probed /proc/partition devices */
287#define BLKID_BIC_FL_CHANGED 0x0004 /* Cache has changed from disk */
288
b82590ad 289/* config file */
568871ae 290#define BLKID_CONFIG_FILE "/etc/blkid.conf"
a0948ffe 291
b82590ad
KZ
292/* cache file on systemds with /run */
293#define BLKID_RUNTIME_TOPDIR "/run"
294#define BLKID_RUNTIME_DIR BLKID_RUNTIME_TOPDIR "/blkid"
295#define BLKID_CACHE_FILE BLKID_RUNTIME_DIR "/blkid.tab"
296
297/* old systems */
298#define BLKID_CACHE_FILE_OLD "/etc/blkid.tab"
299
296d96e2
HR
300#define BLKID_PROBE_OK 0
301#define BLKID_PROBE_NONE 1
302
a0948ffe
KZ
303#define BLKID_ERR_IO 5
304#define BLKID_ERR_PROC 9
305#define BLKID_ERR_MEM 12
306#define BLKID_ERR_CACHE 14
307#define BLKID_ERR_DEV 19
308#define BLKID_ERR_PARAM 22
309#define BLKID_ERR_BIG 27
310
311/*
312 * Priority settings for different types of devices
313 */
c1ba7962 314#define BLKID_PRI_UBI 50
a0948ffe
KZ
315#define BLKID_PRI_DM 40
316#define BLKID_PRI_EVMS 30
317#define BLKID_PRI_LVM 20
318#define BLKID_PRI_MD 10
319
b7da851e
KZ
320#define BLKID_DEBUG_HELP (1 << 0)
321#define BLKID_DEBUG_INIT (1 << 1)
322#define BLKID_DEBUG_CACHE (1 << 2)
323#define BLKID_DEBUG_CONFIG (1 << 3)
324#define BLKID_DEBUG_DEV (1 << 4)
325#define BLKID_DEBUG_DEVNAME (1 << 5)
326#define BLKID_DEBUG_DEVNO (1 << 6)
327#define BLKID_DEBUG_EVALUATE (1 << 7)
328#define BLKID_DEBUG_LOWPROBE (1 << 8)
329#define BLKID_DEBUG_PROBE (1 << 9)
330#define BLKID_DEBUG_READ (1 << 10)
331#define BLKID_DEBUG_SAVE (1 << 11)
332#define BLKID_DEBUG_TAG (1 << 12)
a674a0ab 333#define BLKID_DEBUG_BUFFER (1 << 13)
b7da851e 334#define BLKID_DEBUG_ALL 0xFFFF /* (1 << 16) aka FFFF is expected by API */
a0948ffe 335
ed640286 336UL_DEBUG_DECLARE_MASK(libblkid);
b7da851e
KZ
337#define DBG(m, x) __UL_DBG(libblkid, BLKID_DEBUG_, m, x)
338#define ON_DBG(m, x) __UL_DBG_CALL(libblkid, BLKID_DEBUG_, m, x)
c62a6311 339
6d00cfb2
KZ
340#define UL_DEBUG_CURRENT_MASK UL_DEBUG_MASK(libblkid)
341#include "debugobj.h"
342
a0948ffe 343extern void blkid_debug_dump_dev(blkid_dev dev);
6644688a 344
6644688a 345
241b6cf3
TT
346/* devno.c */
347struct dir_list {
348 char *name;
349 struct dir_list *next;
350};
d93ce29e
KZ
351extern void blkid__scan_dir(char *, dev_t, struct dir_list **, char **)
352 __attribute__((nonnull(1,4)));
13ae0352 353extern int blkid_driver_has_major(const char *drvname, int drvmaj)
d93ce29e 354 __attribute__((warn_unused_result));
241b6cf3 355
a0948ffe
KZ
356/* lseek.c */
357extern blkid_loff_t blkid_llseek(int fd, blkid_loff_t offset, int whence);
358
359/* read.c */
d93ce29e
KZ
360extern void blkid_read_cache(blkid_cache cache)
361 __attribute__((nonnull));
a0948ffe
KZ
362
363/* save.c */
d93ce29e
KZ
364extern int blkid_flush_cache(blkid_cache cache)
365 __attribute__((nonnull));
a0948ffe 366
568871ae 367/* cache */
d93ce29e
KZ
368extern char *blkid_safe_getenv(const char *arg)
369 __attribute__((nonnull))
370 __attribute__((warn_unused_result));
568871ae 371
d93ce29e
KZ
372extern char *blkid_get_cache_filename(struct blkid_config *conf)
373 __attribute__((warn_unused_result));
a0948ffe
KZ
374/*
375 * Functions to create and find a specific tag type: tag.c
376 */
377extern void blkid_free_tag(blkid_tag tag);
d93ce29e
KZ
378extern blkid_tag blkid_find_tag_dev(blkid_dev dev, const char *type)
379 __attribute__((nonnull))
380 __attribute__((warn_unused_result));
381
a0948ffe 382extern int blkid_set_tag(blkid_dev dev, const char *name,
d93ce29e
KZ
383 const char *value, const int vlength)
384 __attribute__((nonnull(1,2)));
a0948ffe
KZ
385
386/*
387 * Functions to create and find a specific tag type: dev.c
388 */
d93ce29e
KZ
389extern blkid_dev blkid_new_dev(void)
390 __attribute__((warn_unused_result));
a0948ffe
KZ
391extern void blkid_free_dev(blkid_dev dev);
392
51410fc6 393/* probe.c */
d93ce29e
KZ
394extern int blkid_probe_is_tiny(blkid_probe pr)
395 __attribute__((nonnull))
396 __attribute__((warn_unused_result));
397extern int blkid_probe_is_cdrom(blkid_probe pr)
398 __attribute__((nonnull))
399 __attribute__((warn_unused_result));
400
108013b4 401extern unsigned char *blkid_probe_get_buffer(blkid_probe pr,
f12cd8d1 402 uint64_t off, uint64_t len)
d93ce29e
KZ
403 __attribute__((nonnull))
404 __attribute__((warn_unused_result));
148e2f9e 405
d93ce29e
KZ
406extern unsigned char *blkid_probe_get_sector(blkid_probe pr, unsigned int sector)
407 __attribute__((nonnull))
408 __attribute__((warn_unused_result));
ce011388 409
f319b5ca 410extern int blkid_probe_get_dimension(blkid_probe pr,
f12cd8d1 411 uint64_t *off, uint64_t *size)
d93ce29e 412 __attribute__((nonnull));
f319b5ca
KZ
413
414extern int blkid_probe_set_dimension(blkid_probe pr,
f12cd8d1 415 uint64_t off, uint64_t size)
d93ce29e 416 __attribute__((nonnull));
f319b5ca 417
c76e710b 418extern int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id,
f12cd8d1 419 uint64_t *offset, const struct blkid_idmag **res)
d93ce29e 420 __attribute__((nonnull(1)));
c76e710b 421
9e930041 422/* returns superblock according to 'struct blkid_idmag' */
148e2f9e
KZ
423#define blkid_probe_get_sb(_pr, _mag, type) \
424 ((type *) blkid_probe_get_buffer((_pr),\
425 (_mag)->kboff << 10, sizeof(type)))
426
d93ce29e
KZ
427extern blkid_partlist blkid_probe_get_partlist(blkid_probe pr)
428 __attribute__((nonnull))
429 __attribute__((warn_unused_result));
9bdf6885 430
c81e7008 431extern int blkid_probe_is_covered_by_pt(blkid_probe pr,
f12cd8d1 432 uint64_t offset, uint64_t size)
d93ce29e
KZ
433 __attribute__((warn_unused_result));
434
af17d349 435extern void blkid_probe_chain_reset_values(blkid_probe pr, struct blkid_chain *chn)
d93ce29e 436 __attribute__((nonnull));
af17d349 437extern int blkid_probe_chain_save_values(blkid_probe pr,
d93ce29e 438 struct blkid_chain *chn,
6c4a7811 439 struct list_head *vals)
d93ce29e
KZ
440 __attribute__((nonnull));
441
442extern struct blkid_prval *blkid_probe_assign_value(blkid_probe pr,
443 const char *name)
444 __attribute__((nonnull))
445 __attribute__((warn_unused_result));
446
af17d349 447extern void blkid_probe_free_value(struct blkid_prval *v);
6c4a7811
OO
448
449
af17d349 450extern void blkid_probe_append_values_list(blkid_probe pr,
6c4a7811 451 struct list_head *vals)
d93ce29e
KZ
452 __attribute__((nonnull));
453
af17d349
KZ
454extern void blkid_probe_free_values_list(struct list_head *vals);
455
d93ce29e
KZ
456extern struct blkid_chain *blkid_probe_get_chain(blkid_probe pr)
457 __attribute__((nonnull))
458 __attribute__((warn_unused_result));
459
460extern struct blkid_prval *__blkid_probe_get_value(blkid_probe pr, int num)
461 __attribute__((nonnull))
462 __attribute__((warn_unused_result));
463
464extern struct blkid_prval *__blkid_probe_lookup_value(blkid_probe pr, const char *name)
465 __attribute__((nonnull))
466 __attribute__((warn_unused_result));
467
468extern unsigned long *blkid_probe_get_filter(blkid_probe pr, int chain, int create)
469 __attribute__((nonnull))
470 __attribute__((warn_unused_result));
471
472extern int __blkid_probe_invert_filter(blkid_probe pr, int chain)
473 __attribute__((nonnull));
474extern int __blkid_probe_reset_filter(blkid_probe pr, int chain)
475 __attribute__((nonnull));
476extern int __blkid_probe_filter_types(blkid_probe pr, int chain, int flag, char *names[])
477 __attribute__((nonnull));
478
479extern void *blkid_probe_get_binary_data(blkid_probe pr, struct blkid_chain *chn)
480 __attribute__((nonnull))
481 __attribute__((warn_unused_result));
46a734fd 482
6c4a7811
OO
483extern struct blkid_prval *blkid_probe_new_val(void)
484 __attribute__((warn_unused_result));
51410fc6 485extern int blkid_probe_set_value(blkid_probe pr, const char *name,
47afae0c 486 const unsigned char *data, size_t len)
d93ce29e 487 __attribute__((nonnull));
6c4a7811 488extern int blkid_probe_value_set_data(struct blkid_prval *v,
47afae0c 489 const unsigned char *data, size_t len)
6c4a7811 490 __attribute__((nonnull));
d93ce29e 491
51410fc6 492extern int blkid_probe_vsprintf_value(blkid_probe pr, const char *name,
d93ce29e
KZ
493 const char *fmt, va_list ap)
494 __attribute__((nonnull));
641e3e20 495
cc33d693 496extern int blkid_probe_sprintf_value(blkid_probe pr, const char *name,
d93ce29e
KZ
497 const char *fmt, ...)
498 __attribute__((nonnull))
499 __attribute__ ((__format__ (__printf__, 3, 4)));
28a47f13 500
f12cd8d1 501extern int blkid_probe_set_magic(blkid_probe pr, uint64_t offset,
47afae0c 502 size_t len, const unsigned char *magic)
d93ce29e 503 __attribute__((nonnull));
51410fc6 504
c89a1def
KZ
505extern int blkid_probe_verify_csum(blkid_probe pr, uint64_t csum, uint64_t expected)
506 __attribute__((nonnull));
507
d93ce29e
KZ
508extern void blkid_unparse_uuid(const unsigned char *uuid, char *str, size_t len)
509 __attribute__((nonnull));
9c06cdbf
KZ
510extern int blkid_uuid_is_empty(const unsigned char *buf, size_t len);
511
d93ce29e
KZ
512extern size_t blkid_rtrim_whitespace(unsigned char *str)
513 __attribute__((nonnull));
fafe46bc
ZAK
514extern size_t blkid_ltrim_whitespace(unsigned char *str)
515 __attribute__((nonnull));
201529bd 516
f12cd8d1
KZ
517extern void blkid_probe_set_wiper(blkid_probe pr, uint64_t off,
518 uint64_t size)
d93ce29e 519 __attribute__((nonnull));
8b7eae45 520extern int blkid_probe_is_wiped(blkid_probe pr, struct blkid_chain **chn,
f12cd8d1 521 uint64_t off, uint64_t size)
d93ce29e
KZ
522 __attribute__((nonnull))
523 __attribute__((warn_unused_result));
f12cd8d1 524extern void blkid_probe_use_wiper(blkid_probe pr, uint64_t off, uint64_t size)
d93ce29e 525 __attribute__((nonnull));
8b7eae45 526
f23e0557
KZ
527/* filter bitmap macros */
528#define blkid_bmp_wordsize (8 * sizeof(unsigned long))
529#define blkid_bmp_idx_bit(item) (1UL << ((item) % blkid_bmp_wordsize))
530#define blkid_bmp_idx_byte(item) ((item) / blkid_bmp_wordsize)
531
532#define blkid_bmp_set_item(bmp, item) \
533 ((bmp)[ blkid_bmp_idx_byte(item) ] |= blkid_bmp_idx_bit(item))
534
535#define blkid_bmp_unset_item(bmp, item) \
e8fc977a 536 ((bmp)[ blkid_bmp_idx_byte(item) ] &= ~blkid_bmp_idx_bit(item))
f23e0557
KZ
537
538#define blkid_bmp_get_item(bmp, item) \
539 ((bmp)[ blkid_bmp_idx_byte(item) ] & blkid_bmp_idx_bit(item))
540
541#define blkid_bmp_nwords(max_items) \
542 (((max_items) + blkid_bmp_wordsize) / blkid_bmp_wordsize)
543
544#define blkid_bmp_nbytes(max_items) \
545 (blkid_bmp_nwords(max_items) * sizeof(unsigned long))
546
a0948ffe 547#endif /* _BLKID_BLKIDP_H */