libparted 3.6
Loading...
Searching...
No Matches
pt-common.h
Go to the documentation of this file.
1/* Factor some of the duplication out of *.c. */
2
3#ifdef DISCOVER_ONLY
4# define NULL_IF_DISCOVER_ONLY(val) NULL
5#else
6# define NULL_IF_DISCOVER_ONLY(val) val
7#endif
8
9#define PT_define_limit_functions(PT_type) \
10 \
11static bool \
12PT_type##_partition_check (const PedPartition *part) \
13{ \
14 return ptt_partition_max_start_len (#PT_type, part); \
15} \
16 \
17static PedSector \
18PT_type##_partition_max_start_sector (void) \
19{ \
20 PedSector max; \
21 int err = ptt_partition_max_start_sector (#PT_type, &max); \
22 PED_ASSERT (err == 0); \
23 return max; \
24} \
25 \
26static PedSector \
27PT_type##_partition_max_length (void) \
28{ \
29 PedSector max; \
30 int err = ptt_partition_max_length (#PT_type, &max); \
31 PED_ASSERT (err == 0); \
32 return max; \
33}
34
35#define PT_op_function_initializers(PT_type) \
36probe: PT_type##_probe, \
37alloc: PT_type##_alloc, \
38duplicate: PT_type##_duplicate, \
39free: PT_type##_free, \
40read: PT_type##_read, \
41partition_new: PT_type##_partition_new, \
42partition_duplicate: PT_type##_partition_duplicate, \
43partition_set_flag: PT_type##_partition_set_flag, \
44partition_get_flag: PT_type##_partition_get_flag, \
45partition_set_system: PT_type##_partition_set_system, \
46partition_is_flag_available: PT_type##_partition_is_flag_available, \
47partition_align: PT_type##_partition_align, \
48partition_destroy: PT_type##_partition_destroy, \
49partition_enumerate: PT_type##_partition_enumerate, \
50alloc_metadata: PT_type##_alloc_metadata, \
51get_max_primary_partition_count: PT_type##_get_max_primary_partition_count, \
52get_max_supported_partition_count:PT_type##_get_max_supported_partition_count,\
53partition_check: PT_type##_partition_check, \
54max_length: PT_type##_partition_max_length, \
55max_start_sector: PT_type##_partition_max_start_sector