All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 22/39] env: Move env import/export functions to env.h
Date: Sun, 28 Jul 2019 08:03:39 -0600	[thread overview]
Message-ID: <20190728140357.137295-23-sjg@chromium.org> (raw)
In-Reply-To: <20190728140357.137295-1-sjg@chromium.org>

Move these functions to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/env.h         | 38 ++++++++++++++++++++++++++++++++++++++
 include/environment.h | 12 ------------
 2 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/include/env.h b/include/env.h
index 2ba345fc4a..d6718fdf99 100644
--- a/include/env.h
+++ b/include/env.h
@@ -12,6 +12,8 @@
 #include <stdbool.h>
 #include <linux/types.h>
 
+struct environment_s;
+
 /**
  * env_get_id() - Gets a sequence number for the environment
  *
@@ -230,4 +232,40 @@ int env_save(void);
  */
 int env_erase(void);
 
+/**
+ * env_import() - Import from a binary representation into hash table
+ *
+ * This imports the environment from a buffer. THe format for each variable is
+ * var=value\0 with a double \0 at the end of the buffer.
+ *
+ * @buf: Buffer containing the environment (struct environemnt_s *)
+ * @check: non-zero to check the CRC at the start of the environment, 0 to
+ *	ignore it
+ * @return 0 if imported successfully, -ENOMSG if the CRC was bad, -EIO if
+ *	something else went wrong
+ */
+int env_import(const char *buf, int check);
+
+/**
+ * env_export() - Export the environment to a buffer
+ *
+ * Export from hash table into binary representation
+ *
+ * @env_out: Buffer to contain the environment (must be large enough!)
+ * @return 0 if OK, 1 on error
+ */
+int env_export(struct environment_s *env_out);
+
+/**
+ * env_import_redund() - Select and import one of two redundant environments
+ *
+ * @buf1: First environment (struct environemnt_s *)
+ * @buf1_read_fail: 0 if buf1 is valid, non-zero if invalid
+ * @buf2: Second environment (struct environemnt_s *)
+ * @buf2_read_fail: 0 if buf2 is valid, non-zero if invalid
+ * @return 0 if OK, -EIO if no environment is valid, -ENOMSG if the CRC was bad
+ */
+int env_import_redund(const char *buf1, int buf1_read_fail,
+		      const char *buf2, int buf2_read_fail);
+
 #endif
diff --git a/include/environment.h b/include/environment.h
index b921b8f28e..c740d5a216 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -274,18 +274,6 @@ char *env_get_default(const char *name);
 /* [re]set to the default environment */
 void set_default_env(const char *s, int flags);
 
