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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2020 Eugeniu Rosca <rosca.eugeniu@gmail.com>
*
* Android Bootloader Control Block Header
*/
#ifndef __BCB_H__
#define __BCB_H__
#include <part.h>
enum bcb_field {
BCB_FIELD_COMMAND,
BCB_FIELD_STATUS,
BCB_FIELD_RECOVERY,
BCB_FIELD_STAGE
};
#if IS_ENABLED(CONFIG_CMD_BCB)
int bcb_find_partition_and_load(const char *iface,
int devnum, char *partp);
int bcb_load(struct blk_desc *block_description,
struct disk_partition *disk_partition);
int bcb_set(enum bcb_field field, const char *value);
/**
* bcb_get() - get the field value.
* @field: field to get
* @value_out: buffer to copy bcb field value to
* @value_size: buffer size to avoid overflow in case
* value_out is smaller then the field value
*/
int bcb_get(enum bcb_field field, char *value_out, size_t value_size);
int bcb_store(void);
void bcb_reset(void);
#else
#include <linux/errno.h>
static inline int bcb_load(struct blk_desc *block_description,
struct disk_partition *disk_partition)
{
return -EOPNOTSUPP;
}
static inline int bcb_find_partition_and_load(const char *iface,
int devnum, char *partp)
{
return -EOPNOTSUPP;
}
static inline int bcb_set(enum bcb_field field, const char *value)
{
return -EOPNOTSUPP;
}
static inline int bcb_get(enum bcb_field field, char *value_out)
{
return -EOPNOTSUPP;
}
static inline int bcb_store(void)
{
return -EOPNOTSUPP;
}
static inline void bcb_reset(void)
{
}
#endif
#endif /* __BCB_H__ */
|