summaryrefslogtreecommitdiffstats
path: root/libparted/labels/pt-common.h
blob: 76f06e3266a4290661434df6dab8497b7eaf778d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Factor some of the duplication out of *.c.  */

#ifdef DISCOVER_ONLY
# define NULL_IF_DISCOVER_ONLY(val) NULL
#else
# define NULL_IF_DISCOVER_ONLY(val) val
#endif

#define PT_define_limit_functions(PT_type)			\
								\
static bool							\
PT_type##_partition_check (const PedPartition *part)		\
{								\
  return ptt_partition_max_start_len (#PT_type, part);		\
}								\
								\
static PedSector						\
PT_type##_partition_max_start_sector (void)			\
{								\
  PedSector max;						\
  int err = ptt_partition_max_start_sector (#PT_type, &max);	\
  PED_ASSERT (err == 0);					\
  return max;							\
}								\
								\
static PedSector						\
PT_type##_partition_max_length (void)				\
{								\
  PedSector max;						\
  int err = ptt_partition_max_length (#PT_type, &max);		\
  PED_ASSERT (err == 0);					\
  return max;							\
}

#define PT_op_function_initializers(PT_type)			\
probe:                        PT_type##_probe,			\
alloc:                        PT_type##_alloc,			\
duplicate:                    PT_type##_duplicate,		\
free:                         PT_type##_free,			\
read:                         PT_type##_read,			\
partition_new:                PT_type##_partition_new,		\
partition_duplicate:          PT_type##_partition_duplicate,	\
partition_set_flag:           PT_type##_partition_set_flag,	\
partition_get_flag:           PT_type##_partition_get_flag,	\
partition_set_system:         PT_type##_partition_set_system,	\
partition_is_flag_available:  PT_type##_partition_is_flag_available, \
partition_align:              PT_type##_partition_align,	\
partition_destroy:            PT_type##_partition_destroy,	\
partition_enumerate:	      PT_type##_partition_enumerate,	\
alloc_metadata:               PT_type##_alloc_metadata,		\
get_max_primary_partition_count: PT_type##_get_max_primary_partition_count, \
get_max_supported_partition_count:PT_type##_get_max_supported_partition_count,\
partition_check:              PT_type##_partition_check,	\
max_length:                   PT_type##_partition_max_length,	\
max_start_sector:             PT_type##_partition_max_start_sector