From: Avnish Chouhan <avnish@linux.ibm.com>
To: grub-devel@gnu.org
Cc: daniel.kiper@oracle.com, brking@linux.ibm.com,
meghanaprakash@in.ibm.com, mchang@suse.com,
Avnish Chouhan <avnish@linux.ibm.com>,
Diego Domingos <diegodo@br.ibm.com>
Subject: [PATCH v6 3/6] ieee1275: change the logic of ieee1275_get_devargs()
Date: Wed, 30 Jul 2025 11:04:02 +0530 [thread overview]
Message-ID: <20250730053405.41417-4-avnish@linux.ibm.com> (raw)
In-Reply-To: <20250730053405.41417-1-avnish@linux.ibm.com>
Usually grub will parse the PFW arguments by searching for the first occurence of the character ':'.
However, we can have this char more than once on NQN.
This patch changes the logic to find the last occurence of this char so we can get the proper values
for NVMeoFC
Signed-off-by: Diego Domingos <diegodo@br.ibm.com>
Signed-off-by: Avnish Chouhan <avnish@linux.ibm.com>
---
grub-core/kern/ieee1275/openfw.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
index 0278054..b97104c 100644
--- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c
@@ -324,7 +324,7 @@ grub_claimmap (grub_addr_t addr, grub_size_t size)
static char *
grub_ieee1275_get_devargs (const char *path)
{
- char *colon = grub_strchr (path, ':');
+ char *colon = grub_strrchr (path, ':');
if (! colon)
return 0;
@@ -339,6 +339,21 @@ grub_ieee1275_get_devname (const char *path)
char *colon = grub_strchr (path, ':');
int pathlen = grub_strlen (path);
struct grub_ieee1275_devalias curalias;
+
+ /* Check some special cases */
+ if (grub_strstr (path, "nvme-of"))
+ {
+ char *namespace_split = grub_strstr (path, "/namespace@");
+ if (namespace_split)
+ {
+ colon = grub_strchr (namespace_split, ':');
+ }
+ else
+ {
+ colon = NULL;
+ }
+ }
+
if (colon)
pathlen = (int)(colon - path);
@@ -579,7 +594,7 @@ grub_ieee1275_get_boot_dev (void)
return NULL;
}
- bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
+ bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64 + 256);
if (! bootpath)
{
grub_print_error ();
--
2.31.1
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2025-07-30 5:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 5:33 [PATCH v6 0/6] NVMeoFC support on Grub Avnish Chouhan
2025-07-30 5:34 ` [PATCH v6 1/6] ieee1275/powerpc: implements fibre channel discovery for ofpathname Avnish Chouhan
2025-07-30 5:34 ` [PATCH v6 2/6] ieee1275: implement FCP methods for WWPN and LUNs Avnish Chouhan
2025-07-30 5:34 ` Avnish Chouhan [this message]
2025-07-30 5:34 ` [PATCH v6 4/6] ieee1275: add support for NVMeoFC Avnish Chouhan
2025-07-30 5:34 ` [PATCH v6 5/6] ieee1275: ofpath enable NVMeoF logical device translate Avnish Chouhan
2025-07-30 5:34 ` [PATCH v6 6/6] ieee1275: support added for multiple nvme bootpaths Avnish Chouhan
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=20250730053405.41417-4-avnish@linux.ibm.com \
--to=avnish@linux.ibm.com \
--cc=brking@linux.ibm.com \
--cc=daniel.kiper@oracle.com \
--cc=diegodo@br.ibm.com \
--cc=grub-devel@gnu.org \
--cc=mchang@suse.com \
--cc=meghanaprakash@in.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).