0003-env-add-a-version-number-to-check-API.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From fd8d8242b0ca277c29ffb901e526ed5b40d4e4d3 Mon Sep 17 00:00:00 2001
  2. From: Stefano Babic <sbabic@denx.de>
  3. Date: Sun, 19 Mar 2017 13:00:47 +0100
  4. Subject: [PATCH v1 3/4] env: add a version number to check API
  5. Changes in the environment library are difficult to tracked by programs
  6. using the library. Add simply an API version number that must be
  7. increased each time when the API is changed.
  8. This can be detected and a program can work with different versions of
  9. the library.
  10. Signed-off-by: Stefano Babic <sbabic@denx.de>
  11. ---
  12. tools/env/fw_env.h | 15 +++++++++++++++
  13. 1 file changed, 15 insertions(+)
  14. diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h
  15. index 3e5539d..cf346b3 100644
  16. --- a/tools/env/fw_env.h
  17. +++ b/tools/env/fw_env.h
  18. @@ -8,6 +8,13 @@
  19. #include <stdint.h>
  20. #include <uboot_aes.h>
  21. +/*
  22. + * Programs using the library must check which API is available,
  23. + * that varies depending on the U-Boot version.
  24. + * This can be changed in future
  25. + */
  26. +#define FW_ENV_API_VERSION 1
  27. +
  28. struct env_opts {
  29. #ifdef CONFIG_FILE
  30. char *config_file;
  31. @@ -140,4 +147,12 @@ int fw_env_write(char *name, char *value);
  32. */
  33. int fw_env_close(struct env_opts *opts);
  34. +/**
  35. + * fw_env_version - return the current version of the library
  36. + *
  37. + * Return:
  38. + * version string of the library
  39. + */
  40. +char *fw_env_version(void);
  41. +
  42. unsigned long crc32(unsigned long, const unsigned char *, unsigned);
  43. --
  44. 2.7.4