Discussion:
[dmidecode] [PATCH] dmidecode: Share common EFI code
Jean Delvare
2017-09-26 07:27:28 UTC
Permalink
Avoid duplicating code between OS-specific paths.
---
Alexey, assuming the previous patch works for you, can you please test
this one on top and confirm it doesn't break anything? Thanks.

dmidecode.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

--- dmidecode.orig/dmidecode.c 2017-09-26 09:00:25.799403912 +0200
+++ dmidecode/dmidecode.c 2017-09-26 09:05:05.026038261 +0200
@@ -4946,6 +4946,7 @@ static int address_from_efi(off_t *addre
#elif defined(__FreeBSD__)
char addrstr[KENV_MVALLEN + 1];
#endif
+ const char *eptype;
int ret;

*address = 0; /* Prevent compiler warning */
@@ -4970,9 +4971,7 @@ static int address_from_efi(off_t *addre
|| strcmp(linebuf, "SMBIOS") == 0)
{
*address = strtoull(addrp, NULL, 0);
- if (!(opt.flags & FLAG_QUIET))
- printf("# %s entry point at 0x%08llx\n",
- linebuf, (unsigned long long)*address);
+ eptype = linebuf;
ret = 0;
break;
}
@@ -4997,12 +4996,15 @@ static int address_from_efi(off_t *addre
}

*address = strtoull(addrstr, NULL, 0);
- if (!(opt.flags & FLAG_QUIET))
- printf("# SMBIOS entry point at 0x%08llx\n",
- (unsigned long long)*address);
+ eptype = "SMBIOS";
#else
ret = EFI_NOT_FOUND;
#endif
+
+ if (ret == 0 && !(opt.flags & FLAG_QUIET))
+ printf("# %s entry point at 0x%08llx\n",
+ eptype, (unsigned long long)*address);
+
return ret;
}
--
Jean Delvare
SUSE L3 Support

_______________________________________________
https://lists.nongnu.org/mailman/listinfo/dmidecode-devel
Loading...