-/* Import from binary representation into hash table */
-int env_import(const char *buf, int check);
-
-/* Export from hash table into binary representation */
-int env_export(env_t *env_out);
-
-#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
-/* Select and import one of two redundant environments */
-int env_import_redund(const char *buf1, int buf1_status,
-		      const char *buf2, int buf2_status);
-#endif
-
 /**
  * env_get_char() - Get a character from the early environment
  *
-- 
2.22.0.709.g102302147b-goog

  parent reply	other threads:[~2019-07-28 14:03 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-28 14:03 [U-Boot] [PATCH 00/39] env: common: Remove environment definitions from common.h Simon Glass
2019-07-28 14:03 ` [U-Boot] [PATCH 01/39] common: Move gzip functions into a new gzip header Simon Glass
2019-07-28 14:03 ` [U-Boot] [PATCH 02/39] common: Drop the dpram_... functions Simon Glass
2019-07-28 14:03 ` [U-Boot] [PATCH 03/39] common: Move lcd_setmem() to lcd.h Simon Glass
2019-07-28 14:03 ` [U-Boot] [PATCH 04/39] common: Remove video_setmem() Simon Glass
2019-07-28 14:03 ` [U-Boot] [PATCH 05/39] env: Create a new file for environment functions Simon Glass
2019-07-30 20:52   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 06/39] env: Move get_env_id() to env.h Simon Glass
2019-07-30 20:51   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 07/39] env: Move env_get_f() " Simon Glass
2019-07-30 20:50   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 08/39] env: Move env_init() " Simon Glass
2019-07-30 20:53   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 09/39] env: Move env_relocate() " Simon Glass
2019-07-30 20:48   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 10/39] env: Move envmatch() " Simon Glass
2019-07-30 21:02   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 11/39] env: Move env_set_hex() " Simon Glass
2019-07-30 20:49   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 12/39] env: Move env_set_ulong() " Simon Glass
2019-07-30 21:05   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 13/39] env: Move env_get_ulong() " Simon Glass
2019-07-30 20:54   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 14/39] env: Move env_get_yesno() " Simon Glass
2019-07-30 20:49   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 15/39] env: Move env_get_hex() " Simon Glass
2019-07-30 20:49   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 16/39] env: Move env_set() " Simon Glass
2019-07-30 21:19   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 17/39] env: Move env_get() " Simon Glass
2019-07-30 21:04   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 18/39] env: Move eth_env_get/set_enetaddr() " Simon Glass
2019-07-30 20:55   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 19/39] env: Move uncommon functions " Simon Glass
2019-07-30 21:01   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 20/39] env: Move set_default_vars " Simon Glass
2019-07-30 20:59   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 21/39] env: Move env_load/save functions " Simon Glass
2019-07-30 20:57   ` Joe Hershberger
2019-07-28 14:03 ` Simon Glass [this message]
2019-07-30 20:58   ` [U-Boot] [PATCH 22/39] env: Move env import/export " Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 23/39] env: Drop env_crc_update() Simon Glass
2019-07-30 21:21   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 24/39] env: Move get/set_default_env() to env.h Simon Glass
2019-07-30 20:54   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 25/39] env: Move env_get_char() " Simon Glass
2019-07-30 21:21   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 26/39] env: Move env_reloc() " Simon Glass
2019-07-30 21:22   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 27/39] env: Rename environment to embedded_environment Simon Glass
2019-07-30 21:22   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 28/39] env: Move env_valid to env.h Simon Glass
2019-07-30 20:56   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 29/39] env: Move callback definitions " Simon Glass
2019-07-30 21:28   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 30/39] env: Drop the ENTRY typdef Simon Glass
2019-07-30 21:16   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 31/39] env: Drop _ENTRY Simon Glass
2019-07-30 21:35   ` Joe Hershberger
2019-07-31 20:57     ` Simon Glass
2019-07-31 21:07       ` Joe Hershberger
2019-07-31 21:55         ` Simon Glass
2019-07-31 22:03           ` Joe Hershberger
2019-08-02 14:07             ` Simon Glass
2019-07-28 14:03 ` [U-Boot] [PATCH 32/39] env: Rename the redundancy flags Simon Glass
2019-07-30 21:49   ` Joe Hershberger
2019-07-31 21:00     ` Simon Glass
2019-07-31 21:20       ` Joe Hershberger
2019-08-01  0:52         ` Tom Rini
2019-08-01  0:55           ` Joe Hershberger
2019-08-01 23:04             ` Tom Rini
2019-07-28 14:03 ` [U-Boot] [PATCH 33/39] env: Drop the ACTION typedef Simon Glass
2019-07-30 21:13   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 34/39] env: Drop the double underscores in search.h Simon Glass
2019-07-30 21:29   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 35/39] env: Move TOTAL_MALLOC_LEN to environment.h Simon Glass
2019-07-30 21:14   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 36/39] env: Drop environment.h header file where not needed Simon Glass
2019-07-30 21:20   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 37/39] env: Rename environment.h to env_internal.h Simon Glass
2019-07-30 21:02   ` Joe Hershberger
2019-07-28 14:03 ` [U-Boot] [PATCH 38/39] Drop PCMCIA Simon Glass
2019-07-28 14:03 ` [U-Boot] [PATCH 39/39] common: Add a note about the effort to reduce common.h Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190728140357.137295-23-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.