From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 10/18] blspec: Make blspec_boot static
Date: Fri, 22 Jul 2016 14:44:24 +0200 [thread overview]
Message-ID: <1469191472-14491-11-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1469191472-14491-1-git-send-email-s.hauer@pengutronix.de>
Since blspec_boot is now only used locally we can make it static. Move
it up to avoid a static declaration.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/blspec.c | 156 +++++++++++++++++++++++++++----------------------------
include/blspec.h | 2 -
2 files changed, 78 insertions(+), 80 deletions(-)
diff --git a/common/blspec.c b/common/blspec.c
index aa70685..6c963df 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -43,6 +43,84 @@ int blspec_entry_var_set(struct blspec_entry *entry, const char *name,
}
/*
+ * blspec_boot - boot an entry
+ *
+ * This boots an entry. On success this function does not return.
+ * In case of an error the error code is returned. This function may
+ * return 0 in case of a succesful dry run.
+ */
+static int blspec_boot(struct bootentry *be, int verbose, int dryrun)
+{
+ struct blspec_entry *entry = container_of(be, struct blspec_entry, entry);
+ int ret;
+ const char *abspath, *devicetree, *options, *initrd, *linuximage;
+ const char *appendroot;
+ struct bootm_data data = {
+ .initrd_address = UIMAGE_INVALID_ADDRESS,
+ .os_address = UIMAGE_SOME_ADDRESS,
+ .verbose = verbose,
+ .dryrun = dryrun,
+ };
+
+ globalvar_set_match("linux.bootargs.dyn.", "");
+ globalvar_set_match("bootm.", "");
+
+ devicetree = blspec_entry_var_get(entry, "devicetree");
+ initrd = blspec_entry_var_get(entry, "initrd");
+ options = blspec_entry_var_get(entry, "options");
+ linuximage = blspec_entry_var_get(entry, "linux");
+
+ if (entry->rootpath)
+ abspath = entry->rootpath;
+ else
+ abspath = "";
+
+ data.os_file = basprintf("%s/%s", abspath, linuximage);
+
+ if (devicetree) {
+ if (!strcmp(devicetree, "none")) {
+ struct device_node *node = of_get_root_node();
+ if (node)
+ of_delete_node(node);
+ } else {
+ data.oftree_file = basprintf("%s/%s", abspath,
+ devicetree);
+ }
+ }
+
+ if (initrd)
+ data.initrd_file = basprintf("%s/%s", abspath, initrd);
+
+ globalvar_add_simple("linux.bootargs.dyn.bootentries", options);
+
+ appendroot = blspec_entry_var_get(entry, "linux-appendroot");
+ if (appendroot) {
+ int val;
+
+ ret = strtobool(appendroot, &val);
+ if (ret) {
+ pr_err("Invalid value \"%s\" for appendroot option\n",
+ appendroot);
+ goto err_out;
+ }
+ data.appendroot = val;
+ }
+
+ pr_info("booting %s from %s\n", blspec_entry_var_get(entry, "title"),
+ entry->cdev ? dev_name(entry->cdev->dev) : "none");
+
+ ret = bootm_boot(&data);
+ if (ret)
+ pr_err("Booting failed\n");
+err_out:
+ free((char *)data.oftree_file);
+ free((char *)data.initrd_file);
+ free((char *)data.os_file);
+
+ return ret;
+}
+
+/*
* blspec_entry_var_get - get the value of a variable
*/
const char *blspec_entry_var_get(struct blspec_entry *entry, const char *name)
@@ -653,81 +731,3 @@ int blspec_scan_devicename(struct bootentries *bootentries, const char *devname)
return blspec_scan_device(bootentries, dev);
}
-
-/*
- * blspec_boot - boot an entry
- *
- * This boots an entry. On success this function does not return.
- * In case of an error the error code is returned. This function may
- * return 0 in case of a succesful dry run.
- */
-int blspec_boot(struct bootentry *be, int verbose, int dryrun)
-{
- struct blspec_entry *entry = container_of(be, struct blspec_entry, entry);
- int ret;
- const char *abspath, *devicetree, *options, *initrd, *linuximage;
- const char *appendroot;
- struct bootm_data data = {
- .initrd_address = UIMAGE_INVALID_ADDRESS,
- .os_address = UIMAGE_SOME_ADDRESS,
- .verbose = verbose,
- .dryrun = dryrun,
- };
-
- globalvar_set_match("linux.bootargs.dyn.", "");
- globalvar_set_match("bootm.", "");
-
- devicetree = blspec_entry_var_get(entry, "devicetree");
- initrd = blspec_entry_var_get(entry, "initrd");
- options = blspec_entry_var_get(entry, "options");
- linuximage = blspec_entry_var_get(entry, "linux");
-
- if (entry->rootpath)
- abspath = entry->rootpath;
- else
- abspath = "";
-
- data.os_file = basprintf("%s/%s", abspath, linuximage);
-
- if (devicetree) {
- if (!strcmp(devicetree, "none")) {
- struct device_node *node = of_get_root_node();
- if (node)
- of_delete_node(node);
- } else {
- data.oftree_file = basprintf("%s/%s", abspath,
- devicetree);
- }
- }
-
- if (initrd)
- data.initrd_file = basprintf("%s/%s", abspath, initrd);
-
- globalvar_add_simple("linux.bootargs.dyn.bootentries", options);
-
- appendroot = blspec_entry_var_get(entry, "linux-appendroot");
- if (appendroot) {
- int val;
-
- ret = strtobool(appendroot, &val);
- if (ret) {
- pr_err("Invalid value \"%s\" for appendroot option\n",
- appendroot);
- goto err_out;
- }
- data.appendroot = val;
- }
-
- pr_info("booting %s from %s\n", blspec_entry_var_get(entry, "title"),
- entry->cdev ? dev_name(entry->cdev->dev) : "none");
-
- ret = bootm_boot(&data);
- if (ret)
- pr_err("Booting failed\n");
-err_out:
- free((char *)data.oftree_file);
- free((char *)data.initrd_file);
- free((char *)data.os_file);
-
- return ret;
-}
diff --git a/include/blspec.h b/include/blspec.h
index 7a16ae7..8a79df5 100644
--- a/include/blspec.h
+++ b/include/blspec.h
@@ -31,8 +31,6 @@ int blspec_entry_var_set(struct blspec_entry *entry, const char *name,
const char *val);
const char *blspec_entry_var_get(struct blspec_entry *entry, const char *name);
-int blspec_boot(struct bootentry *entry, int verbose, int dryrun);
-
int blspec_scan_devices(struct bootentries *bootentries);
int blspec_scan_device(struct bootentries *bootentries, struct device_d *dev);
--
2.8.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-07-22 12:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 12:44 Sascha Hauer
2016-07-22 12:44 ` [PATCH 01/18] blspec: remove unused blspec_boot_devicename Sascha Hauer
2016-07-22 12:44 ` [PATCH 02/18] blspec: Remove once/default handling Sascha Hauer
2016-07-22 12:44 ` [PATCH 03/18] blspec: remove unused function prototype Sascha Hauer
2016-07-22 12:44 ` [PATCH 04/18] boot: Call blspec_scan_directory() only on strings containing an absolute path Sascha Hauer
2016-07-22 12:44 ` [PATCH 05/18] include: Move bulk of boot.h to bootm.h Sascha Hauer
2016-07-22 12:44 ` [PATCH 06/18] blpec: rename struct lspec -> bootentries Sascha Hauer
2016-07-22 12:44 ` [PATCH 07/18] blspec: factor out a struct bootentry Sascha Hauer
2016-07-22 12:44 ` [PATCH 08/18] bootentries: Add title/description Sascha Hauer
2016-07-22 12:44 ` [PATCH 09/18] blspec: separate bootentries from blspec entries Sascha Hauer
2016-07-22 12:44 ` Sascha Hauer [this message]
2016-07-22 12:44 ` [PATCH 11/18] bootentries: Move menu display string allocation to bootentries_alloc() Sascha Hauer
2016-07-22 12:44 ` [PATCH 12/18] bootentries: Move struct bootentries to include/boot.h Sascha Hauer
2016-07-22 12:44 ` [PATCH 13/18] boot: Use struct bootentries to pass around data Sascha Hauer
2016-07-22 12:44 ` [PATCH 14/18] boot: Move code to common/ Sascha Hauer
2016-07-22 12:44 ` [PATCH 15/18] boot: add single quotes when printing boot target names Sascha Hauer
2016-07-22 12:44 ` [PATCH 16/18] boot command: Explicitly complain when boot target list is empty Sascha Hauer
2016-07-22 12:44 ` [PATCH 17/18] blspec: Turn message back to debug level Sascha Hauer
2016-07-22 12:44 ` [PATCH 18/18] boot: Print a message when a boot target string does not lead to a boot target Sascha Hauer
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=1469191472-14491-11-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox