mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] extlinux: make variable name consistent
Date: Fri, 28 Aug 2026 12:40:59 +0200	[thread overview]
Message-ID: <20260828104059.351647-1-s.hauer@pengutronix.de> (raw)

Throughout the extlinux support the path to an extlinux config file is
used, but the variable is named abspath, configname or just path in
different functions. Consistently name the variable cfgpath for better
readability.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/extlinux.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/common/extlinux.c b/common/extlinux.c
index 92c49ebbce..968ffe68a3 100644
--- a/common/extlinux.c
+++ b/common/extlinux.c
@@ -89,13 +89,13 @@ static void extlinux_entry_free(struct bootentry *entry)
  * Parse extlinux.conf. Only the entry pointed to by the DEFAULT keyword
  * is extracted; all other LABEL sections are ignored.
  */
-static struct extlinux_entry *parse_extlinux_conf(const char *abspath,
+static struct extlinux_entry *parse_extlinux_conf(const char *cfgpath,
 						  const char *rootpath)
 {
 	char *buf, *bufptr, *line, *default_label = NULL;
 	struct extlinux_entry *entry = NULL;
 
-	bufptr = read_file(abspath, NULL);
+	bufptr = read_file(cfgpath, NULL);
 	if (!bufptr)
 		return ERR_PTR(-errno);
 
@@ -124,7 +124,7 @@ static struct extlinux_entry *parse_extlinux_conf(const char *abspath,
 			if (!strcmp(val, default_label)) {
 				entry = xzalloc(sizeof(*entry));
 				entry->label = xstrdup(val);
-				entry->rootpath = dirname(xstrdup(abspath));
+				entry->rootpath = dirname(xstrdup(cfgpath));
 			} else if (entry) {
 				break;
 			}
@@ -161,21 +161,21 @@ static struct extlinux_entry *parse_extlinux_conf(const char *abspath,
 
 static int _extlinux_scan_file(struct bootscanner *scanner,
 			       struct bootentries *bootentries,
-			       const char *configname,
+			       const char *cfgpath,
 			       const char *rootpath)
 {
 	struct extlinux_entry *e;
 
-	if (!strends(configname, "extlinux.conf"))
+	if (!strends(cfgpath, "extlinux.conf"))
 		return 0;
 
-	e = parse_extlinux_conf(configname, rootpath);
+	e = parse_extlinux_conf(cfgpath, rootpath);
 	if (IS_ERR(e))
 		return PTR_ERR(e);
 
 	e->entry.boot = extlinux_boot;
 	e->entry.release = extlinux_entry_free;
-	e->entry.path = xstrdup_const(configname);
+	e->entry.path = xstrdup_const(cfgpath);
 	e->entry.title = basprintf("extlinux: %s", e->label);
 	e->entry.description = basprintf("extlinux entry \'%s\" on %s",
 					 e->label, rootpath);
@@ -188,37 +188,37 @@ static int _extlinux_scan_file(struct bootscanner *scanner,
 
 static int extlinux_scan_file(struct bootscanner *scanner,
 			      struct bootentries *bootentries,
-			      const char *configname)
+			      const char *cfgpath)
 {
-	const char *rootpath = get_mounted_path(configname);
+	const char *rootpath = get_mounted_path(cfgpath);
 
 	if (IS_ERR(rootpath))
 		return PTR_ERR(rootpath);
 
-	return _extlinux_scan_file(scanner, bootentries, configname, rootpath);
+	return _extlinux_scan_file(scanner, bootentries, cfgpath, rootpath);
 }
 
 static int extlinux_scan_directory(struct bootscanner *scanner,
 				   struct bootentries *bootentries,
 				   const char *rootpath)
 {
-	char *path;
+	char *cfgpath;
 	struct stat s;
 	int ret;
 
-	path = basprintf("%s/boot/extlinux/extlinux.conf", rootpath);
-	ret = stat(path, &s);
+	cfgpath = basprintf("%s/boot/extlinux/extlinux.conf", rootpath);
+	ret = stat(cfgpath, &s);
 	if (!ret && S_ISREG(s.st_mode))
-		ret = _extlinux_scan_file(scanner, bootentries, path, rootpath);
-	free(path);
+		ret = _extlinux_scan_file(scanner, bootentries, cfgpath, rootpath);
+	free(cfgpath);
 	if (ret > 0)
 		return ret;
 
-	path = basprintf("%s/extlinux/extlinux.conf", rootpath);
-	ret = stat(path, &s);
+	cfgpath = basprintf("%s/extlinux/extlinux.conf", rootpath);
+	ret = stat(cfgpath, &s);
 	if (!ret && S_ISREG(s.st_mode))
-		ret = _extlinux_scan_file(scanner, bootentries, path, rootpath);
-	free(path);
+		ret = _extlinux_scan_file(scanner, bootentries, cfgpath, rootpath);
+	free(cfgpath);
 
 	return ret;
 }
-- 
2.47.3




             reply	other threads:[~2026-08-28 10:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 10:40 Sascha Hauer [this message]
2026-08-31  7:09 ` 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=20260828104059.351647-1-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