]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
env: Create a new file for environment functions
authorSimon Glass <sjg@chromium.org>
Thu, 1 Aug 2019 15:46:40 +0000 (09:46 -0600)
committerTom Rini <trini@konsulko.com>
Sun, 11 Aug 2019 20:43:41 +0000 (16:43 -0400)
At present we have environment.h but this file includes all the
environment-related header files as well as internals such as
default_environment.

It seems desirable to have a new header to hold the commonly used
environment functions, so that most files can avoid including all of this
unnecessary stuff.

Create a new env.h header and move one function over to it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
common/command.c
include/common.h
include/env.h [new file with mode: 0644]

index db25bf54e0598858559565f475d3d530e105733d..4b887a267fb6d82d3cd827fe1558cf0b087a5c54 100644 (file)
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <command.h>
 #include <console.h>
+#include <env.h>
 #include <linux/ctype.h>
 
 /*
index 4d0dd3f1b700fdcea75d28736ac5ad9c95adaddc..6b890470c1c24ea7ec6b62ce9917e2ff853e3889 100644 (file)
@@ -247,10 +247,6 @@ static inline int env_set_addr(const char *varname, const void *addr)
        return env_set_hex(varname, (ulong)addr);
 }
 
-#ifdef CONFIG_AUTO_COMPLETE
-int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf,
-                bool dollar_comp);
-#endif
 int get_env_id (void);
 
 void   pci_init_board(void);
diff --git a/include/env.h b/include/env.h
new file mode 100644 (file)
index 0000000..157ee9b
--- /dev/null
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Common environment functions
+ *
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ */
+
+#ifndef __ENV_H
+#define __ENV_H
+
+#include <stdbool.h>
+
+/**
+ * env_complete() - return an auto-complete for environment variables
+ *
+ * @var: partial name to auto-complete
+ * @maxv: Maximum number of matches to return
+ * @cmdv: Returns a list of possible matches
+ * @maxsz: Size of buffer to use for matches
+ * @buf: Buffer to use for matches
+ * @dollar_comp: non-zero to wrap each match in ${...}
+ * @return number of matches found (in @cmdv)
+ */
+int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf,
+                bool dollar_comp);
+
+#endif