/src/barebox/include/system-partitions.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | | #ifndef SYSTEM_PARTITIONS_H_ |
3 | | #define SYSTEM_PARTITIONS_H_ |
4 | | |
5 | | #include <linux/types.h> |
6 | | #include <file-list.h> |
7 | | |
8 | | #ifdef CONFIG_SYSTEM_PARTITIONS |
9 | | |
10 | | /* duplicates current system_partitions and returns it */ |
11 | | struct file_list *system_partitions_get(void); |
12 | | |
13 | | /* takes ownership of files and store it internally */ |
14 | | void system_partitions_set(struct file_list *files); |
15 | | |
16 | | /* |
17 | | * check whether system_partitions_get would return an empty |
18 | | * file_list without doing an allocation |
19 | | */ |
20 | | bool system_partitions_empty(void); |
21 | | |
22 | | #else |
23 | | |
24 | | static inline struct file_list *system_partitions_get(void) |
25 | 0 | { |
26 | 0 | return file_list_parse(""); |
27 | 0 | } |
28 | | |
29 | | static inline bool system_partitions_empty(void) |
30 | 0 | { |
31 | 0 | return true; |
32 | 0 | } |
33 | | |
34 | | /* |
35 | | * system_partitions_set() intentionally left unimplemented. |
36 | | * select CONFIG_SYSTEM_PARTITIONS if you want to set it |
37 | | */ |
38 | | |
39 | | #endif |
40 | | |
41 | | static inline struct file_list *system_partitions_get_null(void) |
42 | 0 | { |
43 | 0 | if (system_partitions_empty()) |
44 | 0 | return NULL; |
45 | 0 | return system_partitions_get(); |
46 | 0 | } |
47 | | |
48 | | #endif |