blob: 1aa868ca224f3a6cd51a1e3074a98fe773d5c96a (
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
|
struct option {
const char *name;
int has_arg;
int *flag;
int val;
};
enum {
UBI_DYNAMIC_VOLUME = 3, UBI_STATIC_VOLUME = 4, };
typedef void * libubi_t;
struct ubi_dev_info {
int leb_size;
};
struct args {
int vol_id;
int vol_type;
long long bytes;
int lebs;
int alignment;
const char *node;
int maxavs;
int devn;
};
static struct args args = {
.vol_type = UBI_DYNAMIC_VOLUME, .bytes = -1, .lebs = -1, .alignment = 1, .vol_id = (-1), .devn = -1, };
extern libubi_t libubi_open (int);
extern int ubi_get_dev_info (libubi_t, const char *, struct ubi_dev_info *);
int main(int argc, char * const argv[]) {
int err;
libubi_t libubi;
struct ubi_dev_info dev_info;
libubi = libubi_open(1);
if (!libubi)
return 0;
err = ubi_get_dev_info(libubi, args.node, &dev_info);
if (args.maxavs) {
args.bytes = dev_info.leb_size;
}
return 0;
}
|