summaryrefslogtreecommitdiffstats
path: root/include/system-partitions.h
blob: e6d1a0f88bf3e9de7dd6be6b4a8a745cca291262 (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
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef SYSTEM_PARTITIONS_H_
#define SYSTEM_PARTITIONS_H_

#include <linux/types.h>
#include <file-list.h>

#ifdef CONFIG_SYSTEM_PARTITIONS

/* duplicates current system_partitions and returns it */
struct file_list *system_partitions_get(void);

/* takes ownership of files and store it internally */
void system_partitions_set(struct file_list *files);

/*
 * check whether system_partitions_get would return an empty
 * file_list without doing an allocation
 */
bool system_partitions_empty(void);

#else

static inline struct file_list *system_partitions_get(void)
{
	return file_list_parse("");
}

static inline bool system_partitions_empty(void)
{
	return true;
}

/*
 * system_partitions_set() intentionally left unimplemented.
 * select CONFIG_SYSTEM_PARTITIONS if you want to set it
 */

#endif

static inline struct file_list *system_partitions_get_null(void)
{
	if (system_partitions_empty())
		return NULL;
	return system_partitions_get();
}

#endif