diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-03-07 09:24:40 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-03-07 09:24:40 +0100 |
commit | 4df69d0b6e79a6c0633921117803802c24020cc3 (patch) | |
tree | 6bc294cb3eb8769fe584c72a63d5630999838c47 /include | |
parent | fbf087808b55b542101654fe838c2db131aa9660 (diff) | |
parent | 66a1d213e04748a77170374c35f21f5b176837de (diff) | |
download | barebox-4df69d0b6e79a6c0633921117803802c24020cc3.tar.gz barebox-4df69d0b6e79a6c0633921117803802c24020cc3.tar.xz |
Merge branch 'for-next/env'
Diffstat (limited to 'include')
-rw-r--r-- | include/envfs.h | 36 | ||||
-rw-r--r-- | include/filetype.h | 1 | ||||
-rw-r--r-- | include/usb/dfu.h | 3 |
3 files changed, 37 insertions, 3 deletions
diff --git a/include/envfs.h b/include/envfs.h index f8b24eda39..ae98808ede 100644 --- a/include/envfs.h +++ b/include/envfs.h @@ -3,6 +3,7 @@ #ifdef __BAREBOX__ #include <asm/byteorder.h> +#include <linux/stringify.h> #endif #define ENVFS_MAJOR 1 @@ -90,8 +91,9 @@ struct envfs_super { #endif #define ENV_FLAG_NO_OVERWRITE (1 << 0) -int envfs_load(const char *filename, char *dirname, unsigned flags); -int envfs_save(const char *filename, char *dirname); +int envfs_load(const char *filename, const char *dirname, unsigned flags); +int envfs_save(const char *filename, const char *dirname); +int envfs_load_from_buf(void *buf, int len, const char *dir, unsigned flags); /* defaults to /dev/env0 */ #ifdef CONFIG_ENV_HANDLING @@ -110,4 +112,34 @@ static inline char *default_environment_path_get(void) int envfs_register_partition(const char *devname, unsigned int partnr); +#ifdef CONFIG_DEFAULT_ENVIRONMENT +void defaultenv_append(void *buf, unsigned int size, const char *name); +int defaultenv_load(const char *dir, unsigned flags); +#else +static inline void defaultenv_append(void *buf, unsigned int size, const char *name) +{ +} + +static inline int defaultenv_load(const char *dir, unsigned flags) +{ + return -ENOSYS; +} +#endif + +/* + * Append environment directory compiled into barebox with bbenv-y + * to the default environment. The symbol is generated from the filename + * during the build process. Replace '-' with '_' to get the name + * from the filename. + */ +#define defaultenv_append_directory(name) \ + { \ + extern char __bbenv_##name##_start[]; \ + extern char __bbenv_##name##_end[]; \ + defaultenv_append(__bbenv_##name##_start, \ + __bbenv_##name##_end - \ + __bbenv_##name##_start, \ + __stringify(name)); \ + } + #endif /* _ENVFS_H */ diff --git a/include/filetype.h b/include/filetype.h index ffefe1c905..c20a4f9395 100644 --- a/include/filetype.h +++ b/include/filetype.h @@ -29,6 +29,7 @@ enum filetype { filetype_gpt, filetype_ubifs, filetype_bpk, + filetype_barebox_env, filetype_max, }; diff --git a/include/usb/dfu.h b/include/usb/dfu.h index 698ba9d5a1..df4f2fd4d6 100644 --- a/include/usb/dfu.h +++ b/include/usb/dfu.h @@ -22,8 +22,9 @@ #include <linux/types.h> -#define DFU_FLAG_SAVE (1 << 0) +#define DFU_FLAG_SAFE (1 << 0) #define DFU_FLAG_READBACK (1 << 1) +#define DFU_FLAG_CREATE (1 << 2) struct usb_dfu_dev { char *name; |