summaryrefslogtreecommitdiffstats
path: root/include/magicvar.h
blob: d27a2e32a35d0443d170d7c1bb584c985862fedb (plain) (blame)
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
#ifndef __MAGIC_VARS_H
#define __MAGIC_VARS_H

#include <linux/stringify.h>

struct magicvar {
	const char *name;
	const char *description;
};

extern struct magicvar __barebox_magicvar_start;
extern struct magicvar __barebox_magicvar_end;

#ifdef CONFIG_CMD_MAGICVAR_HELP
#define MAGICVAR_DESCRIPTION(d)		(d)
#else
#define MAGICVAR_DESCRIPTION(d)		NULL
#endif

#ifdef CONFIG_CMD_MAGICVAR
#define BAREBOX_MAGICVAR(_name, _description)			\
extern const struct magicvar __barebox_magicvar_##_name;	\
const struct magicvar __barebox_magicvar_##_name		\
        __attribute__ ((unused,section (".barebox_magicvar_" __stringify(_name)))) = {	\
        .name	= #_name,					\
	.description = MAGICVAR_DESCRIPTION(_description),	\
};
#else
#define BAREBOX_MAGICVAR(_name, _description)
#endif

#endif /* __MAGIC_VARS_H */