Hello community, here is the log from the commit of package grub2 for openSUSE:Factory checked in at 2019-07-16 08:37:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/grub2 (Old) and /work/SRC/openSUSE:Factory/.grub2.new.1887 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "grub2" Tue Jul 16 08:37:40 2019 rev:207 rq:714608 version:2.02 Changes: -------- --- /work/SRC/openSUSE:Factory/grub2/grub2.changes 2019-07-08 15:01:23.494567813 +0200 +++ /work/SRC/openSUSE:Factory/.grub2.new.1887/grub2.changes 2019-07-16 08:37:41.851098322 +0200 @@ -1,0 +2,6 @@ +Mon Jun 24 17:56:12 UTC 2019 - Michal Suchanek <[email protected]> + +- Fix iteration of FCP LUNs (bsc#1134287, bsc#1139345, LTC#177836, LTC#174229). + * Refresh grub2-ieee1275-FCP-methods-for-WWPN-and-LUNs.patch + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ grub2-ieee1275-FCP-methods-for-WWPN-and-LUNs.patch ++++++ --- /var/tmp/diff_new_pack.HHCYPm/_old 2019-07-16 08:37:44.267097560 +0200 +++ /var/tmp/diff_new_pack.HHCYPm/_new 2019-07-16 08:37:44.267097560 +0200 @@ -1,6 +1,6 @@ -From a7a3ad361b4a75d052e9b4389b44a9f3848f3b9f Mon Sep 17 00:00:00 2001 -From: Diego Domingos <[email protected]> -Date: Fri, 10 Aug 2018 16:29:50 -0400 +From 3540ebd05d545ba8f55b0f94983aeb82ad9232f3 Mon Sep 17 00:00:00 2001 +From: Diego Domingos <[email protected]> +Date: Mon, 24 Jun 2019 10:15:56 -0400 Subject: [PATCH] ieee1275: implement FCP methods for WWPN and LUNs This patch enables the fcp-targets and fcp-luns methods which are @@ -9,133 +9,138 @@ Those methods are specially necessary if the boot directory and grub installation are in different FCP disks, allowing the dev_iterate() to find the WWPNs and LUNs when called by searchfs.uuid tool. - -Signed-off-by: Diego Domingos <[email protected]> --- - grub-core/disk/ieee1275/ofdisk.c | 109 ++++++++++++++++++++++++++++++++++++++- - 1 file changed, 108 insertions(+), 1 deletion(-) + grub-core/disk/ieee1275/ofdisk.c | 117 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 116 insertions(+), 1 deletion(-) -Index: grub-2.02/grub-core/disk/ieee1275/ofdisk.c -=================================================================== ---- grub-2.02.orig/grub-core/disk/ieee1275/ofdisk.c -+++ grub-2.02/grub-core/disk/ieee1275/ofdisk.c -@@ -209,7 +209,118 @@ dev_iterate_real (const char *name, cons +diff --git a/grub-core/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c +index 235c0fe..eb907c3 100644 +--- a/grub-core/disk/ieee1275/ofdisk.c ++++ b/grub-core/disk/ieee1275/ofdisk.c +@@ -209,7 +209,122 @@ dev_iterate_real (const char *name, const char *path) static void dev_iterate (const struct grub_ieee1275_devalias *alias) { - if (grub_strcmp (alias->type, "vscsi") == 0) -+ if (grub_strcmp (alias->type, "fcp") == 0){ ++ if (grub_strcmp (alias->type, "fcp") == 0) ++ { + -+ /* If we are dealing with fcp devices, we need -+ * to find the WWPNs and LUNs to iterate them */ -+ grub_ieee1275_ihandle_t ihandle; -+ grub_uint64_t *ptr_targets, *ptr_luns; -+ unsigned int i, j, pos; -+ char *buf, *bufptr; -+ -+ struct set_fcp_targets_args -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t catch_result; -+ grub_ieee1275_cell_t nentries; -+ grub_ieee1275_cell_t table; -+ } args_targets; -+ -+ struct set_fcp_luns_args -+ { -+ struct grub_ieee1275_common_hdr common; -+ grub_ieee1275_cell_t method; -+ grub_ieee1275_cell_t ihandle; -+ grub_ieee1275_cell_t wwpn_h; -+ grub_ieee1275_cell_t wwpn_l; -+ grub_ieee1275_cell_t catch_result; -+ grub_ieee1275_cell_t nentries; -+ grub_ieee1275_cell_t table; -+ } args_luns; -+ -+ if(grub_ieee1275_open (alias->path, &ihandle)) -+ { -+ grub_dprintf("disk", "failed to open the disk while iterating FCP disk path=%s\n", alias->path); -+ return; -+ } -+ -+ INIT_IEEE1275_COMMON (&args_targets.common, "call-method", 2, 3); -+ args_targets.method = (grub_ieee1275_cell_t) "fcp-targets"; -+ args_targets.ihandle = ihandle; -+ args_targets.table = 0; -+ args_targets.nentries = 0; -+ -+ INIT_IEEE1275_COMMON (&args_luns.common, "call-method", 4, 3); -+ args_luns.method = (grub_ieee1275_cell_t) "fcp-luns"; -+ args_luns.ihandle = ihandle; -+ args_luns.table = 0; -+ args_luns.nentries = 0; -+ -+ if (IEEE1275_CALL_ENTRY_FN (&args_targets) == -1) -+ { -+ grub_dprintf("disk", "failed to get the targets while iterating FCP disk path=%s\n", alias->path); -+ grub_ieee1275_close(ihandle); -+ return; -+ } -+ -+ buf = grub_malloc (grub_strlen (alias->path) + 32 + 32); -+ -+ if (!buf) -+ { -+ grub_ieee1275_close(ihandle); -+ return; -+ } -+ -+ bufptr = grub_stpcpy (buf, alias->path); -+ -+ /* For each WWPN discovered we need to find his associated LUNS -+ * calling the fcp-luns method */ -+ for (i=0; i< args_targets.nentries; i++) -+ { -+ ptr_targets = *(grub_uint64_t **) (args_targets.table + 4 + 8 * i); -+ while(*ptr_targets) -+ { -+ args_luns.wwpn_l = (grub_ieee1275_cell_t) (*ptr_targets); -+ args_luns.wwpn_h = (grub_ieee1275_cell_t) (*ptr_targets >> 32); -+ pos=grub_snprintf (bufptr, 32, "/disk@%" PRIxGRUB_UINT64_T, -+ *ptr_targets++); -+ -+ if (IEEE1275_CALL_ENTRY_FN (&args_luns) == -1) -+ { -+ grub_dprintf("disk", "failed to get the LUNS while iterating FCP disk path=%s\n", buf); -+ grub_ieee1275_close (ihandle); -+ grub_free (buf); -+ return; -+ } -+ -+ for(j=0;j<args_luns.nentries; j++) -+ { -+ ptr_luns = *(grub_uint64_t **) (args_luns.table + 4 + 8*j); -+ -+ do -+ { -+ if (*ptr_luns == 0) -+ { -+ dev_iterate_real(buf,buf); -+ ptr_luns++; -+ continue; -+ } -+ grub_snprintf (&bufptr[pos], 30, ",%" PRIxGRUB_UINT64_T, -+ *ptr_luns++); -+ dev_iterate_real(buf,buf); -+ } while(*ptr_luns); -+ } -+ } -+ } -+ -+ grub_ieee1275_close (ihandle); -+ grub_free (buf); -+ return; ++ /* If we are dealing with fcp devices, we need ++ * to find the WWPNs and LUNs to iterate them */ ++ grub_ieee1275_ihandle_t ihandle; ++ grub_uint64_t *ptr_targets, *ptr_luns, k, l; ++ unsigned int i, j, pos; ++ char *buf, *bufptr; ++ ++ struct set_fcp_targets_args ++ { ++ struct grub_ieee1275_common_hdr common; ++ grub_ieee1275_cell_t method; ++ grub_ieee1275_cell_t ihandle; ++ grub_ieee1275_cell_t catch_result; ++ grub_ieee1275_cell_t nentries; ++ grub_ieee1275_cell_t table; ++ } args_targets; ++ ++ struct set_fcp_luns_args ++ { ++ struct grub_ieee1275_common_hdr common; ++ grub_ieee1275_cell_t method; ++ grub_ieee1275_cell_t ihandle; ++ grub_ieee1275_cell_t wwpn_h; ++ grub_ieee1275_cell_t wwpn_l; ++ grub_ieee1275_cell_t catch_result; ++ grub_ieee1275_cell_t nentries; ++ grub_ieee1275_cell_t table; ++ } args_luns; ++ ++ struct args_ret ++ { ++ grub_uint64_t addr; ++ grub_uint64_t len; ++ }; ++ ++ if(grub_ieee1275_open (alias->path, &ihandle)) ++ { ++ grub_dprintf("disk", "failed to open the disk while iterating FCP disk path=%s\n", alias->path); ++ return; ++ } ++ ++ /* Setup the fcp-targets method to call via pfw*/ ++ INIT_IEEE1275_COMMON (&args_targets.common, "call-method", 2, 3); ++ args_targets.method = (grub_ieee1275_cell_t) "fcp-targets"; ++ args_targets.ihandle = ihandle; ++ ++ /* Setup the fcp-luns method to call via pfw */ ++ INIT_IEEE1275_COMMON (&args_luns.common, "call-method", 4, 3); ++ args_luns.method = (grub_ieee1275_cell_t) "fcp-luns"; ++ args_luns.ihandle = ihandle; ++ ++ if (IEEE1275_CALL_ENTRY_FN (&args_targets) == -1) ++ { ++ grub_dprintf("disk", "failed to get the targets while iterating FCP disk path=%s\n", alias->path); ++ grub_ieee1275_close(ihandle); ++ return; ++ } ++ ++ buf = grub_malloc (grub_strlen (alias->path) + 32 + 32); ++ ++ if (!buf) ++ { ++ grub_ieee1275_close(ihandle); ++ return; ++ } ++ ++ bufptr = grub_stpcpy (buf, alias->path); ++ ++ /* Iterate over entries returned by pfw. Each entry contains a ++ * pointer to wwpn table and his length. */ ++ struct args_ret *targets_table = (struct args_ret *)(args_targets.table); ++ for (i=0; i< args_targets.nentries; i++) ++ { ++ ptr_targets = (grub_uint64_t*)(grub_uint32_t) targets_table[i].addr; ++ /* Iterate over all wwpns in given table */ ++ for(k=0;k<targets_table[i].len;k++) ++ { ++ args_luns.wwpn_l = (grub_ieee1275_cell_t) (*ptr_targets); ++ args_luns.wwpn_h = (grub_ieee1275_cell_t) (*ptr_targets >> 32); ++ pos=grub_snprintf (bufptr, 32, "/disk@%" PRIxGRUB_UINT64_T, ++ *ptr_targets++); ++ /* Get the luns for given wwpn target */ ++ if (IEEE1275_CALL_ENTRY_FN (&args_luns) == -1) ++ { ++ grub_dprintf("disk", "failed to get the LUNS while iterating FCP disk path=%s\n", buf); ++ grub_ieee1275_close (ihandle); ++ grub_free (buf); ++ return; ++ } ++ ++ struct args_ret *luns_table = (struct args_ret *)(args_luns.table); ++ ++ /* Iterate over all LUNs */ ++ for(j=0;j<args_luns.nentries; j++) ++ { ++ ptr_luns = (grub_uint64_t*) (grub_uint32_t) luns_table[j].addr; ++ for(l=0;l<luns_table[j].len;l++) ++ { ++ grub_snprintf (&bufptr[pos], 30, ",%" PRIxGRUB_UINT64_T, ++ *ptr_luns++); ++ dev_iterate_real(buf,buf); ++ } ++ } ++ ++ } ++ } ++ ++ grub_ieee1275_close (ihandle); ++ grub_free (buf); ++ return; + + } + else if (grub_strcmp (alias->type, "vscsi") == 0) { static grub_ieee1275_ihandle_t ihandle; struct set_color_args +-- +2.16.4 +
