Compare commits
No commits in common. "c9s" and "c8" have entirely different histories.
1
.efivar.metadata
Normal file
1
.efivar.metadata
Normal file
@ -0,0 +1 @@
|
|||||||
|
1ef24e0a06e1a42d7a93ba7a76b2970659c7c0c0 SOURCES/efivar-37.tar.bz2
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,6 +1 @@
|
|||||||
*.tar.*
|
SOURCES/efivar-37.tar.bz2
|
||||||
clog
|
|
||||||
*.rpm
|
|
||||||
efivar-*/
|
|
||||||
bodhi.template
|
|
||||||
.build*.log
|
|
||||||
|
33
SOURCES/0001-util.h-add-unlikely-and-likely-macros.patch
Normal file
33
SOURCES/0001-util.h-add-unlikely-and-likely-macros.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From 9a35c81ba28788831a003c071a96acfab81ca354 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 7 Jan 2019 10:30:23 -0500
|
||||||
|
Subject: [PATCH 01/63] util.h: add unlikely() and likely() macros
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/util.h | 9 +++++++++
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/util.h b/src/util.h
|
||||||
|
index f63a8907611..ba8fee35ae9 100644
|
||||||
|
--- a/src/util.h
|
||||||
|
+++ b/src/util.h
|
||||||
|
@@ -52,6 +52,15 @@
|
||||||
|
#define PACKED __attribute__((__packed__))
|
||||||
|
#define VERSION(sym, ver) __asm__(".symver " # sym "," # ver)
|
||||||
|
|
||||||
|
+#define __branch_check__(x, expect, is_constant) \
|
||||||
|
+ __builtin_expect(!!(x), expect)
|
||||||
|
+#ifndef likely
|
||||||
|
+#define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x)))
|
||||||
|
+#endif
|
||||||
|
+#ifndef unlikely
|
||||||
|
+#define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* I'm not actually sure when these appear, but they're present in the
|
||||||
|
* version in front of me.
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,59 @@
|
|||||||
|
From 945a87340240b70b3c579773c9481ca913d95a92 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 7 Jan 2019 10:30:59 -0500
|
||||||
|
Subject: [PATCH 02/63] dp.h: make format_guid() handle misaligned guid
|
||||||
|
pointers safely.
|
||||||
|
|
||||||
|
GCC 9 adds -Werror=address-of-packed-member, which causes us to see the
|
||||||
|
build error reported at
|
||||||
|
https://bugzilla.opensuse.org/show_bug.cgi?id=1120862 .
|
||||||
|
|
||||||
|
That bug report shows us the following:
|
||||||
|
|
||||||
|
In file included from dp.c:26:
|
||||||
|
dp.h: In function 'format_vendor_helper':
|
||||||
|
dp.h:120:37: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
|
||||||
|
120 | format_guid(buf, size, off, label, &dp->hw_vendor.vendor_guid);
|
||||||
|
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
dp.h:74:25: note: in definition of macro 'format_guid'
|
||||||
|
74 | _rc = efi_guid_to_str(guid, &_guidstr); \
|
||||||
|
| ^~~~
|
||||||
|
cc1: all warnings being treated as errors
|
||||||
|
|
||||||
|
This patch makes format_guid() use a local variable as a bounce buffer
|
||||||
|
in the case that the guid we're passed is aligned as chaotic neutral.
|
||||||
|
|
||||||
|
Note that this only fixes this instance and there may be others that bz
|
||||||
|
didn't show because it exited too soon, and I don't have a gcc 9 build
|
||||||
|
in front of me right now.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/dp.h | 11 +++++++++--
|
||||||
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dp.h b/src/dp.h
|
||||||
|
index aa4e3902992..20cb608d05f 100644
|
||||||
|
--- a/src/dp.h
|
||||||
|
+++ b/src/dp.h
|
||||||
|
@@ -70,8 +70,15 @@
|
||||||
|
#define format_guid(buf, size, off, dp_type, guid) ({ \
|
||||||
|
int _rc; \
|
||||||
|
char *_guidstr = NULL; \
|
||||||
|
- \
|
||||||
|
- _rc = efi_guid_to_str(guid, &_guidstr); \
|
||||||
|
+ efi_guid_t _guid; \
|
||||||
|
+ const efi_guid_t * const _guid_p = \
|
||||||
|
+ likely(__alignof__(guid) == sizeof(guid)) \
|
||||||
|
+ ? guid \
|
||||||
|
+ : &_guid; \
|
||||||
|
+ \
|
||||||
|
+ if (unlikely(__alignof__(guid) == sizeof(guid))) \
|
||||||
|
+ memmove(&_guid, guid, sizeof(_guid)); \
|
||||||
|
+ _rc = efi_guid_to_str(_guid_p, &_guidstr); \
|
||||||
|
if (_rc < 0) { \
|
||||||
|
efi_error("could not build %s GUID DP string", \
|
||||||
|
dp_type); \
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
From 8c9cb884ebdc79bb69df13f2bfdf99543233588f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 7 Jan 2019 11:32:41 -0500
|
||||||
|
Subject: [PATCH 03/63] linux-pci-root: remove an unused assignment
|
||||||
|
|
||||||
|
scan-build gripes about this, and it's pointless, so it can go.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/linux-pci-root.c | 1 -
|
||||||
|
1 file changed, 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/linux-pci-root.c b/src/linux-pci-root.c
|
||||||
|
index a2d9fb04a11..5d1df06119d 100644
|
||||||
|
--- a/src/linux-pci-root.c
|
||||||
|
+++ b/src/linux-pci-root.c
|
||||||
|
@@ -115,7 +115,6 @@ dp_create_pci_root(struct device *dev UNUSED,
|
||||||
|
return new;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- off += new;
|
||||||
|
sz += new;
|
||||||
|
|
||||||
|
debug("returning %zd", sz);
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,172 @@
|
|||||||
|
From d1955bdfb19829221e2b6294bba256c5447677ac Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Thu, 21 Feb 2019 15:20:12 -0500
|
||||||
|
Subject: [PATCH 04/63] Fix all the places -Werror=address-of-packed-member
|
||||||
|
catches.
|
||||||
|
|
||||||
|
This gets rid of all the places GCC 9's -Werror=address-of-packed-member
|
||||||
|
flags as problematic.
|
||||||
|
|
||||||
|
Fixes github issue #123
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/dp-message.c | 6 ++++--
|
||||||
|
src/dp.h | 12 ++++--------
|
||||||
|
src/guid.c | 2 +-
|
||||||
|
src/include/efivar/efivar.h | 2 +-
|
||||||
|
src/ucs2.h | 27 +++++++++++++++++++--------
|
||||||
|
5 files changed, 29 insertions(+), 20 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dp-message.c b/src/dp-message.c
|
||||||
|
index 3724e5f57bd..9f964663de8 100644
|
||||||
|
--- a/src/dp-message.c
|
||||||
|
+++ b/src/dp-message.c
|
||||||
|
@@ -620,11 +620,13 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
) / sizeof(efi_ip_addr_t);
|
||||||
|
format(buf, size, off, "Dns", "Dns(");
|
||||||
|
for (int i=0; i < end; i++) {
|
||||||
|
- const efi_ip_addr_t *addr = &dp->dns.addrs[i];
|
||||||
|
+ efi_ip_addr_t addr;
|
||||||
|
+
|
||||||
|
+ memcpy(&addr, &dp->dns.addrs[i], sizeof(addr));
|
||||||
|
if (i != 0)
|
||||||
|
format(buf, size, off, "Dns", ",");
|
||||||
|
format_ip_addr(buf, size, off, "Dns",
|
||||||
|
- dp->dns.is_ipv6, addr);
|
||||||
|
+ dp->dns.is_ipv6, &addr);
|
||||||
|
}
|
||||||
|
format(buf, size, off, "Dns", ")");
|
||||||
|
break;
|
||||||
|
diff --git a/src/dp.h b/src/dp.h
|
||||||
|
index 20cb608d05f..1f921d524aa 100644
|
||||||
|
--- a/src/dp.h
|
||||||
|
+++ b/src/dp.h
|
||||||
|
@@ -71,13 +71,9 @@
|
||||||
|
int _rc; \
|
||||||
|
char *_guidstr = NULL; \
|
||||||
|
efi_guid_t _guid; \
|
||||||
|
- const efi_guid_t * const _guid_p = \
|
||||||
|
- likely(__alignof__(guid) == sizeof(guid)) \
|
||||||
|
- ? guid \
|
||||||
|
- : &_guid; \
|
||||||
|
- \
|
||||||
|
- if (unlikely(__alignof__(guid) == sizeof(guid))) \
|
||||||
|
- memmove(&_guid, guid, sizeof(_guid)); \
|
||||||
|
+ const efi_guid_t * const _guid_p = &_guid; \
|
||||||
|
+ \
|
||||||
|
+ memmove(&_guid, guid, sizeof(_guid)); \
|
||||||
|
_rc = efi_guid_to_str(_guid_p, &_guidstr); \
|
||||||
|
if (_rc < 0) { \
|
||||||
|
efi_error("could not build %s GUID DP string", \
|
||||||
|
@@ -86,7 +82,7 @@
|
||||||
|
_guidstr = onstack(_guidstr, \
|
||||||
|
strlen(_guidstr)+1); \
|
||||||
|
_rc = format(buf, size, off, dp_type, "%s", \
|
||||||
|
- _guidstr); \
|
||||||
|
+ _guidstr); \
|
||||||
|
} \
|
||||||
|
_rc; \
|
||||||
|
})
|
||||||
|
diff --git a/src/guid.c b/src/guid.c
|
||||||
|
index 306c9ff8287..3156b3b7c60 100644
|
||||||
|
--- a/src/guid.c
|
||||||
|
+++ b/src/guid.c
|
||||||
|
@@ -31,7 +31,7 @@
|
||||||
|
extern const efi_guid_t efi_guid_zero;
|
||||||
|
|
||||||
|
int NONNULL(1, 2) PUBLIC
|
||||||
|
-efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b)
|
||||||
|
+efi_guid_cmp(const void * const a, const void * const b)
|
||||||
|
{
|
||||||
|
return memcmp(a, b, sizeof (efi_guid_t));
|
||||||
|
}
|
||||||
|
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
|
||||||
|
index 316891ccae9..ad6449d9d93 100644
|
||||||
|
--- a/src/include/efivar/efivar.h
|
||||||
|
+++ b/src/include/efivar/efivar.h
|
||||||
|
@@ -128,7 +128,7 @@ extern int efi_symbol_to_guid(const char *symbol, efi_guid_t *guid)
|
||||||
|
|
||||||
|
extern int efi_guid_is_zero(const efi_guid_t *guid);
|
||||||
|
extern int efi_guid_is_empty(const efi_guid_t *guid);
|
||||||
|
-extern int efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b);
|
||||||
|
+extern int efi_guid_cmp(const void * const a, const void * const b);
|
||||||
|
|
||||||
|
/* import / export functions */
|
||||||
|
typedef struct efi_variable efi_variable_t;
|
||||||
|
diff --git a/src/ucs2.h b/src/ucs2.h
|
||||||
|
index dbb59004b7c..edd8367b4bc 100644
|
||||||
|
--- a/src/ucs2.h
|
||||||
|
+++ b/src/ucs2.h
|
||||||
|
@@ -23,16 +23,21 @@
|
||||||
|
(((val) & ((mask) << (shift))) >> (shift))
|
||||||
|
|
||||||
|
static inline size_t UNUSED
|
||||||
|
-ucs2len(const uint16_t * const s, ssize_t limit)
|
||||||
|
+ucs2len(const void *vs, ssize_t limit)
|
||||||
|
{
|
||||||
|
ssize_t i;
|
||||||
|
- for (i = 0; i < (limit >= 0 ? limit : i+1) && s[i] != (uint16_t)0; i++)
|
||||||
|
+ const uint16_t *s = vs;
|
||||||
|
+ const uint8_t *s8 = vs;
|
||||||
|
+
|
||||||
|
+ for (i = 0;
|
||||||
|
+ i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
|
||||||
|
+ i++, s8 += 2, s++)
|
||||||
|
;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline size_t UNUSED
|
||||||
|
-ucs2size(const uint16_t * const s, ssize_t limit)
|
||||||
|
+ucs2size(const void *s, ssize_t limit)
|
||||||
|
{
|
||||||
|
size_t rc = ucs2len(s, limit);
|
||||||
|
rc *= sizeof (uint16_t);
|
||||||
|
@@ -69,10 +74,11 @@ utf8size(uint8_t *s, ssize_t limit)
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned char * UNUSED
|
||||||
|
-ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
|
||||||
|
+ucs2_to_utf8(const void * const voidchars, ssize_t limit)
|
||||||
|
{
|
||||||
|
ssize_t i, j;
|
||||||
|
unsigned char *ret;
|
||||||
|
+ const uint16_t * const chars = voidchars;
|
||||||
|
|
||||||
|
if (limit < 0)
|
||||||
|
limit = ucs2len(chars, -1);
|
||||||
|
@@ -124,10 +130,12 @@ ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline ssize_t UNUSED NONNULL(4)
|
||||||
|
-utf8_to_ucs2(uint16_t *ucs2, ssize_t size, int terminate, uint8_t *utf8)
|
||||||
|
+utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, uint8_t *utf8)
|
||||||
|
{
|
||||||
|
ssize_t req;
|
||||||
|
ssize_t i, j;
|
||||||
|
+ uint16_t *ucs2 = ucs2void;
|
||||||
|
+ uint16_t val16;
|
||||||
|
|
||||||
|
if (!ucs2 && size > 0) {
|
||||||
|
errno = EINVAL;
|
||||||
|
@@ -162,10 +170,13 @@ utf8_to_ucs2(uint16_t *ucs2, ssize_t size, int terminate, uint8_t *utf8)
|
||||||
|
val = utf8[i] & 0x7f;
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
- ucs2[j] = val;
|
||||||
|
+ val16 = val;
|
||||||
|
+ ucs2[j] = val16;
|
||||||
|
+ }
|
||||||
|
+ if (terminate) {
|
||||||
|
+ val16 = 0;
|
||||||
|
+ ucs2[j++] = val16;
|
||||||
|
}
|
||||||
|
- if (terminate)
|
||||||
|
- ucs2[j++] = (uint16_t)0;
|
||||||
|
return j;
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
372
SOURCES/0005-Get-rid-of-the-arrows-in-our-debug-messages.patch
Normal file
372
SOURCES/0005-Get-rid-of-the-arrows-in-our-debug-messages.patch
Normal file
@ -0,0 +1,372 @@
|
|||||||
|
From da19b396ed674a7c9fddca1e3b480a18e642e280 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Thu, 21 Feb 2019 15:26:23 -0500
|
||||||
|
Subject: [PATCH 05/63] Get rid of the arrows in our debug messages.
|
||||||
|
|
||||||
|
They're not *that* useful, and the code is clever and problematic.
|
||||||
|
|
||||||
|
Resolves github issue #124
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/linux-acpi-root.c | 7 -------
|
||||||
|
src/linux-emmc.c | 9 ---------
|
||||||
|
src/linux-md.c | 8 --------
|
||||||
|
src/linux-nvme.c | 9 ---------
|
||||||
|
src/linux-pci-root.c | 7 -------
|
||||||
|
src/linux-pci.c | 8 --------
|
||||||
|
src/linux-sata.c | 11 -----------
|
||||||
|
src/linux-scsi.c | 24 ------------------------
|
||||||
|
src/linux-soc-root.c | 7 -------
|
||||||
|
src/linux-virtblk.c | 8 --------
|
||||||
|
src/util.h | 1 -
|
||||||
|
11 files changed, 99 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/linux-acpi-root.c b/src/linux-acpi-root.c
|
||||||
|
index 06e69eebe78..30728ded671 100644
|
||||||
|
--- a/src/linux-acpi-root.c
|
||||||
|
+++ b/src/linux-acpi-root.c
|
||||||
|
@@ -51,13 +51,6 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
char *colon;
|
||||||
|
|
||||||
|
const char *devpart = current;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos = strlen(current);
|
||||||
|
- spaces = alloca(pos+1);
|
||||||
|
- memset(spaces, ' ', pos+1);
|
||||||
|
- spaces[pos] = '\0';
|
||||||
|
- pos = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
diff --git a/src/linux-emmc.c b/src/linux-emmc.c
|
||||||
|
index 87e92477554..b290ed0a2bd 100644
|
||||||
|
--- a/src/linux-emmc.c
|
||||||
|
+++ b/src/linux-emmc.c
|
||||||
|
@@ -50,13 +50,6 @@ parse_emmc(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
int rc;
|
||||||
|
int32_t tosser0, tosser1, tosser2, tosser3, slot_id, partition;
|
||||||
|
int pos0 = 0, pos1 = 0;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos0 = strlen(current);
|
||||||
|
- spaces = alloca(pos0+1);
|
||||||
|
- memset(spaces, ' ', pos0+1);
|
||||||
|
- spaces[pos0] = '\0';
|
||||||
|
- pos0 = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
@@ -65,8 +58,6 @@ parse_emmc(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
&tosser0, &tosser1, &tosser2, &slot_id,
|
||||||
|
&pos0, &tosser3, &partition, &pos1);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc, 4);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos1, rc, 6);
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our emmc devices.
|
||||||
|
*/
|
||||||
|
diff --git a/src/linux-md.c b/src/linux-md.c
|
||||||
|
index 0a5c1cdb435..cb584c96c4b 100644
|
||||||
|
--- a/src/linux-md.c
|
||||||
|
+++ b/src/linux-md.c
|
||||||
|
@@ -44,13 +44,6 @@ parse_md(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
int rc;
|
||||||
|
int32_t md, tosser0, part;
|
||||||
|
int pos0 = 0, pos1 = 0;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos0 = strlen(current);
|
||||||
|
- spaces = alloca(pos0+1);
|
||||||
|
- memset(spaces, ' ', pos0+1);
|
||||||
|
- spaces[pos0] = '\0';
|
||||||
|
- pos0 = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
@@ -58,7 +51,6 @@ parse_md(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
rc = sscanf(current, "md%d/%nmd%dp%d%n",
|
||||||
|
&md, &pos0, &tosser0, &part, &pos1);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc, 3);
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our partitioned md devices.
|
||||||
|
*/
|
||||||
|
diff --git a/src/linux-nvme.c b/src/linux-nvme.c
|
||||||
|
index d68d11a3409..1d8fc654f76 100644
|
||||||
|
--- a/src/linux-nvme.c
|
||||||
|
+++ b/src/linux-nvme.c
|
||||||
|
@@ -54,13 +54,6 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
int32_t tosser0, tosser1, tosser2, ctrl_id, ns_id, partition;
|
||||||
|
uint8_t *filebuf = NULL;
|
||||||
|
int pos0 = 0, pos1 = 0;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos0 = strlen(current);
|
||||||
|
- spaces = alloca(pos0+1);
|
||||||
|
- memset(spaces, ' ', pos0+1);
|
||||||
|
- spaces[pos0] = '\0';
|
||||||
|
- pos0 = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
@@ -69,8 +62,6 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
&tosser0, &ctrl_id, &ns_id, &pos0,
|
||||||
|
&tosser1, &tosser2, &partition, &pos1);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc, 3);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos1, rc, 6);
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our nvme devices.
|
||||||
|
*/
|
||||||
|
diff --git a/src/linux-pci-root.c b/src/linux-pci-root.c
|
||||||
|
index 5d1df06119d..0605acfc7cb 100644
|
||||||
|
--- a/src/linux-pci-root.c
|
||||||
|
+++ b/src/linux-pci-root.c
|
||||||
|
@@ -48,13 +48,6 @@ parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
uint16_t root_domain;
|
||||||
|
uint8_t root_bus;
|
||||||
|
const char *devpart = current;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos = strlen(current);
|
||||||
|
- spaces = alloca(pos+1);
|
||||||
|
- memset(spaces, ' ', pos+1);
|
||||||
|
- spaces[pos] = '\0';
|
||||||
|
- pos = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
diff --git a/src/linux-pci.c b/src/linux-pci.c
|
||||||
|
index f63f5914d9f..64aaefb461c 100644
|
||||||
|
--- a/src/linux-pci.c
|
||||||
|
+++ b/src/linux-pci.c
|
||||||
|
@@ -48,13 +48,6 @@ parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
int rc;
|
||||||
|
int pos;
|
||||||
|
const char *devpart = current;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos = strlen(current);
|
||||||
|
- spaces = alloca(pos+1);
|
||||||
|
- memset(spaces, ' ', pos+1);
|
||||||
|
- spaces[pos] = '\0';
|
||||||
|
- pos = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
@@ -75,7 +68,6 @@ parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
rc = sscanf(devpart, "%hx:%hhx:%hhx.%hhx/%n",
|
||||||
|
&domain, &bus, &device, &function, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos, rc, 3);
|
||||||
|
if (rc != 4)
|
||||||
|
break;
|
||||||
|
devpart += pos;
|
||||||
|
diff --git a/src/linux-sata.c b/src/linux-sata.c
|
||||||
|
index 85265022f89..356411724bb 100644
|
||||||
|
--- a/src/linux-sata.c
|
||||||
|
+++ b/src/linux-sata.c
|
||||||
|
@@ -148,13 +148,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
uint64_t scsi_lun, tosser3;
|
||||||
|
int pos = 0;
|
||||||
|
int rc;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos = strlen(current);
|
||||||
|
- spaces = alloca(pos+1);
|
||||||
|
- memset(spaces, ' ', pos+1);
|
||||||
|
- spaces[pos] = '\0';
|
||||||
|
- pos = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
if (is_pata(dev)) {
|
||||||
|
@@ -169,7 +162,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
debug("searching for ata1/");
|
||||||
|
rc = sscanf(current, "ata%"PRIu32"/%n", &print_id, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos, rc, 1);
|
||||||
|
/*
|
||||||
|
* If we don't find this one, it isn't an ata device, so return 0 not
|
||||||
|
* error. Later errors mean it is an ata device, but we can't parse
|
||||||
|
@@ -183,7 +175,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
debug("searching for host0/");
|
||||||
|
rc = sscanf(current, "host%"PRIu32"/%n", &scsi_bus, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos, rc, 1);
|
||||||
|
if (rc != 1)
|
||||||
|
return -1;
|
||||||
|
current += pos;
|
||||||
|
@@ -193,7 +184,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
rc = sscanf(current, "target%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
&scsi_device, &scsi_target, &scsi_lun, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos, rc, 3);
|
||||||
|
if (rc != 3)
|
||||||
|
return -1;
|
||||||
|
current += pos;
|
||||||
|
@@ -203,7 +193,6 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
rc = sscanf(current, "%"PRIu32":%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
&tosser0, &tosser1, &tosser2, &tosser3, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos, rc, 4);
|
||||||
|
if (rc != 4)
|
||||||
|
return -1;
|
||||||
|
current += pos;
|
||||||
|
diff --git a/src/linux-scsi.c b/src/linux-scsi.c
|
||||||
|
index a5e81cf9cb6..04892f02b4e 100644
|
||||||
|
--- a/src/linux-scsi.c
|
||||||
|
+++ b/src/linux-scsi.c
|
||||||
|
@@ -45,13 +45,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
int rc;
|
||||||
|
int sz = 0;
|
||||||
|
int pos0 = 0, pos1 = 0;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- sz = strlen(current);
|
||||||
|
- spaces = alloca(sz+1);
|
||||||
|
- memset(spaces, ' ', sz+1);
|
||||||
|
- spaces[sz] = '\0';
|
||||||
|
- sz = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
/*
|
||||||
|
@@ -108,7 +101,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
debug("searching for host4/");
|
||||||
|
rc = sscanf(current, "host%d/%n", scsi_host, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc, 1);
|
||||||
|
if (rc != 1)
|
||||||
|
return -1;
|
||||||
|
sz += pos0;
|
||||||
|
@@ -126,8 +118,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
rc = sscanf(current+sz, "port-%d:%d%n:%d%n", &tosser0,
|
||||||
|
&tosser1, &pos0, &tosser2, &pos1);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current+sz, rc, pos0, pos1);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc, 2);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos1, rc, 3);
|
||||||
|
if (rc == 2 || rc == 3) {
|
||||||
|
sz += pos0;
|
||||||
|
pos0 = 0;
|
||||||
|
@@ -153,7 +143,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
debug("searching for expander-4:0/");
|
||||||
|
rc = sscanf(current+sz, "expander-%d:%d/%n", &tosser0, &tosser1, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc, 2);
|
||||||
|
if (rc == 2) {
|
||||||
|
if (!remote_target_id) {
|
||||||
|
efi_error("Device is PHY is a remote target, but remote_target_id is NULL");
|
||||||
|
@@ -169,7 +158,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
debug("searching for port-2:0:2/");
|
||||||
|
rc = sscanf(current+sz, "port-%d:%d:%d/%n", &tosser0, &tosser1, &tosser2, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc, 3);
|
||||||
|
if (rc != 3) {
|
||||||
|
efi_error("Couldn't parse port expander port string");
|
||||||
|
return -1;
|
||||||
|
@@ -192,8 +180,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
|
||||||
|
pos1 = 0;
|
||||||
|
rc = sscanf(current + sz + pos0, ":%d%n", &tosser2, &pos1);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc + 2, 2);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0 + pos1, rc + 2, 3);
|
||||||
|
if (rc != 0 && rc != 1)
|
||||||
|
return -1;
|
||||||
|
if (remote_port_id && rc == 1)
|
||||||
|
@@ -217,7 +203,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
rc = sscanf(current + sz, "target%d:%d:%"PRIu64"/%n", &tosser0, &tosser1,
|
||||||
|
&tosser3, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc, 3);
|
||||||
|
if (rc != 3)
|
||||||
|
return -1;
|
||||||
|
sz += pos0;
|
||||||
|
@@ -230,7 +215,6 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
rc = sscanf(current + sz, "%d:%d:%d:%"PRIu64"/%n",
|
||||||
|
scsi_bus, scsi_device, scsi_target, scsi_lun, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos0, rc, 4);
|
||||||
|
if (rc != 4)
|
||||||
|
return -1;
|
||||||
|
sz += pos0;
|
||||||
|
@@ -247,13 +231,6 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
ssize_t sz;
|
||||||
|
int pos;
|
||||||
|
int rc;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos = strlen(current);
|
||||||
|
- spaces = alloca(pos+1);
|
||||||
|
- memset(spaces, ' ', pos+1);
|
||||||
|
- spaces[pos] = '\0';
|
||||||
|
- pos = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
@@ -265,7 +242,6 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
&dev->scsi_info.scsi_lun,
|
||||||
|
&pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", dev->device, rc, pos);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos, rc, 3);
|
||||||
|
if (rc != 4)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
diff --git a/src/linux-soc-root.c b/src/linux-soc-root.c
|
||||||
|
index 394f496a453..373cd59521a 100644
|
||||||
|
--- a/src/linux-soc-root.c
|
||||||
|
+++ b/src/linux-soc-root.c
|
||||||
|
@@ -43,13 +43,6 @@ parse_soc_root(struct device *dev UNUSED, const char *current, const char *root
|
||||||
|
int rc;
|
||||||
|
int pos;
|
||||||
|
const char *devpart = current;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos = strlen(current);
|
||||||
|
- spaces = alloca(pos+1);
|
||||||
|
- memset(spaces, ' ', pos+1);
|
||||||
|
- spaces[pos] = '\0';
|
||||||
|
- pos = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
diff --git a/src/linux-virtblk.c b/src/linux-virtblk.c
|
||||||
|
index c54a813a947..2e9889def2f 100644
|
||||||
|
--- a/src/linux-virtblk.c
|
||||||
|
+++ b/src/linux-virtblk.c
|
||||||
|
@@ -50,20 +50,12 @@ parse_virtblk(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
uint32_t tosser;
|
||||||
|
int pos;
|
||||||
|
int rc;
|
||||||
|
- char *spaces;
|
||||||
|
-
|
||||||
|
- pos = strlen(current);
|
||||||
|
- spaces = alloca(pos+1);
|
||||||
|
- memset(spaces, ' ', pos+1);
|
||||||
|
- spaces[pos] = '\0';
|
||||||
|
- pos = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
debug("searching for virtio0/");
|
||||||
|
rc = sscanf(current, "virtio%x/%n", &tosser, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- arrow(LOG_DEBUG, spaces, 9, pos, rc, 1);
|
||||||
|
/*
|
||||||
|
* If we couldn't find virtioX/ then it isn't a virtio device.
|
||||||
|
*/
|
||||||
|
diff --git a/src/util.h b/src/util.h
|
||||||
|
index ba8fee35ae9..6d3c10e946e 100644
|
||||||
|
--- a/src/util.h
|
||||||
|
+++ b/src/util.h
|
||||||
|
@@ -388,7 +388,6 @@ swizzle_guid_to_uuid(efi_guid_t *guid)
|
||||||
|
#undef log
|
||||||
|
#endif
|
||||||
|
#define log(level, fmt, args...) log_(__FILE__, __LINE__, __func__, level, fmt, ## args)
|
||||||
|
-#define arrow(l,b,o,p,n,m) ({if(n==m){char c_=b[p+1]; b[o]='^'; b[p+o]='^';b[p+o+1]='\0';log(l,"%s",b);b[o]=' ';b[p+o]=' ';b[p+o+1]=c_;}})
|
||||||
|
#define debug(fmt, args...) log(LOG_DEBUG, fmt, ## args)
|
||||||
|
|
||||||
|
#endif /* EFIVAR_UTIL_H */
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
38
SOURCES/0006-Define-strdupa-if-it-is-not-defined.patch
Normal file
38
SOURCES/0006-Define-strdupa-if-it-is-not-defined.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
From be60850c79dcb62cf682ea496ec22d8ea45f9da2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
Date: Thu, 10 Jan 2019 16:44:38 +0800
|
||||||
|
Subject: [PATCH 06/63] Define strdupa if it is not defined
|
||||||
|
|
||||||
|
Android does not include strdupa in <string.h>. Define strdupa if it has
|
||||||
|
not already been defined.
|
||||||
|
|
||||||
|
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
---
|
||||||
|
src/util.h | 11 +++++++++++
|
||||||
|
1 file changed, 11 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/util.h b/src/util.h
|
||||||
|
index 6d3c10e946e..d98bfa1beed 100644
|
||||||
|
--- a/src/util.h
|
||||||
|
+++ b/src/util.h
|
||||||
|
@@ -252,6 +252,17 @@ lcm(uint64_t x, uint64_t y)
|
||||||
|
return (x / n) * y;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifndef strdupa
|
||||||
|
+#define strdupa(s) \
|
||||||
|
+ (__extension__ ({ \
|
||||||
|
+ const char *__in = (s); \
|
||||||
|
+ size_t __len = strlen (__in); \
|
||||||
|
+ char *__out = (char *) alloca (__len + 1); \
|
||||||
|
+ strcpy(__out, __in); \
|
||||||
|
+ __out; \
|
||||||
|
+ }))
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#ifndef strndupa
|
||||||
|
#define strndupa(s, l) \
|
||||||
|
(__extension__ ({ \
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
82
SOURCES/0007-Android-inital-porting-of-libefivar.patch
Normal file
82
SOURCES/0007-Android-inital-porting-of-libefivar.patch
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
From f5932cee024f080a005bbfc252a3596f093e7ecd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
Date: Thu, 10 Jan 2019 16:48:30 +0800
|
||||||
|
Subject: [PATCH 07/63] Android: inital porting of libefivar
|
||||||
|
|
||||||
|
The static library is linked by efibootmgr.
|
||||||
|
|
||||||
|
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
---
|
||||||
|
src/Android.mk | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 60 insertions(+)
|
||||||
|
create mode 100644 src/Android.mk
|
||||||
|
|
||||||
|
diff --git a/src/Android.mk b/src/Android.mk
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..b3410e1f3e7
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/Android.mk
|
||||||
|
@@ -0,0 +1,60 @@
|
||||||
|
+#
|
||||||
|
+# Copyright (C) 2019 The Android-x86 Open Source Project
|
||||||
|
+#
|
||||||
|
+# Licensed under the GNU Lesser General Public License Version 2.1.
|
||||||
|
+# You may not use this file except in compliance with the License.
|
||||||
|
+# You may obtain a copy of the License at
|
||||||
|
+#
|
||||||
|
+# https://www.gnu.org/licenses/lgpl-2.1.html
|
||||||
|
+#
|
||||||
|
+
|
||||||
|
+LOCAL_PATH := $(call my-dir)
|
||||||
|
+
|
||||||
|
+include $(CLEAR_VARS)
|
||||||
|
+
|
||||||
|
+LOCAL_MODULE := makeguids
|
||||||
|
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||||
|
+LOCAL_CFLAGS := -DEFIVAR_BUILD_ENVIRONMENT
|
||||||
|
+LOCAL_SRC_FILES := guid.c makeguids.c
|
||||||
|
+LOCAL_LDLIBS := -ldl
|
||||||
|
+include $(BUILD_HOST_EXECUTABLE)
|
||||||
|
+
|
||||||
|
+include $(CLEAR_VARS)
|
||||||
|
+
|
||||||
|
+LOCAL_MODULE := libefivar
|
||||||
|
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
|
||||||
|
+LIBEFIBOOT_SOURCES := \
|
||||||
|
+ crc32.c \
|
||||||
|
+ creator.c \
|
||||||
|
+ disk.c \
|
||||||
|
+ gpt.c \
|
||||||
|
+ loadopt.c \
|
||||||
|
+ path-helpers.c \
|
||||||
|
+ $(notdir $(wildcard $(LOCAL_PATH)/linux*.c))
|
||||||
|
+
|
||||||
|
+LIBEFIVAR_SOURCES := \
|
||||||
|
+ dp.c \
|
||||||
|
+ dp-acpi.c \
|
||||||
|
+ dp-hw.c \
|
||||||
|
+ dp-media.c \
|
||||||
|
+ dp-message.c \
|
||||||
|
+ efivarfs.c \
|
||||||
|
+ error.c \
|
||||||
|
+ export.c \
|
||||||
|
+ guid.c \
|
||||||
|
+ guids.S \
|
||||||
|
+ lib.c \
|
||||||
|
+ vars.c
|
||||||
|
+
|
||||||
|
+LOCAL_SRC_FILES := $(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES)
|
||||||
|
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -std=gnu11
|
||||||
|
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||||
|
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_C_INCLUDES) $(LOCAL_C_INCLUDES)/efivar $(local-generated-sources-dir)
|
||||||
|
+LIBEFIVAR_GUIDS_H := $(local-generated-sources-dir)/efivar/efivar-guids.h
|
||||||
|
+LOCAL_GENERATED_SOURCES := $(LIBEFIVAR_GUIDS_H) $(local-generated-sources-dir)/guid-symbols.c
|
||||||
|
+$(LIBEFIVAR_GUIDS_H): PRIVATE_CUSTOM_TOOL = $^ $(addprefix $(dir $(@D)),guids.bin names.bin guid-symbols.c efivar/efivar-guids.h)
|
||||||
|
+$(LIBEFIVAR_GUIDS_H): $(BUILD_OUT_EXECUTABLES)/makeguids $(LOCAL_PATH)/guids.txt
|
||||||
|
+ $(transform-generated-source)
|
||||||
|
+$(lastword $(LOCAL_GENERATED_SOURCES)): $(LIBEFIVAR_GUIDS_H)
|
||||||
|
+
|
||||||
|
+include $(BUILD_STATIC_LIBRARY)
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
40
SOURCES/0008-Remove-an-unused-function.patch
Normal file
40
SOURCES/0008-Remove-an-unused-function.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
From f9a64ce561b122368118149cb24c20bf3e0c9e1c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
Date: Tue, 26 Feb 2019 14:57:00 +0800
|
||||||
|
Subject: [PATCH 08/63] Remove an unused function
|
||||||
|
|
||||||
|
This gets rid of an error from Android 9 clang:
|
||||||
|
|
||||||
|
external/efivar/src/linux.c:256:1: error: unused function 'supports_iface' [-Werror,-Wunused-function]
|
||||||
|
supports_iface(struct dev_probe *probe, enum interface_type iftype)
|
||||||
|
^
|
||||||
|
1 error generated.
|
||||||
|
|
||||||
|
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
---
|
||||||
|
src/linux.c | 9 ---------
|
||||||
|
1 file changed, 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/linux.c b/src/linux.c
|
||||||
|
index 6d405af8a76..4bb453be834 100644
|
||||||
|
--- a/src/linux.c
|
||||||
|
+++ b/src/linux.c
|
||||||
|
@@ -252,15 +252,6 @@ static struct dev_probe *dev_probes[] = {
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
-static inline bool
|
||||||
|
-supports_iface(struct dev_probe *probe, enum interface_type iftype)
|
||||||
|
-{
|
||||||
|
- for (unsigned int i = 0; probe->iftypes[i] != unknown; i++)
|
||||||
|
- if (probe->iftypes[i] == iftype)
|
||||||
|
- return true;
|
||||||
|
- return false;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
void HIDDEN
|
||||||
|
device_free(struct device *dev)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
From d10381d23097d96afbb8d7c4199e58164da0d870 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
Date: Tue, 26 Feb 2019 18:42:20 +0800
|
||||||
|
Subject: [PATCH 09/63] Fix another error of -Werror=address-of-packed-member
|
||||||
|
|
||||||
|
Android 9 clang complains:
|
||||||
|
|
||||||
|
external/efivar/src/dp-message.c:367:24: error: taking address of packed member '' of class or structure 'efidp_infiniband' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
|
||||||
|
(efi_guid_t *)&dp->infiniband.ioc_guid);
|
||||||
|
^~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
external/efivar/src/dp.h:76:19: note: expanded from macro 'format_guid'
|
||||||
|
memmove(&_guid, guid, sizeof(_guid)); \
|
||||||
|
^~~~
|
||||||
|
1 error generated.
|
||||||
|
|
||||||
|
Since commit c3c553d the fifth parameter of format_guid() is treated as
|
||||||
|
a const void *. The casting is unnecessary.
|
||||||
|
|
||||||
|
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
---
|
||||||
|
src/dp-media.c | 3 +--
|
||||||
|
src/dp-message.c | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dp-media.c b/src/dp-media.c
|
||||||
|
index 96a576fdc2a..be691c44326 100644
|
||||||
|
--- a/src/dp-media.c
|
||||||
|
+++ b/src/dp-media.c
|
||||||
|
@@ -46,8 +46,7 @@ _format_media_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
break;
|
||||||
|
case EFIDP_HD_SIGNATURE_GUID:
|
||||||
|
format(buf, size, off, "HD", "GPT,");
|
||||||
|
- format_guid(buf, size, off, "HD",
|
||||||
|
- (efi_guid_t *)dp->hd.signature);
|
||||||
|
+ format_guid(buf, size, off, "HD", dp->hd.signature);
|
||||||
|
format(buf, size, off, "HD",
|
||||||
|
",0x%"PRIx64",0x%"PRIx64")",
|
||||||
|
dp->hd.start, dp->hd.size);
|
||||||
|
diff --git a/src/dp-message.c b/src/dp-message.c
|
||||||
|
index 9f964663de8..6b8e9072594 100644
|
||||||
|
--- a/src/dp-message.c
|
||||||
|
+++ b/src/dp-message.c
|
||||||
|
@@ -364,7 +364,7 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
dp->infiniband.port_gid[1],
|
||||||
|
dp->infiniband.port_gid[0]);
|
||||||
|
format_guid(buf, size, off, "Infiniband",
|
||||||
|
- (efi_guid_t *)&dp->infiniband.ioc_guid);
|
||||||
|
+ &dp->infiniband.ioc_guid);
|
||||||
|
format(buf, size, off, "Infiniband",
|
||||||
|
",%"PRIu64",%"PRIu64")",
|
||||||
|
dp->infiniband.target_port_id,
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
34
SOURCES/0010-ucs2.h-remove-unused-variable.patch
Normal file
34
SOURCES/0010-ucs2.h-remove-unused-variable.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From 3ae06e10e5e25ca6aab04eba1cb0402bfe068997 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
Date: Tue, 5 Mar 2019 17:23:24 +0100
|
||||||
|
Subject: [PATCH 10/63] ucs2.h: remove unused variable
|
||||||
|
|
||||||
|
The const uint16_t pointer is not used since now the two bytes of the
|
||||||
|
UCS-2 chars are checked to know if is the termination of the string.
|
||||||
|
|
||||||
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
---
|
||||||
|
src/ucs2.h | 3 +--
|
||||||
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ucs2.h b/src/ucs2.h
|
||||||
|
index edd8367b4bc..e0390c34985 100644
|
||||||
|
--- a/src/ucs2.h
|
||||||
|
+++ b/src/ucs2.h
|
||||||
|
@@ -26,12 +26,11 @@ static inline size_t UNUSED
|
||||||
|
ucs2len(const void *vs, ssize_t limit)
|
||||||
|
{
|
||||||
|
ssize_t i;
|
||||||
|
- const uint16_t *s = vs;
|
||||||
|
const uint8_t *s8 = vs;
|
||||||
|
|
||||||
|
for (i = 0;
|
||||||
|
i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
|
||||||
|
- i++, s8 += 2, s++)
|
||||||
|
+ i++, s8 += 2)
|
||||||
|
;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
From 4468e686c271cd208d741de4b304200bf28832f9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
Date: Tue, 5 Mar 2019 17:23:32 +0100
|
||||||
|
Subject: [PATCH 11/63] ucs2.h: fix logic that checks for UCS-2 string
|
||||||
|
termination
|
||||||
|
|
||||||
|
Currently the loop to count the lenght of the UCS-2 string ends if either
|
||||||
|
of the two bytes are 0, but 0 is a valid value for UCS-2 character codes.
|
||||||
|
|
||||||
|
So only break the loop when 0 is the value for both UCS-2 char bytes.
|
||||||
|
|
||||||
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
---
|
||||||
|
src/ucs2.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/ucs2.h b/src/ucs2.h
|
||||||
|
index e0390c34985..fd8b056ad25 100644
|
||||||
|
--- a/src/ucs2.h
|
||||||
|
+++ b/src/ucs2.h
|
||||||
|
@@ -29,7 +29,7 @@ ucs2len(const void *vs, ssize_t limit)
|
||||||
|
const uint8_t *s8 = vs;
|
||||||
|
|
||||||
|
for (i = 0;
|
||||||
|
- i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
|
||||||
|
+ i < (limit >= 0 ? limit : i+1) && !(s8[0] == 0 && s8[1] == 0);
|
||||||
|
i++, s8 += 2)
|
||||||
|
;
|
||||||
|
return i;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From 627860f1c60139b41580929a4c3a3328b579b278 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
Date: Tue, 5 Mar 2019 17:23:36 +0100
|
||||||
|
Subject: [PATCH 12/63] dp-message: fix efidp_ipv4_addr fields assignment
|
||||||
|
|
||||||
|
The efidp_ipv4_addr structure has some 4-byte array fields to store IPv4
|
||||||
|
addresses and network mask. But the efidp_make_ipv4() function wrongly
|
||||||
|
casts these as a char * before dereferencing them to store a value.
|
||||||
|
|
||||||
|
Instead, cast it to a uint32_t * so the 32-bit value is correctly stored.
|
||||||
|
|
||||||
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
---
|
||||||
|
src/dp-message.c | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dp-message.c b/src/dp-message.c
|
||||||
|
index 6b8e9072594..55fa7810439 100644
|
||||||
|
--- a/src/dp-message.c
|
||||||
|
+++ b/src/dp-message.c
|
||||||
|
@@ -678,16 +678,16 @@ efidp_make_ipv4(uint8_t *buf, ssize_t size, uint32_t local, uint32_t remote,
|
||||||
|
EFIDP_MSG_IPv4, sizeof (*ipv4));
|
||||||
|
ssize_t req = sizeof (*ipv4);
|
||||||
|
if (size && sz == req) {
|
||||||
|
- *((char *)ipv4->local_ipv4_addr) = htonl(local);
|
||||||
|
- *((char *)ipv4->remote_ipv4_addr) = htonl(remote);
|
||||||
|
+ *((uint32_t *)ipv4->local_ipv4_addr) = htonl(local);
|
||||||
|
+ *((uint32_t *)ipv4->remote_ipv4_addr) = htonl(remote);
|
||||||
|
ipv4->local_port = htons(local_port);
|
||||||
|
ipv4->remote_port = htons(remote_port);
|
||||||
|
ipv4->protocol = htons(protocol);
|
||||||
|
ipv4->static_ip_addr = 0;
|
||||||
|
if (is_static)
|
||||||
|
ipv4->static_ip_addr = 1;
|
||||||
|
- *((char *)ipv4->gateway) = htonl(gateway);
|
||||||
|
- *((char *)ipv4->netmask) = htonl(netmask);
|
||||||
|
+ *((uint32_t *)ipv4->gateway) = htonl(gateway);
|
||||||
|
+ *((uint32_t *)ipv4->netmask) = htonl(netmask);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sz < 0)
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,129 @@
|
|||||||
|
From 62d5bb056e8f9ed4517c460d4d7ea5d51bc8125c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 13 Mar 2019 11:01:34 -0400
|
||||||
|
Subject: [PATCH 13/63] Always refer to MBR and GPT fixed values as 'magic' not
|
||||||
|
'signature'
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/disk.c | 5 +++--
|
||||||
|
src/gpt.c | 22 +++++++++++-----------
|
||||||
|
src/gpt.h | 8 ++++----
|
||||||
|
3 files changed, 18 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/disk.c b/src/disk.c
|
||||||
|
index 3efee03b804..519c2a19325 100644
|
||||||
|
--- a/src/disk.c
|
||||||
|
+++ b/src/disk.c
|
||||||
|
@@ -52,10 +52,11 @@ is_mbr_valid(legacy_mbr *mbr)
|
||||||
|
int ret;
|
||||||
|
if (!mbr)
|
||||||
|
return 0;
|
||||||
|
- ret = (mbr->signature == MSDOS_MBR_SIGNATURE);
|
||||||
|
+ ret = (mbr->magic == MSDOS_MBR_MAGIC);
|
||||||
|
if (!ret) {
|
||||||
|
errno = ENOTTY;
|
||||||
|
- efi_error("mbr signature is not MSDOS_MBR_SIGNATURE");
|
||||||
|
+ efi_error("mbr magic is 0x%04hx not MSDOS_MBR_MAGIC (0x%04hx)",
|
||||||
|
+ mbr->magic, MSDOS_MBR_MAGIC);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
diff --git a/src/gpt.c b/src/gpt.c
|
||||||
|
index ce8e638ab83..7bdb8ad1575 100644
|
||||||
|
--- a/src/gpt.c
|
||||||
|
+++ b/src/gpt.c
|
||||||
|
@@ -72,24 +72,24 @@ efi_crc32(const void *buf, unsigned long len)
|
||||||
|
*
|
||||||
|
* Description: Returns 1 if PMBR is valid, 0 otherwise.
|
||||||
|
* Validity depends on two things:
|
||||||
|
- * 1) MSDOS signature is in the last two bytes of the MBR
|
||||||
|
+ * 1) MSDOS magic is in the last two bytes of the MBR
|
||||||
|
* 2) One partition of type 0xEE is found
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
is_pmbr_valid(legacy_mbr *mbr)
|
||||||
|
{
|
||||||
|
- int i, found = 0, signature = 0;
|
||||||
|
+ int i, found = 0, magic = 0;
|
||||||
|
if (!mbr)
|
||||||
|
return 0;
|
||||||
|
- signature = (le16_to_cpu(mbr->signature) == MSDOS_MBR_SIGNATURE);
|
||||||
|
- for (i = 0; signature && i < 4; i++) {
|
||||||
|
+ magic = (le16_to_cpu(mbr->magic) == MSDOS_MBR_MAGIC);
|
||||||
|
+ for (i = 0; magic && i < 4; i++) {
|
||||||
|
if (mbr->partition[i].os_type ==
|
||||||
|
EFI_PMBR_OSTYPE_EFI_GPT) {
|
||||||
|
found = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- return (signature && found);
|
||||||
|
+ return (magic && found);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -389,11 +389,11 @@ is_gpt_valid(int fd, uint64_t lba,
|
||||||
|
if (!(*gpt = alloc_read_gpt_header(fd, lba)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- /* Check the GUID Partition Table signature */
|
||||||
|
- if (le64_to_cpu((*gpt)->signature) != GPT_HEADER_SIGNATURE) {
|
||||||
|
- efi_error("GUID Partition Table Header signature is wrong: %"PRIx64" != %"PRIx64,
|
||||||
|
- (uint64_t)le64_to_cpu((*gpt)->signature),
|
||||||
|
- GPT_HEADER_SIGNATURE);
|
||||||
|
+ /* Check the GUID Partition Table magic */
|
||||||
|
+ if (le64_to_cpu((*gpt)->magic) != GPT_HEADER_MAGIC) {
|
||||||
|
+ efi_error("GUID Partition Table Header magic is wrong: %"PRIx64" != %"PRIx64,
|
||||||
|
+ (uint64_t)le64_to_cpu((*gpt)->magic),
|
||||||
|
+ GPT_HEADER_MAGIC);
|
||||||
|
free(*gpt);
|
||||||
|
*gpt = NULL;
|
||||||
|
return rc;
|
||||||
|
@@ -673,7 +673,7 @@ find_valid_gpt(int fd, gpt_header ** gpt, gpt_entry ** ptes,
|
||||||
|
|
||||||
|
/* Would fail due to bad PMBR, but force GPT anyhow */
|
||||||
|
if ((good_pgpt || good_agpt) && !good_pmbr && ignore_pmbr_err) {
|
||||||
|
- efi_error(" Warning: Disk has a valid GPT signature but invalid PMBR.\n"
|
||||||
|
+ efi_error(" Warning: Disk has a valid GPT magic but invalid PMBR.\n"
|
||||||
|
" Use GNU Parted to correct disk.\n"
|
||||||
|
" gpt option taken, disk treated as GPT.");
|
||||||
|
}
|
||||||
|
diff --git a/src/gpt.h b/src/gpt.h
|
||||||
|
index 5eb5d1a732c..0d7d5e8a649 100644
|
||||||
|
--- a/src/gpt.h
|
||||||
|
+++ b/src/gpt.h
|
||||||
|
@@ -29,10 +29,10 @@
|
||||||
|
|
||||||
|
#define EFI_PMBR_OSTYPE_EFI 0xEF
|
||||||
|
#define EFI_PMBR_OSTYPE_EFI_GPT 0xEE
|
||||||
|
-#define MSDOS_MBR_SIGNATURE 0xaa55
|
||||||
|
+#define MSDOS_MBR_MAGIC 0xaa55
|
||||||
|
#define GPT_BLOCK_SIZE 512
|
||||||
|
|
||||||
|
-#define GPT_HEADER_SIGNATURE ((uint64_t)(0x5452415020494645ULL))
|
||||||
|
+#define GPT_HEADER_MAGIC ((uint64_t)(0x5452415020494645ULL))
|
||||||
|
#define GPT_HEADER_REVISION_V1_02 0x00010200
|
||||||
|
#define GPT_HEADER_REVISION_V1_00 0x00010000
|
||||||
|
#define GPT_HEADER_REVISION_V0_99 0x00009900
|
||||||
|
@@ -61,7 +61,7 @@
|
||||||
|
0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)
|
||||||
|
|
||||||
|
typedef struct _gpt_header {
|
||||||
|
- uint64_t signature;
|
||||||
|
+ uint64_t magic;
|
||||||
|
uint32_t revision;
|
||||||
|
uint32_t header_size;
|
||||||
|
uint32_t header_crc32;
|
||||||
|
@@ -133,7 +133,7 @@ typedef struct _legacy_mbr {
|
||||||
|
uint32_t unique_mbr_signature;
|
||||||
|
uint16_t unknown;
|
||||||
|
partition_record partition[4];
|
||||||
|
- uint16_t signature;
|
||||||
|
+ uint16_t magic;
|
||||||
|
} PACKED legacy_mbr;
|
||||||
|
|
||||||
|
#define EFI_GPT_PRIMARY_PARTITION_TABLE_LBA 1
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
87
SOURCES/0014-Add-more-hexdump-logging-functions.patch
Normal file
87
SOURCES/0014-Add-more-hexdump-logging-functions.patch
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
From 707276197e82e852e9d5c7acb97a9348efe467b7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 13 Mar 2019 11:02:01 -0400
|
||||||
|
Subject: [PATCH 14/63] Add more hexdump logging functions.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/hexdump.h | 30 ++++++++++++++++++++++++++++--
|
||||||
|
src/util.h | 10 ++++++++++
|
||||||
|
2 files changed, 38 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/hexdump.h b/src/hexdump.h
|
||||||
|
index 4c45cb3732d..f8c32faa9e1 100644
|
||||||
|
--- a/src/hexdump.h
|
||||||
|
+++ b/src/hexdump.h
|
||||||
|
@@ -63,8 +63,12 @@ prepare_text(uint8_t *data, unsigned long size, char *buf)
|
||||||
|
buf[offset] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * variadic fhexdump formatted
|
||||||
|
+ * think of it as: fprintf(f, %s%s\n", vformat(fmt, ap), hexdump(data,size));
|
||||||
|
+ */
|
||||||
|
static inline void UNUSED
|
||||||
|
-hexdump(uint8_t *data, unsigned long size)
|
||||||
|
+vfhexdumpf(FILE *f, const char * const fmt, uint8_t *data, unsigned long size, va_list ap)
|
||||||
|
{
|
||||||
|
unsigned long display_offset = (unsigned long)data & 0xffffffff;
|
||||||
|
unsigned long offset = 0;
|
||||||
|
@@ -80,11 +84,33 @@ hexdump(uint8_t *data, unsigned long size)
|
||||||
|
return;
|
||||||
|
|
||||||
|
prepare_text(data+offset, size-offset, txtbuf);
|
||||||
|
- printf("%016lx %s %s\n", display_offset, hexbuf, txtbuf);
|
||||||
|
+ vfprintf(f, fmt, ap);
|
||||||
|
+ fprintf(f, "%016lx %s %s\n", display_offset, hexbuf, txtbuf);
|
||||||
|
|
||||||
|
display_offset += sz;
|
||||||
|
offset += sz;
|
||||||
|
}
|
||||||
|
+ fflush(f);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * fhexdump formatted
|
||||||
|
+ * think of it as: fprintf(f, %s%s\n", format(fmt, ...), hexdump(data,size));
|
||||||
|
+ */
|
||||||
|
+static inline void UNUSED
|
||||||
|
+fhexdumpf(FILE *f, const char * const fmt, uint8_t *data, unsigned long size, ...)
|
||||||
|
+{
|
||||||
|
+ va_list ap;
|
||||||
|
+
|
||||||
|
+ va_start(ap, size);
|
||||||
|
+ vfhexdumpf(f, fmt, data, size, ap);
|
||||||
|
+ va_end(ap);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static inline void UNUSED
|
||||||
|
+hexdump(uint8_t *data, unsigned long size)
|
||||||
|
+{
|
||||||
|
+ fhexdumpf(stdout, "", data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* STATIC_HEXDUMP_H */
|
||||||
|
diff --git a/src/util.h b/src/util.h
|
||||||
|
index d98bfa1beed..a6a80e754ec 100644
|
||||||
|
--- a/src/util.h
|
||||||
|
+++ b/src/util.h
|
||||||
|
@@ -400,5 +400,15 @@ swizzle_guid_to_uuid(efi_guid_t *guid)
|
||||||
|
#endif
|
||||||
|
#define log(level, fmt, args...) log_(__FILE__, __LINE__, __func__, level, fmt, ## args)
|
||||||
|
#define debug(fmt, args...) log(LOG_DEBUG, fmt, ## args)
|
||||||
|
+#define log_hex_(file, line, func, level, buf, size) \
|
||||||
|
+ ({ \
|
||||||
|
+ if (efi_get_verbose() >= level) { \
|
||||||
|
+ fhexdumpf(efi_get_logfile(), "%s:%d %s(): ", \
|
||||||
|
+ (uint8_t *)buf, size, \
|
||||||
|
+ file, line, func); \
|
||||||
|
+ } \
|
||||||
|
+ })
|
||||||
|
+#define log_hex(level, buf, size) log_hex_(__FILE__, __LINE__, __func__, level, buf, size)
|
||||||
|
+#define debug_hex(buf, size) log_hex(LOG_DEBUG, buf, size)
|
||||||
|
|
||||||
|
#endif /* EFIVAR_UTIL_H */
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,147 @@
|
|||||||
|
From c4e3c85e470705f2e8a3bdebf54ebcea90152963 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 28 May 2019 14:02:12 -0400
|
||||||
|
Subject: [PATCH 15/63] Add efi_error_pop() and pop some errors sometimes.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/error.c | 37 +++++++++++++++++++++++++++++--------
|
||||||
|
src/include/efivar/efivar.h | 9 +++++++++
|
||||||
|
src/libefivar.map.in | 7 +++++++
|
||||||
|
src/linux.c | 4 ++++
|
||||||
|
4 files changed, 49 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/error.c b/src/error.c
|
||||||
|
index d1008a3d676..df03d7f45e0 100644
|
||||||
|
--- a/src/error.c
|
||||||
|
+++ b/src/error.c
|
||||||
|
@@ -78,6 +78,22 @@ efi_error_get(unsigned int n,
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline UNUSED void
|
||||||
|
+clear_error_entry(error_table_entry *et)
|
||||||
|
+{
|
||||||
|
+ if (!et)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (et->filename)
|
||||||
|
+ free(et->filename);
|
||||||
|
+ if (et->function)
|
||||||
|
+ free(et->function);
|
||||||
|
+ if (et->message)
|
||||||
|
+ free(et->message);
|
||||||
|
+
|
||||||
|
+ memset(et, '\0', sizeof(*et));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int PUBLIC NONNULL(1, 2, 5) PRINTF(5, 6)
|
||||||
|
efi_error_set(const char *filename,
|
||||||
|
const char *function,
|
||||||
|
@@ -136,6 +152,16 @@ err:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void PUBLIC
|
||||||
|
+efi_error_pop(void)
|
||||||
|
+{
|
||||||
|
+ if (current <= 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ current -= 1;
|
||||||
|
+ clear_error_entry(&error_table[current]);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void PUBLIC DESTRUCTOR
|
||||||
|
efi_error_clear(void)
|
||||||
|
{
|
||||||
|
@@ -143,14 +169,7 @@ efi_error_clear(void)
|
||||||
|
for (unsigned int i = 0; i < current; i++) {
|
||||||
|
error_table_entry *et = &error_table[i];
|
||||||
|
|
||||||
|
- if (et->filename)
|
||||||
|
- free(et->filename);
|
||||||
|
- if (et->function)
|
||||||
|
- free(et->function);
|
||||||
|
- if (et->message)
|
||||||
|
- free(et->message);
|
||||||
|
-
|
||||||
|
- memset(et, '\0', sizeof(*et));
|
||||||
|
+ clear_error_entry(et);
|
||||||
|
}
|
||||||
|
free(error_table);
|
||||||
|
}
|
||||||
|
@@ -182,3 +201,5 @@ efi_get_verbose(void)
|
||||||
|
{
|
||||||
|
return efi_verbose;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+// vim:fenc=utf-8:tw=75:noet
|
||||||
|
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
|
||||||
|
index ad6449d9d93..dabf41789e5 100644
|
||||||
|
--- a/src/include/efivar/efivar.h
|
||||||
|
+++ b/src/include/efivar/efivar.h
|
||||||
|
@@ -187,6 +187,7 @@ extern int efi_error_set(const char *filename,
|
||||||
|
__attribute__((__nonnull__ (1, 2, 5)))
|
||||||
|
__attribute__((__format__ (printf, 5, 6)));
|
||||||
|
extern void efi_error_clear(void);
|
||||||
|
+extern void efi_error_pop(void);
|
||||||
|
#else
|
||||||
|
static inline int
|
||||||
|
__attribute__((__nonnull__ (2, 3, 4, 5, 6)))
|
||||||
|
@@ -218,6 +219,12 @@ efi_error_clear(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+static inline void
|
||||||
|
+efi_error_pop(void)
|
||||||
|
+{
|
||||||
|
+ return;
|
||||||
|
+}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define efi_error_real__(errval, file, function, line, fmt, args...) \
|
||||||
|
@@ -238,3 +245,5 @@ extern FILE * efi_get_logfile(void)
|
||||||
|
#include <efivar/efivar-dp.h>
|
||||||
|
|
||||||
|
#endif /* EFIVAR_H */
|
||||||
|
+
|
||||||
|
+// vim:fenc=utf-8:tw=75:noet
|
||||||
|
diff --git a/src/libefivar.map.in b/src/libefivar.map.in
|
||||||
|
index b5ee1ce334a..8e50d574f10 100644
|
||||||
|
--- a/src/libefivar.map.in
|
||||||
|
+++ b/src/libefivar.map.in
|
||||||
|
@@ -127,3 +127,10 @@ LIBEFIVAR_1.36 {
|
||||||
|
efi_get_verbose;
|
||||||
|
efi_get_logfile;
|
||||||
|
} LIBEFIVAR_1.35;
|
||||||
|
+
|
||||||
|
+LIBEFIVAR_1.37 {
|
||||||
|
+} LIBEFIVAR_1.36;
|
||||||
|
+
|
||||||
|
+LIBEFIVAR_1.38 {
|
||||||
|
+ global: efi_error_pop;
|
||||||
|
+} LIBEFIVAR_1.37;
|
||||||
|
diff --git a/src/linux.c b/src/linux.c
|
||||||
|
index 4bb453be834..4e102da5e24 100644
|
||||||
|
--- a/src/linux.c
|
||||||
|
+++ b/src/linux.c
|
||||||
|
@@ -405,6 +405,8 @@ struct device HIDDEN
|
||||||
|
rc = sysfs_readlink(&tmpbuf,
|
||||||
|
"block/%s/device/device/driver",
|
||||||
|
dev->disk_name);
|
||||||
|
+ if (rc >= 0 && tmpbuf)
|
||||||
|
+ efi_error_pop();
|
||||||
|
}
|
||||||
|
if (rc < 0 || !tmpbuf) {
|
||||||
|
efi_error("readlink of /sys/block/%s/device/driver failed",
|
||||||
|
@@ -626,3 +628,5 @@ get_sector_size(int filedes)
|
||||||
|
sector_size = 512;
|
||||||
|
return sector_size;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+// vim:fenc=utf-8:tw=75:et
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
215
SOURCES/0016-Always-log-to-a-memfd-regardless-of-loglevel.patch
Normal file
215
SOURCES/0016-Always-log-to-a-memfd-regardless-of-loglevel.patch
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
From 518bca17bd39d87a35b9f7c7f186f08dc9e4be15 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 28 May 2019 15:42:37 -0400
|
||||||
|
Subject: [PATCH 16/63] Always log to a memfd regardless of loglevel.
|
||||||
|
|
||||||
|
This writes all debug logs to a memfd, so that they'll always show up in
|
||||||
|
strace.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/error.c | 88 ++++++++++++++++++++++++++++++++++---
|
||||||
|
src/include/efivar/efivar.h | 7 +++
|
||||||
|
src/libefivar.map.in | 1 +
|
||||||
|
src/util.h | 26 +++++------
|
||||||
|
4 files changed, 102 insertions(+), 20 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/error.c b/src/error.c
|
||||||
|
index df03d7f45e0..5dc43197c50 100644
|
||||||
|
--- a/src/error.c
|
||||||
|
+++ b/src/error.c
|
||||||
|
@@ -26,6 +26,7 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
+#include <sys/mman.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "efiboot.h"
|
||||||
|
@@ -162,7 +163,58 @@ efi_error_pop(void)
|
||||||
|
clear_error_entry(&error_table[current]);
|
||||||
|
}
|
||||||
|
|
||||||
|
-void PUBLIC DESTRUCTOR
|
||||||
|
+static int efi_verbose;
|
||||||
|
+static FILE *efi_errlog, *efi_dbglog;
|
||||||
|
+static int efi_dbglog_fd = -1;
|
||||||
|
+static int stashed_log_level;
|
||||||
|
+static char efi_dbglog_buf[4096];
|
||||||
|
+
|
||||||
|
+void PUBLIC
|
||||||
|
+efi_stash_loglevel_(int level)
|
||||||
|
+{
|
||||||
|
+ stashed_log_level = level;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static ssize_t
|
||||||
|
+dbglog_write(void *cookie UNUSED, const char *buf, size_t size)
|
||||||
|
+{
|
||||||
|
+ FILE *log = efi_errlog ? efi_errlog : stderr;
|
||||||
|
+ ssize_t ret = size;
|
||||||
|
+
|
||||||
|
+ if (efi_get_verbose() >= stashed_log_level) {
|
||||||
|
+ ret = fwrite(buf, 1, size, log);
|
||||||
|
+ } else if (efi_dbglog_fd >= 0) {
|
||||||
|
+ lseek(efi_dbglog_fd, 0, SEEK_SET);
|
||||||
|
+ write(efi_dbglog_fd, buf, size);
|
||||||
|
+ }
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+dbglog_seek(void *cookie UNUSED, off64_t *offset, int whence)
|
||||||
|
+{
|
||||||
|
+ FILE *log = efi_errlog ? efi_errlog : stderr;
|
||||||
|
+ return fseek(log, *offset, whence);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+dbglog_close(void *cookie UNUSED)
|
||||||
|
+{
|
||||||
|
+ if (efi_dbglog_fd >= 0) {
|
||||||
|
+ close(efi_dbglog_fd);
|
||||||
|
+ efi_dbglog_fd = -1;
|
||||||
|
+ }
|
||||||
|
+ if (efi_errlog) {
|
||||||
|
+ int ret = fclose(efi_errlog);
|
||||||
|
+ efi_errlog = NULL;
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ errno = EBADF;
|
||||||
|
+ return -1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PUBLIC
|
||||||
|
efi_error_clear(void)
|
||||||
|
{
|
||||||
|
if (error_table) {
|
||||||
|
@@ -177,15 +229,39 @@ efi_error_clear(void)
|
||||||
|
current = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int efi_verbose;
|
||||||
|
-static FILE *efi_errlog;
|
||||||
|
+void DESTRUCTOR
|
||||||
|
+efi_error_fini(void)
|
||||||
|
+{
|
||||||
|
+ efi_error_clear();
|
||||||
|
+ if (efi_dbglog) {
|
||||||
|
+ fclose(efi_dbglog);
|
||||||
|
+ efi_dbglog = NULL;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void CONSTRUCTOR
|
||||||
|
+efi_error_init(void)
|
||||||
|
+{
|
||||||
|
+ cookie_io_functions_t io_funcs = {
|
||||||
|
+ .write = dbglog_write,
|
||||||
|
+ .seek = dbglog_seek,
|
||||||
|
+ .close = dbglog_close,
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ efi_dbglog_fd = memfd_create("efivar-debug.log", MFD_CLOEXEC);
|
||||||
|
+ if (efi_dbglog_fd == -1)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ efi_dbglog = fopencookie(NULL, "a", io_funcs);
|
||||||
|
+ if (efi_dbglog)
|
||||||
|
+ setvbuf(efi_dbglog, efi_dbglog_buf, _IOLBF,
|
||||||
|
+ sizeof(efi_dbglog_buf));
|
||||||
|
+}
|
||||||
|
|
||||||
|
FILE PUBLIC *
|
||||||
|
efi_get_logfile(void)
|
||||||
|
{
|
||||||
|
- if (efi_errlog)
|
||||||
|
- return efi_errlog;
|
||||||
|
- return stderr;
|
||||||
|
+ return efi_dbglog;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PUBLIC
|
||||||
|
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
|
||||||
|
index dabf41789e5..343d1c557da 100644
|
||||||
|
--- a/src/include/efivar/efivar.h
|
||||||
|
+++ b/src/include/efivar/efivar.h
|
||||||
|
@@ -188,6 +188,7 @@ extern int efi_error_set(const char *filename,
|
||||||
|
__attribute__((__format__ (printf, 5, 6)));
|
||||||
|
extern void efi_error_clear(void);
|
||||||
|
extern void efi_error_pop(void);
|
||||||
|
+extern void efi_stash_loglevel_(int level);
|
||||||
|
#else
|
||||||
|
static inline int
|
||||||
|
__attribute__((__nonnull__ (2, 3, 4, 5, 6)))
|
||||||
|
@@ -225,6 +226,12 @@ efi_error_pop(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+static inline void
|
||||||
|
+efi_stash_loglevel_(int level __attribute__((__unused__)))
|
||||||
|
+{
|
||||||
|
+ return;
|
||||||
|
+}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define efi_error_real__(errval, file, function, line, fmt, args...) \
|
||||||
|
diff --git a/src/libefivar.map.in b/src/libefivar.map.in
|
||||||
|
index 8e50d574f10..8965b729917 100644
|
||||||
|
--- a/src/libefivar.map.in
|
||||||
|
+++ b/src/libefivar.map.in
|
||||||
|
@@ -133,4 +133,5 @@ LIBEFIVAR_1.37 {
|
||||||
|
|
||||||
|
LIBEFIVAR_1.38 {
|
||||||
|
global: efi_error_pop;
|
||||||
|
+ efi_stash_loglevel_;
|
||||||
|
} LIBEFIVAR_1.37;
|
||||||
|
diff --git a/src/util.h b/src/util.h
|
||||||
|
index a6a80e754ec..337762c9902 100644
|
||||||
|
--- a/src/util.h
|
||||||
|
+++ b/src/util.h
|
||||||
|
@@ -382,15 +382,14 @@ swizzle_guid_to_uuid(efi_guid_t *guid)
|
||||||
|
|
||||||
|
#define log_(file, line, func, level, fmt, args...) \
|
||||||
|
({ \
|
||||||
|
- if (efi_get_verbose() >= level) { \
|
||||||
|
- FILE *logfile_ = efi_get_logfile(); \
|
||||||
|
- int len_ = strlen(fmt); \
|
||||||
|
- fprintf(logfile_, "%s:%d %s(): ", \
|
||||||
|
- file, line, func); \
|
||||||
|
- fprintf(logfile_, fmt, ## args); \
|
||||||
|
- if (!len_ || fmt[len_ - 1] != '\n') \
|
||||||
|
- fprintf(logfile_, "\n"); \
|
||||||
|
- } \
|
||||||
|
+ efi_stash_loglevel_(level); \
|
||||||
|
+ FILE *logfile_ = efi_get_logfile(); \
|
||||||
|
+ int len_ = strlen(fmt); \
|
||||||
|
+ fprintf(logfile_, "%s:%d %s(): ", \
|
||||||
|
+ file, line, func); \
|
||||||
|
+ fprintf(logfile_, fmt, ## args); \
|
||||||
|
+ if (!len_ || fmt[len_ - 1] != '\n') \
|
||||||
|
+ fprintf(logfile_, "\n"); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define LOG_VERBOSE 0
|
||||||
|
@@ -402,11 +401,10 @@ swizzle_guid_to_uuid(efi_guid_t *guid)
|
||||||
|
#define debug(fmt, args...) log(LOG_DEBUG, fmt, ## args)
|
||||||
|
#define log_hex_(file, line, func, level, buf, size) \
|
||||||
|
({ \
|
||||||
|
- if (efi_get_verbose() >= level) { \
|
||||||
|
- fhexdumpf(efi_get_logfile(), "%s:%d %s(): ", \
|
||||||
|
- (uint8_t *)buf, size, \
|
||||||
|
- file, line, func); \
|
||||||
|
- } \
|
||||||
|
+ efi_stash_loglevel_(level); \
|
||||||
|
+ fhexdumpf(efi_get_logfile(), "%s:%d %s(): ", \
|
||||||
|
+ (uint8_t *)buf, size, \
|
||||||
|
+ file, line, func); \
|
||||||
|
})
|
||||||
|
#define log_hex(level, buf, size) log_hex_(__FILE__, __LINE__, __func__, level, buf, size)
|
||||||
|
#define debug_hex(buf, size) log_hex(LOG_DEBUG, buf, size)
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,82 @@
|
|||||||
|
From c723928663b03aed5fb74b3f821ac16a43d9118e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 28 May 2019 16:27:31 -0400
|
||||||
|
Subject: [PATCH 17/63] Always initialize any variable we use with sscanf's %n
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/linux-acpi-root.c | 2 +-
|
||||||
|
src/linux-pci-root.c | 2 +-
|
||||||
|
src/linux-pci.c | 2 +-
|
||||||
|
src/linux-soc-root.c | 2 +-
|
||||||
|
src/linux-virtblk.c | 2 +-
|
||||||
|
5 files changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/linux-acpi-root.c b/src/linux-acpi-root.c
|
||||||
|
index 30728ded671..b237039685e 100644
|
||||||
|
--- a/src/linux-acpi-root.c
|
||||||
|
+++ b/src/linux-acpi-root.c
|
||||||
|
@@ -44,7 +44,7 @@ static ssize_t
|
||||||
|
parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos;
|
||||||
|
+ int pos = 0;
|
||||||
|
uint16_t pad0;
|
||||||
|
uint8_t pad1;
|
||||||
|
char *acpi_header = NULL;
|
||||||
|
diff --git a/src/linux-pci-root.c b/src/linux-pci-root.c
|
||||||
|
index 0605acfc7cb..0b5ad48d6db 100644
|
||||||
|
--- a/src/linux-pci-root.c
|
||||||
|
+++ b/src/linux-pci-root.c
|
||||||
|
@@ -44,7 +44,7 @@ static ssize_t
|
||||||
|
parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos;
|
||||||
|
+ int pos = 0;
|
||||||
|
uint16_t root_domain;
|
||||||
|
uint8_t root_bus;
|
||||||
|
const char *devpart = current;
|
||||||
|
diff --git a/src/linux-pci.c b/src/linux-pci.c
|
||||||
|
index 64aaefb461c..c3b9fcf9092 100644
|
||||||
|
--- a/src/linux-pci.c
|
||||||
|
+++ b/src/linux-pci.c
|
||||||
|
@@ -46,7 +46,7 @@ static ssize_t
|
||||||
|
parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos;
|
||||||
|
+ int pos = 0;
|
||||||
|
const char *devpart = current;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
diff --git a/src/linux-soc-root.c b/src/linux-soc-root.c
|
||||||
|
index 373cd59521a..cbb4779b6fb 100644
|
||||||
|
--- a/src/linux-soc-root.c
|
||||||
|
+++ b/src/linux-soc-root.c
|
||||||
|
@@ -41,7 +41,7 @@ static ssize_t
|
||||||
|
parse_soc_root(struct device *dev UNUSED, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos;
|
||||||
|
+ int pos = 0;
|
||||||
|
const char *devpart = current;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
diff --git a/src/linux-virtblk.c b/src/linux-virtblk.c
|
||||||
|
index 2e9889def2f..fe6eb873a37 100644
|
||||||
|
--- a/src/linux-virtblk.c
|
||||||
|
+++ b/src/linux-virtblk.c
|
||||||
|
@@ -48,7 +48,7 @@ static ssize_t
|
||||||
|
parse_virtblk(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
uint32_t tosser;
|
||||||
|
- int pos;
|
||||||
|
+ int pos = 0;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,126 @@
|
|||||||
|
From fbda040f70143b207ef8d0daae509d6c15ffca95 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 28 May 2019 16:08:25 -0400
|
||||||
|
Subject: [PATCH 18/63] Add efi_get_libefivar_version() and
|
||||||
|
efi_get_libefiboot_version()
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
Make.defaults | 2 +-
|
||||||
|
src/Android.mk | 4 +++-
|
||||||
|
src/creator.c | 6 ++++++
|
||||||
|
src/include/efivar/efiboot.h | 3 +++
|
||||||
|
src/include/efivar/efivar.h | 3 +++
|
||||||
|
src/lib.c | 6 ++++++
|
||||||
|
src/libefiboot.map.in | 4 ++++
|
||||||
|
src/libefivar.map.in | 1 +
|
||||||
|
8 files changed, 27 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Make.defaults b/Make.defaults
|
||||||
|
index 57cee6e82b5..6c575846687 100644
|
||||||
|
--- a/Make.defaults
|
||||||
|
+++ b/Make.defaults
|
||||||
|
@@ -18,7 +18,7 @@ CCLD_FOR_BUILD ?= $(CC_FOR_BUILD)
|
||||||
|
CCLD := $(if $(filter undefined,$(origin CCLD)),$(CC),$(CCLD))
|
||||||
|
OPTIMIZE ?= -O2 -flto
|
||||||
|
CFLAGS ?= $(OPTIMIZE) -g3
|
||||||
|
-CFLAGS := $(CFLAGS)
|
||||||
|
+CFLAGS := $(CFLAGS) -DLIBEFIVAR_VERSION=$(VERSION)
|
||||||
|
LDFLAGS ?=
|
||||||
|
LDFLAGS := $(LDFLAGS)
|
||||||
|
AR := $(CROSS_COMPILE)$(COMPILER)-ar
|
||||||
|
diff --git a/src/Android.mk b/src/Android.mk
|
||||||
|
index b3410e1f3e7..bf6cfb2e91b 100644
|
||||||
|
--- a/src/Android.mk
|
||||||
|
+++ b/src/Android.mk
|
||||||
|
@@ -46,8 +46,10 @@ LIBEFIVAR_SOURCES := \
|
||||||
|
lib.c \
|
||||||
|
vars.c
|
||||||
|
|
||||||
|
+include $(LOCAL_PATH)/../Make.version
|
||||||
|
+
|
||||||
|
LOCAL_SRC_FILES := $(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES)
|
||||||
|
-LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -std=gnu11
|
||||||
|
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -std=gnu11 -DLIBEFIVAR_VERSION=$(VERSION)
|
||||||
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||||
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_C_INCLUDES) $(LOCAL_C_INCLUDES)/efivar $(local-generated-sources-dir)
|
||||||
|
LIBEFIVAR_GUIDS_H := $(local-generated-sources-dir)/efivar/efivar-guids.h
|
||||||
|
diff --git a/src/creator.c b/src/creator.c
|
||||||
|
index 987fa033e5b..f4bb01bc4a6 100644
|
||||||
|
--- a/src/creator.c
|
||||||
|
+++ b/src/creator.c
|
||||||
|
@@ -511,3 +511,9 @@ efi_generate_ipv4_device_path(uint8_t *buf, ssize_t size,
|
||||||
|
|
||||||
|
return off;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+uint32_t PUBLIC
|
||||||
|
+efi_get_libefiboot_version(void)
|
||||||
|
+{
|
||||||
|
+ return LIBEFIVAR_VERSION;
|
||||||
|
+}
|
||||||
|
diff --git a/src/include/efivar/efiboot.h b/src/include/efivar/efiboot.h
|
||||||
|
index c2af55fbf45..2aee86d661e 100644
|
||||||
|
--- a/src/include/efivar/efiboot.h
|
||||||
|
+++ b/src/include/efivar/efiboot.h
|
||||||
|
@@ -35,4 +35,7 @@
|
||||||
|
#include <efivar/efiboot-creator.h>
|
||||||
|
#include <efivar/efiboot-loadopt.h>
|
||||||
|
|
||||||
|
+extern uint32_t efi_get_libefiboot_version(void)
|
||||||
|
+ __attribute__((__visibility__("default")));
|
||||||
|
+
|
||||||
|
#endif /* EFIBOOT_H */
|
||||||
|
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
|
||||||
|
index 343d1c557da..ff95cb10791 100644
|
||||||
|
--- a/src/include/efivar/efivar.h
|
||||||
|
+++ b/src/include/efivar/efivar.h
|
||||||
|
@@ -249,6 +249,9 @@ extern int efi_get_verbose(void)
|
||||||
|
extern FILE * efi_get_logfile(void)
|
||||||
|
__attribute__((__visibility__("default")));
|
||||||
|
|
||||||
|
+extern uint32_t efi_get_libefivar_version(void)
|
||||||
|
+ __attribute__((__visibility__("default")));
|
||||||
|
+
|
||||||
|
#include <efivar/efivar-dp.h>
|
||||||
|
|
||||||
|
#endif /* EFIVAR_H */
|
||||||
|
diff --git a/src/lib.c b/src/lib.c
|
||||||
|
index dc06fdb3c15..457a8604d5d 100644
|
||||||
|
--- a/src/lib.c
|
||||||
|
+++ b/src/lib.c
|
||||||
|
@@ -265,3 +265,9 @@ libefivar_init(void)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+uint32_t PUBLIC
|
||||||
|
+efi_get_libefivar_version(void)
|
||||||
|
+{
|
||||||
|
+ return LIBEFIVAR_VERSION;
|
||||||
|
+}
|
||||||
|
diff --git a/src/libefiboot.map.in b/src/libefiboot.map.in
|
||||||
|
index cb19d65d0e4..0771eac5639 100644
|
||||||
|
--- a/src/libefiboot.map.in
|
||||||
|
+++ b/src/libefiboot.map.in
|
||||||
|
@@ -33,3 +33,7 @@ LIBEFIBOOT_1.29 {
|
||||||
|
|
||||||
|
LIBEFIBOOT_1.30 {
|
||||||
|
} LIBEFIBOOT_1.29;
|
||||||
|
+
|
||||||
|
+LIBEFIBOOT_1.31 {
|
||||||
|
+ global: efi_get_libefiboot_version;
|
||||||
|
+} LIBEFIBOOT_1.30;
|
||||||
|
diff --git a/src/libefivar.map.in b/src/libefivar.map.in
|
||||||
|
index 8965b729917..33196fefc64 100644
|
||||||
|
--- a/src/libefivar.map.in
|
||||||
|
+++ b/src/libefivar.map.in
|
||||||
|
@@ -134,4 +134,5 @@ LIBEFIVAR_1.37 {
|
||||||
|
LIBEFIVAR_1.38 {
|
||||||
|
global: efi_error_pop;
|
||||||
|
efi_stash_loglevel_;
|
||||||
|
+ efi_get_libefivar_version;
|
||||||
|
} LIBEFIVAR_1.37;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
32
SOURCES/0019-Fix-dbglog_seek-to-update-the-offset.patch
Normal file
32
SOURCES/0019-Fix-dbglog_seek-to-update-the-offset.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From b90e0e1722ce442aec747e8d2b77dec4c05d6069 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 29 May 2019 09:28:50 -0400
|
||||||
|
Subject: [PATCH 19/63] Fix dbglog_seek() to update the offset.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/error.c | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/error.c b/src/error.c
|
||||||
|
index 5dc43197c50..5eaee84599a 100644
|
||||||
|
--- a/src/error.c
|
||||||
|
+++ b/src/error.c
|
||||||
|
@@ -194,7 +194,13 @@ static int
|
||||||
|
dbglog_seek(void *cookie UNUSED, off64_t *offset, int whence)
|
||||||
|
{
|
||||||
|
FILE *log = efi_errlog ? efi_errlog : stderr;
|
||||||
|
- return fseek(log, *offset, whence);
|
||||||
|
+ int rc;
|
||||||
|
+
|
||||||
|
+ rc = fseek(log, *offset, whence);
|
||||||
|
+ if (rc < 0)
|
||||||
|
+ return rc;
|
||||||
|
+ *offset = ftell(log);
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,70 @@
|
|||||||
|
From 9985cbbf4073ce9d0beec66bf702db9123758852 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 29 May 2019 10:11:24 -0400
|
||||||
|
Subject: [PATCH 21/63] Fix up efi_guid_cmp()'s alignment problem a different
|
||||||
|
way
|
||||||
|
|
||||||
|
With the prior fix for efi_guid_cmp()'s alignment issue, abicheck shows:
|
||||||
|
|
||||||
|
1 function with some indirect sub-type change:
|
||||||
|
|
||||||
|
[C]'function int efi_guid_cmp(void* const, void* const)' at <built-in>:34:1 has some indirect sub-type changes:
|
||||||
|
parameter 1 of type 'void* const' changed:
|
||||||
|
entity changed from 'void* const' to 'const efi_guid_t*'
|
||||||
|
type size hasn't changed
|
||||||
|
parameter 2 of type 'void* const' changed:
|
||||||
|
entity changed from 'void* const' to 'const efi_guid_t*'
|
||||||
|
type size hasn't changed
|
||||||
|
|
||||||
|
While this isn't a meaningful ABI difference in terms of linking, it is
|
||||||
|
definitely worse than having the type actually specified.
|
||||||
|
|
||||||
|
This patch changes the type back to the previous type, but also changes
|
||||||
|
the typedef to require a 1-byte alignment. This will guarantee that all
|
||||||
|
new builds of efi_guid_cmp() and related code have code generated in a
|
||||||
|
way that's compatible with any alignment, thus alleviating the issue.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/guid.c | 2 +-
|
||||||
|
src/include/efivar/efivar.h | 4 ++--
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/guid.c b/src/guid.c
|
||||||
|
index 3156b3b7c60..306c9ff8287 100644
|
||||||
|
--- a/src/guid.c
|
||||||
|
+++ b/src/guid.c
|
||||||
|
@@ -31,7 +31,7 @@
|
||||||
|
extern const efi_guid_t efi_guid_zero;
|
||||||
|
|
||||||
|
int NONNULL(1, 2) PUBLIC
|
||||||
|
-efi_guid_cmp(const void * const a, const void * const b)
|
||||||
|
+efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b)
|
||||||
|
{
|
||||||
|
return memcmp(a, b, sizeof (efi_guid_t));
|
||||||
|
}
|
||||||
|
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
|
||||||
|
index ff95cb10791..11d9a9d7b78 100644
|
||||||
|
--- a/src/include/efivar/efivar.h
|
||||||
|
+++ b/src/include/efivar/efivar.h
|
||||||
|
@@ -37,7 +37,7 @@ typedef struct {
|
||||||
|
uint16_t c;
|
||||||
|
uint16_t d;
|
||||||
|
uint8_t e[6];
|
||||||
|
-} efi_guid_t;
|
||||||
|
+} efi_guid_t __attribute__((__aligned__(1)));
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t addr[4];
|
||||||
|
@@ -128,7 +128,7 @@ extern int efi_symbol_to_guid(const char *symbol, efi_guid_t *guid)
|
||||||
|
|
||||||
|
extern int efi_guid_is_zero(const efi_guid_t *guid);
|
||||||
|
extern int efi_guid_is_empty(const efi_guid_t *guid);
|
||||||
|
-extern int efi_guid_cmp(const void * const a, const void * const b);
|
||||||
|
+extern int efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b);
|
||||||
|
|
||||||
|
/* import / export functions */
|
||||||
|
typedef struct efi_variable efi_variable_t;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
From b132f9ef8b39ae31870be685566217191f8cde6a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 29 May 2019 10:18:56 -0400
|
||||||
|
Subject: [PATCH 22/63] Fix dbglog_write() to always return the status of
|
||||||
|
write()
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/error.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/error.c b/src/error.c
|
||||||
|
index 5eaee84599a..a77b0df1feb 100644
|
||||||
|
--- a/src/error.c
|
||||||
|
+++ b/src/error.c
|
||||||
|
@@ -185,7 +185,7 @@ dbglog_write(void *cookie UNUSED, const char *buf, size_t size)
|
||||||
|
ret = fwrite(buf, 1, size, log);
|
||||||
|
} else if (efi_dbglog_fd >= 0) {
|
||||||
|
lseek(efi_dbglog_fd, 0, SEEK_SET);
|
||||||
|
- write(efi_dbglog_fd, buf, size);
|
||||||
|
+ ret = write(efi_dbglog_fd, buf, size);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,36 @@
|
|||||||
|
From a4212e47ff20b415e042682944a82623b3f75cee Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 29 May 2019 10:21:32 -0400
|
||||||
|
Subject: [PATCH 23/63] Do a better job of making sure -DLIBEFIVAR_VERSION
|
||||||
|
happens...
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
Make.defaults | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Make.defaults b/Make.defaults
|
||||||
|
index 6c575846687..80fd99eba71 100644
|
||||||
|
--- a/Make.defaults
|
||||||
|
+++ b/Make.defaults
|
||||||
|
@@ -18,7 +18,7 @@ CCLD_FOR_BUILD ?= $(CC_FOR_BUILD)
|
||||||
|
CCLD := $(if $(filter undefined,$(origin CCLD)),$(CC),$(CCLD))
|
||||||
|
OPTIMIZE ?= -O2 -flto
|
||||||
|
CFLAGS ?= $(OPTIMIZE) -g3
|
||||||
|
-CFLAGS := $(CFLAGS) -DLIBEFIVAR_VERSION=$(VERSION)
|
||||||
|
+CFLAGS := $(CFLAGS)
|
||||||
|
LDFLAGS ?=
|
||||||
|
LDFLAGS := $(LDFLAGS)
|
||||||
|
AR := $(CROSS_COMPILE)$(COMPILER)-ar
|
||||||
|
@@ -29,6 +29,8 @@ ABIDIFF := abidiff
|
||||||
|
|
||||||
|
PKGS =
|
||||||
|
|
||||||
|
+CPPFLAGS += -DLIBEFIVAR_VERSION=$(VERSION)
|
||||||
|
+
|
||||||
|
clang_cflags = -D_GNU_SOURCE -std=gnu11 -Wno-address-of-packed-member
|
||||||
|
gcc_cflags = -specs=$(TOPDIR)/gcc.specs
|
||||||
|
cflags = $(CFLAGS) -I${TOPDIR}/src/include/ \
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
102
SOURCES/0024-efi_stash_loglevel_-efi_set_loglevel.patch
Normal file
102
SOURCES/0024-efi_stash_loglevel_-efi_set_loglevel.patch
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
From 118d9afe4febf0ec6dea9327b044979588be2a60 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 29 May 2019 10:28:41 -0400
|
||||||
|
Subject: [PATCH 24/63] efi_stash_loglevel_() -> efi_set_loglevel()
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/error.c | 8 ++++----
|
||||||
|
src/include/efivar/efivar.h | 4 ++--
|
||||||
|
src/libefivar.map.in | 2 +-
|
||||||
|
src/util.h | 4 ++--
|
||||||
|
4 files changed, 9 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/error.c b/src/error.c
|
||||||
|
index a77b0df1feb..083de15e984 100644
|
||||||
|
--- a/src/error.c
|
||||||
|
+++ b/src/error.c
|
||||||
|
@@ -166,13 +166,13 @@ efi_error_pop(void)
|
||||||
|
static int efi_verbose;
|
||||||
|
static FILE *efi_errlog, *efi_dbglog;
|
||||||
|
static int efi_dbglog_fd = -1;
|
||||||
|
-static int stashed_log_level;
|
||||||
|
+static int log_level;
|
||||||
|
static char efi_dbglog_buf[4096];
|
||||||
|
|
||||||
|
void PUBLIC
|
||||||
|
-efi_stash_loglevel_(int level)
|
||||||
|
+efi_set_loglevel(int level)
|
||||||
|
{
|
||||||
|
- stashed_log_level = level;
|
||||||
|
+ log_level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
@@ -181,7 +181,7 @@ dbglog_write(void *cookie UNUSED, const char *buf, size_t size)
|
||||||
|
FILE *log = efi_errlog ? efi_errlog : stderr;
|
||||||
|
ssize_t ret = size;
|
||||||
|
|
||||||
|
- if (efi_get_verbose() >= stashed_log_level) {
|
||||||
|
+ if (efi_get_verbose() >= log_level) {
|
||||||
|
ret = fwrite(buf, 1, size, log);
|
||||||
|
} else if (efi_dbglog_fd >= 0) {
|
||||||
|
lseek(efi_dbglog_fd, 0, SEEK_SET);
|
||||||
|
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
|
||||||
|
index 11d9a9d7b78..2fdf5b93b29 100644
|
||||||
|
--- a/src/include/efivar/efivar.h
|
||||||
|
+++ b/src/include/efivar/efivar.h
|
||||||
|
@@ -188,7 +188,7 @@ extern int efi_error_set(const char *filename,
|
||||||
|
__attribute__((__format__ (printf, 5, 6)));
|
||||||
|
extern void efi_error_clear(void);
|
||||||
|
extern void efi_error_pop(void);
|
||||||
|
-extern void efi_stash_loglevel_(int level);
|
||||||
|
+extern void efi_set_loglevel(int level);
|
||||||
|
#else
|
||||||
|
static inline int
|
||||||
|
__attribute__((__nonnull__ (2, 3, 4, 5, 6)))
|
||||||
|
@@ -228,7 +228,7 @@ efi_error_pop(void)
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
-efi_stash_loglevel_(int level __attribute__((__unused__)))
|
||||||
|
+efi_set_loglevel(int level __attribute__((__unused__)))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
diff --git a/src/libefivar.map.in b/src/libefivar.map.in
|
||||||
|
index 33196fefc64..682e622c302 100644
|
||||||
|
--- a/src/libefivar.map.in
|
||||||
|
+++ b/src/libefivar.map.in
|
||||||
|
@@ -133,6 +133,6 @@ LIBEFIVAR_1.37 {
|
||||||
|
|
||||||
|
LIBEFIVAR_1.38 {
|
||||||
|
global: efi_error_pop;
|
||||||
|
- efi_stash_loglevel_;
|
||||||
|
+ efi_set_loglevel;
|
||||||
|
efi_get_libefivar_version;
|
||||||
|
} LIBEFIVAR_1.37;
|
||||||
|
diff --git a/src/util.h b/src/util.h
|
||||||
|
index 337762c9902..ec1c5f1a69a 100644
|
||||||
|
--- a/src/util.h
|
||||||
|
+++ b/src/util.h
|
||||||
|
@@ -382,7 +382,7 @@ swizzle_guid_to_uuid(efi_guid_t *guid)
|
||||||
|
|
||||||
|
#define log_(file, line, func, level, fmt, args...) \
|
||||||
|
({ \
|
||||||
|
- efi_stash_loglevel_(level); \
|
||||||
|
+ efi_set_loglevel(level); \
|
||||||
|
FILE *logfile_ = efi_get_logfile(); \
|
||||||
|
int len_ = strlen(fmt); \
|
||||||
|
fprintf(logfile_, "%s:%d %s(): ", \
|
||||||
|
@@ -401,7 +401,7 @@ swizzle_guid_to_uuid(efi_guid_t *guid)
|
||||||
|
#define debug(fmt, args...) log(LOG_DEBUG, fmt, ## args)
|
||||||
|
#define log_hex_(file, line, func, level, buf, size) \
|
||||||
|
({ \
|
||||||
|
- efi_stash_loglevel_(level); \
|
||||||
|
+ efi_set_loglevel(level); \
|
||||||
|
fhexdumpf(efi_get_logfile(), "%s:%d %s(): ", \
|
||||||
|
(uint8_t *)buf, size, \
|
||||||
|
file, line, func); \
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
38
SOURCES/0025-guids-add-grub-guid-for-grubenv.patch
Normal file
38
SOURCES/0025-guids-add-grub-guid-for-grubenv.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
From 03041ba898eef2b73e2d9b336094869cd14e307e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 17 Jun 2019 13:59:29 -0400
|
||||||
|
Subject: [PATCH 25/63] guids: add 'grub' guid for grubenv.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/guids.txt | 1 +
|
||||||
|
src/libefivar.map.in | 3 +++
|
||||||
|
2 files changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/guids.txt b/src/guids.txt
|
||||||
|
index 0d48ddbad30..2486255b26c 100644
|
||||||
|
--- a/src/guids.txt
|
||||||
|
+++ b/src/guids.txt
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
826ca512-cf10-4ac9-b187-be01496631bd sha1 SHA-1
|
||||||
|
82988420-7467-4490-9059-feb448dd1963 lenovo_me_config Lenovo ME Configuration Menu
|
||||||
|
8be4df61-93ca-11d2-aa0d-00e098032b8c global EFI Global Variable
|
||||||
|
+91376aff-cba6-42be-949d-06fde81128e8 grub GRUB
|
||||||
|
a5c059a1-94e4-4aa7-87b5-ab155c2bf072 x509_cert X.509 Certificate
|
||||||
|
a7717414-c616-4977-9420-844712a735bf rsa2048_sha256_cert RSA 2048 with SHA-256 Certificate
|
||||||
|
a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380 lenovo_diag_splash Lenovo Diagnostic Splash Screen
|
||||||
|
diff --git a/src/libefivar.map.in b/src/libefivar.map.in
|
||||||
|
index 682e622c302..54bfb765998 100644
|
||||||
|
--- a/src/libefivar.map.in
|
||||||
|
+++ b/src/libefivar.map.in
|
||||||
|
@@ -135,4 +135,7 @@ LIBEFIVAR_1.38 {
|
||||||
|
global: efi_error_pop;
|
||||||
|
efi_set_loglevel;
|
||||||
|
efi_get_libefivar_version;
|
||||||
|
+ efi_guid_grub;
|
||||||
|
+ efi_variable_alloc;
|
||||||
|
+ efi_variable_export_dmpstore;
|
||||||
|
} LIBEFIVAR_1.37;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
30
SOURCES/0026-gcc.specs-add-grecord-gcc-switches.patch
Normal file
30
SOURCES/0026-gcc.specs-add-grecord-gcc-switches.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From a2ea4f82a036756978e54f6f604f65aa81869051 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 17 Jun 2019 14:00:05 -0400
|
||||||
|
Subject: [PATCH 26/63] gcc.specs: add -grecord-gcc-switches
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
gcc.specs | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gcc.specs b/gcc.specs
|
||||||
|
index 45d43d11294..d06a8e096fc 100644
|
||||||
|
--- a/gcc.specs
|
||||||
|
+++ b/gcc.specs
|
||||||
|
@@ -8,10 +8,10 @@
|
||||||
|
+ %(efivar_cpp_options)
|
||||||
|
|
||||||
|
*cc1_options:
|
||||||
|
-+ %(efivar_cpp_options) -Wmaybe-uninitialized -fno-merge-constants -fvisibility=hidden %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}
|
||||||
|
++ %(efivar_cpp_options) -Wmaybe-uninitialized -fno-merge-constants -fvisibility=hidden %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} -grecord-gcc-switches
|
||||||
|
|
||||||
|
*self_spec:
|
||||||
|
-+ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now}
|
||||||
|
++ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches
|
||||||
|
|
||||||
|
*link:
|
||||||
|
+ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
From 24226715b44c2e53a211112092638962123e25d7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 18 Jun 2019 10:05:11 -0400
|
||||||
|
Subject: [PATCH 27/63] Makefile: don't echo our deps submake invocation
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/Makefile b/src/Makefile
|
||||||
|
index 76bc4748eb1..ecbbc02e1f7 100644
|
||||||
|
--- a/src/Makefile
|
||||||
|
+++ b/src/Makefile
|
||||||
|
@@ -84,7 +84,7 @@ libefiboot.so : LIBS=efivar
|
||||||
|
libefiboot.so : MAP=libefiboot.map
|
||||||
|
|
||||||
|
deps : $(ALL_SOURCES)
|
||||||
|
- $(MAKE) -f $(SRCDIR)/Make.deps deps SOURCES="$(ALL_SOURCES)"
|
||||||
|
+ @$(MAKE) -f $(SRCDIR)/Make.deps deps SOURCES="$(ALL_SOURCES)"
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@rm -rfv *~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
From 7cfb9bd539ced0fd6fe35e7c08326bc3011d059b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 18 Jun 2019 11:06:09 -0400
|
||||||
|
Subject: [PATCH 28/63] Make: Add some more stuff to the toplevel 'clean'
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 8c67b9d2654..9c2620cb485 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -49,7 +49,7 @@ clean :
|
||||||
|
@set -e ; for x in $(SUBDIRS) ; do \
|
||||||
|
$(MAKE) -C $$x $@ ; \
|
||||||
|
done
|
||||||
|
- @rm -vf efivar.spec
|
||||||
|
+ @rm -vf efivar.spec vgcore.* core.*
|
||||||
|
|
||||||
|
test-archive: abicheck efivar.spec
|
||||||
|
@rm -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
From 20928bf97924328d41010aecdbf925c37f633739 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 19 Jun 2019 11:35:28 -0400
|
||||||
|
Subject: [PATCH 29/63] Make scan build rules slightly more intuitive.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
Make.scan-build | 7 +++----
|
||||||
|
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Make.scan-build b/Make.scan-build
|
||||||
|
index 7d684f7539f..f508e30be16 100644
|
||||||
|
--- a/Make.scan-build
|
||||||
|
+++ b/Make.scan-build
|
||||||
|
@@ -12,10 +12,9 @@ scan-build : | scan-test
|
||||||
|
scan-build : clean
|
||||||
|
scan-build -o scan-results make $(DASHJ) CC=clang all
|
||||||
|
|
||||||
|
-scan-build-all : | scan-test
|
||||||
|
-scan-build-all : clean
|
||||||
|
- scan-build -o scan-results make $(DASHJ) CC=clang all
|
||||||
|
+scan-build-all: | scan-build
|
||||||
|
+scan : | scan-build
|
||||||
|
|
||||||
|
-.PHONY : scan-build scan-clean
|
||||||
|
+.PHONY : scan-build scan-clean scan-build-all scan
|
||||||
|
|
||||||
|
# vim:ft=make
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
1511
SOURCES/0030-Local-header-whitespace-cleanup.patch
Normal file
1511
SOURCES/0030-Local-header-whitespace-cleanup.patch
Normal file
File diff suppressed because it is too large
Load Diff
97
SOURCES/0031-Exported-header-whitespace-cleanup.patch
Normal file
97
SOURCES/0031-Exported-header-whitespace-cleanup.patch
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
From ce7434210d92f0eca1f8e90b82ff4078202c2da9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 17 Jun 2019 14:27:08 -0400
|
||||||
|
Subject: [PATCH 31/63] Exported header whitespace cleanup.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/include/efivar/efiboot-creator.h | 2 ++
|
||||||
|
src/include/efivar/efiboot-loadopt.h | 2 ++
|
||||||
|
src/include/efivar/efiboot.h | 4 +++-
|
||||||
|
src/include/efivar/efivar-dp.h | 8 +++++---
|
||||||
|
src/include/efivar/efivar.h | 8 ++++----
|
||||||
|
5 files changed, 16 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/include/efivar/efiboot-creator.h b/src/include/efivar/efiboot-creator.h
|
||||||
|
index b56e836d2e5..b6e094c637c 100644
|
||||||
|
--- a/src/include/efivar/efiboot-creator.h
|
||||||
|
+++ b/src/include/efivar/efiboot-creator.h
|
||||||
|
@@ -58,3 +58,5 @@ extern ssize_t efi_generate_ipv4_device_path(uint8_t *buf, ssize_t size,
|
||||||
|
__attribute__((__visibility__ ("default")));
|
||||||
|
|
||||||
|
#endif /* _EFIBOOT_CREATOR_H */
|
||||||
|
+
|
||||||
|
+// vim:fenc=utf-8:tw=75:noet
|
||||||
|
diff --git a/src/include/efivar/efiboot-loadopt.h b/src/include/efivar/efiboot-loadopt.h
|
||||||
|
index efc29c69d47..97b7892f4b8 100644
|
||||||
|
--- a/src/include/efivar/efiboot-loadopt.h
|
||||||
|
+++ b/src/include/efivar/efiboot-loadopt.h
|
||||||
|
@@ -74,3 +74,5 @@ extern int efi_loadopt_is_valid(efi_load_option *opt, size_t size)
|
||||||
|
__attribute__((__visibility__ ("default")));
|
||||||
|
|
||||||
|
#endif /* _EFIBOOT_LOADOPT_H */
|
||||||
|
+
|
||||||
|
+// vim:fenc=utf-8:tw=75:noet
|
||||||
|
diff --git a/src/include/efivar/efiboot.h b/src/include/efivar/efiboot.h
|
||||||
|
index 2aee86d661e..8ae51ffa2a7 100644
|
||||||
|
--- a/src/include/efivar/efiboot.h
|
||||||
|
+++ b/src/include/efivar/efiboot.h
|
||||||
|
@@ -36,6 +36,8 @@
|
||||||
|
#include <efivar/efiboot-loadopt.h>
|
||||||
|
|
||||||
|
extern uint32_t efi_get_libefiboot_version(void)
|
||||||
|
- __attribute__((__visibility__("default")));
|
||||||
|
+ __attribute__((__visibility__("default")));
|
||||||
|
|
||||||
|
#endif /* EFIBOOT_H */
|
||||||
|
+
|
||||||
|
+// vim:fenc=utf-8:tw=75:noet
|
||||||
|
diff --git a/src/include/efivar/efivar-dp.h b/src/include/efivar/efivar-dp.h
|
||||||
|
index eab04f2dfac..57453548701 100644
|
||||||
|
--- a/src/include/efivar/efivar-dp.h
|
||||||
|
+++ b/src/include/efivar/efivar-dp.h
|
||||||
|
@@ -135,9 +135,9 @@ typedef struct {
|
||||||
|
} EFIVAR_PACKED efidp_acpi_hid_ex;
|
||||||
|
extern ssize_t
|
||||||
|
efidp_make_acpi_hid_ex(uint8_t *buf, ssize_t size,
|
||||||
|
- uint32_t hid, uint32_t uid, uint32_t cid,
|
||||||
|
- const char *hidstr, const char *uidstr,
|
||||||
|
- const char *cidstr);
|
||||||
|
+ uint32_t hid, uint32_t uid, uint32_t cid,
|
||||||
|
+ const char *hidstr, const char *uidstr,
|
||||||
|
+ const char *cidstr);
|
||||||
|
|
||||||
|
#define EFIDP_PNP_EISA_ID_CONST 0x41d0
|
||||||
|
#define EFIDP_PNP_ACPI_ID_CONST 0x8e09
|
||||||
|
@@ -1257,3 +1257,5 @@ extern ssize_t efidp_make_generic(uint8_t *buf, ssize_t size, uint8_t type,
|
||||||
|
EFIDP_END_INSTANCE, sizeof (efidp_header));
|
||||||
|
|
||||||
|
#endif /* _EFIVAR_DP_H */
|
||||||
|
+
|
||||||
|
+// vim:fenc=utf-8:tw=75:noet
|
||||||
|
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
|
||||||
|
index 2fdf5b93b29..caa4adf056c 100644
|
||||||
|
--- a/src/include/efivar/efivar.h
|
||||||
|
+++ b/src/include/efivar/efivar.h
|
||||||
|
@@ -243,14 +243,14 @@ efi_set_loglevel(int level __attribute__((__unused__)))
|
||||||
|
efi_error_real__(errval, __FILE__, __func__, __LINE__, (fmt), ## args)
|
||||||
|
|
||||||
|
extern void efi_set_verbose(int verbosity, FILE *errlog)
|
||||||
|
- __attribute__((__visibility__("default")));
|
||||||
|
+ __attribute__((__visibility__("default")));
|
||||||
|
extern int efi_get_verbose(void)
|
||||||
|
- __attribute__((__visibility__("default")));
|
||||||
|
+ __attribute__((__visibility__("default")));
|
||||||
|
extern FILE * efi_get_logfile(void)
|
||||||
|
- __attribute__((__visibility__("default")));
|
||||||
|
+ __attribute__((__visibility__("default")));
|
||||||
|
|
||||||
|
extern uint32_t efi_get_libefivar_version(void)
|
||||||
|
- __attribute__((__visibility__("default")));
|
||||||
|
+ __attribute__((__visibility__("default")));
|
||||||
|
|
||||||
|
#include <efivar/efivar-dp.h>
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
5136
SOURCES/0032-Main-code-whitespace-cleanup.patch
Normal file
5136
SOURCES/0032-Main-code-whitespace-cleanup.patch
Normal file
File diff suppressed because it is too large
Load Diff
142
SOURCES/0033-efivar-rework-usage.patch
Normal file
142
SOURCES/0033-efivar-rework-usage.patch
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
From 5f0b2b3460dfa826d75b95450bdc2903fa59e32e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 17 Jun 2019 14:45:39 -0400
|
||||||
|
Subject: [PATCH 33/63] efivar: rework usage()
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/efivar.c | 74 ++++++++++++++++++++++++++++------------------------
|
||||||
|
1 file changed, 40 insertions(+), 34 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/efivar.c b/src/efivar.c
|
||||||
|
index df075809db5..7f16ab15bab 100644
|
||||||
|
--- a/src/efivar.c
|
||||||
|
+++ b/src/efivar.c
|
||||||
|
@@ -39,10 +39,11 @@ extern int optind, opterr, optopt;
|
||||||
|
|
||||||
|
#include "efivar.h"
|
||||||
|
|
||||||
|
-#define ACTION_LIST 0x1
|
||||||
|
-#define ACTION_PRINT 0x2
|
||||||
|
-#define ACTION_APPEND 0x4
|
||||||
|
-#define ACTION_LIST_GUIDS 0x8
|
||||||
|
+#define ACTION_USAGE 0x00
|
||||||
|
+#define ACTION_LIST 0x01
|
||||||
|
+#define ACTION_PRINT 0x02
|
||||||
|
+#define ACTION_APPEND 0x04
|
||||||
|
+#define ACTION_LIST_GUIDS 0x08
|
||||||
|
#define ACTION_WRITE 0x10
|
||||||
|
#define ACTION_PRINT_DEC 0x20
|
||||||
|
|
||||||
|
@@ -326,7 +327,7 @@ validate_name(const char *name)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-prepare_data(const char *filename, void **data, size_t *data_size)
|
||||||
|
+prepare_data(const char *filename, uint8_t **data, size_t *data_size)
|
||||||
|
{
|
||||||
|
int fd = -1;
|
||||||
|
void *buf;
|
||||||
|
@@ -365,25 +366,29 @@ err:
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void
|
||||||
|
-usage(const char *progname)
|
||||||
|
+static void __attribute__((__noreturn__))
|
||||||
|
+usage(int ret)
|
||||||
|
{
|
||||||
|
- printf("Usage: %s [OPTION...]\n", basename(progname));
|
||||||
|
- printf(" -l, --list list current variables\n");
|
||||||
|
- printf(" -p, --print print variable specified by --name\n");
|
||||||
|
- printf(" -d, --print-decimal print variable in decimal values specified\n");
|
||||||
|
- printf(" by --name\n");
|
||||||
|
- printf(" -n, --name=<guid-name> variable to manipulate, in the form\n");
|
||||||
|
- printf(" 8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0000\n");
|
||||||
|
- printf(" -a, --append append to variable specified by --name\n");
|
||||||
|
- printf(" -f, --fromfile=<file> use data from <file>\n");
|
||||||
|
- printf(" -t, --attributes=<attributes> attributes to use on append\n");
|
||||||
|
- printf(" -L, --list-guids show internal guid list\n");
|
||||||
|
- printf(" -w, --write write to variable specified by --name\n\n");
|
||||||
|
- printf("Help options:\n");
|
||||||
|
- printf(" -?, --help Show this help message\n");
|
||||||
|
- printf(" --usage Display brief usage message\n");
|
||||||
|
- return;
|
||||||
|
+ FILE *out = ret == 0 ? stdout : stderr;
|
||||||
|
+ fprintf(out,
|
||||||
|
+ "Usage: %s [OPTION...]\n"
|
||||||
|
+ " -l, --list list current variables\n"
|
||||||
|
+ " -p, --print print variable specified by --name\n"
|
||||||
|
+ " -d, --print-decimal print variable in decimal values specified\n"
|
||||||
|
+ " by --name\n"
|
||||||
|
+ " -n, --name=<guid-name> variable to manipulate, in the form\n"
|
||||||
|
+ " 8be4df61-93ca-11d2-aa0d-00e098032b8c-Boot0000\n"
|
||||||
|
+ " -a, --append append to variable specified by --name\n"
|
||||||
|
+ " -e, --export=<file> export variable to <file>\n"
|
||||||
|
+ " -f, --fromfile=<file> use data from <file>\n"
|
||||||
|
+ " -t, --attributes=<attributes> attributes to use on append\n"
|
||||||
|
+ " -L, --list-guids show internal guid list\n"
|
||||||
|
+ " -w, --write write to variable specified by --name\n\n"
|
||||||
|
+ "Help options:\n"
|
||||||
|
+ " -?, --help Show this help message\n"
|
||||||
|
+ " --usage Display brief usage message\n",
|
||||||
|
+ program_invocation_short_name);
|
||||||
|
+ exit(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
@@ -391,7 +396,7 @@ int main(int argc, char *argv[])
|
||||||
|
int c = 0;
|
||||||
|
int i = 0;
|
||||||
|
int action = 0;
|
||||||
|
- void *data = NULL;
|
||||||
|
+ uint8_t *data = NULL;
|
||||||
|
size_t data_size = 0;
|
||||||
|
char *name = NULL;
|
||||||
|
char *file = NULL;
|
||||||
|
@@ -434,10 +439,10 @@ int main(int argc, char *argv[])
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
attributes = strtoul(optarg, NULL, 10);
|
||||||
|
- if (errno == ERANGE || errno == EINVAL) {
|
||||||
|
- fprintf(stderr, "invalid argument for -t: %s: %s\n", optarg, strerror(errno));
|
||||||
|
- return EXIT_FAILURE;
|
||||||
|
- }
|
||||||
|
+ if (errno == ERANGE || errno == EINVAL)
|
||||||
|
+ err(1,
|
||||||
|
+ "invalid argument for -t: %s: %m\n",
|
||||||
|
+ optarg);
|
||||||
|
break;
|
||||||
|
case 'L':
|
||||||
|
action |= ACTION_LIST_GUIDS;
|
||||||
|
@@ -446,13 +451,11 @@ int main(int argc, char *argv[])
|
||||||
|
action |= ACTION_WRITE;
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
- usage(argv[0]);
|
||||||
|
- return EXIT_SUCCESS;
|
||||||
|
+ usage(EXIT_SUCCESS);
|
||||||
|
+ break;
|
||||||
|
case 0:
|
||||||
|
- if (strcmp(lopts[i].name, "usage")) {
|
||||||
|
- usage(argv[0]);
|
||||||
|
- return EXIT_SUCCESS;
|
||||||
|
- }
|
||||||
|
+ if (strcmp(lopts[i].name, "usage"))
|
||||||
|
+ usage(EXIT_SUCCESS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -506,6 +509,9 @@ int main(int argc, char *argv[])
|
||||||
|
guid[i].symbol + strlen("efi_guid_"),
|
||||||
|
guid[i].symbol, guid[i].name);
|
||||||
|
}
|
||||||
|
+ case ACTION_USAGE:
|
||||||
|
+ default:
|
||||||
|
+ usage(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,431 @@
|
|||||||
|
From 70e86dc3e48345f1a961aef6173d5126edebf90a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 17 Jun 2019 14:47:24 -0400
|
||||||
|
Subject: [PATCH 34/63] Try to deal with some signof(char) != signof(uint8_t)
|
||||||
|
madness.
|
||||||
|
|
||||||
|
The 3-sign "char" type in C is so so painful sometimes. This attempts
|
||||||
|
to use -funsigned-char to avoid type-casting between (uint8_t *) and
|
||||||
|
(char *) quite so much. I'm not sure it'll pay off. The fact that
|
||||||
|
"char" is something that's not ever actually the same type as "unsigned
|
||||||
|
char" or "signed char" is still the absolute worst thing.
|
||||||
|
|
||||||
|
Why do we need signed char at all again?
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
Make.defaults | 4 +++-
|
||||||
|
gcc.specs | 4 ++--
|
||||||
|
src/dp-acpi.c | 11 ++++++-----
|
||||||
|
src/dp-hw.c | 5 +++--
|
||||||
|
src/dp-media.c | 2 +-
|
||||||
|
src/dp-message.c | 22 +++++++++++-----------
|
||||||
|
src/dp.c | 8 +++++---
|
||||||
|
src/dp.h | 18 ++++++++++--------
|
||||||
|
src/export.c | 12 ++++++------
|
||||||
|
src/include/efivar/efivar-dp.h | 10 ++++++----
|
||||||
|
src/include/efivar/efivar.h | 4 ++--
|
||||||
|
src/ucs2.h | 6 +++---
|
||||||
|
12 files changed, 58 insertions(+), 48 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Make.defaults b/Make.defaults
|
||||||
|
index 80fd99eba71..36e922f5ba7 100644
|
||||||
|
--- a/Make.defaults
|
||||||
|
+++ b/Make.defaults
|
||||||
|
@@ -31,7 +31,9 @@ PKGS =
|
||||||
|
|
||||||
|
CPPFLAGS += -DLIBEFIVAR_VERSION=$(VERSION)
|
||||||
|
|
||||||
|
-clang_cflags = -D_GNU_SOURCE -std=gnu11 -Wno-address-of-packed-member
|
||||||
|
+clang_cflags = -D_GNU_SOURCE -std=gnu11 -Wno-address-of-packed-member \
|
||||||
|
+ -funsigned-char -Wall -Wno-nonnull-compare \
|
||||||
|
+ -Werror -Wno-error=cpp
|
||||||
|
gcc_cflags = -specs=$(TOPDIR)/gcc.specs
|
||||||
|
cflags = $(CFLAGS) -I${TOPDIR}/src/include/ \
|
||||||
|
$(if $(findstring clang,$(CC)),$(clang_cflags),) \
|
||||||
|
diff --git a/gcc.specs b/gcc.specs
|
||||||
|
index d06a8e096fc..9d2b145ee6e 100644
|
||||||
|
--- a/gcc.specs
|
||||||
|
+++ b/gcc.specs
|
||||||
|
@@ -2,13 +2,13 @@
|
||||||
|
+ -D_GNU_SOURCE
|
||||||
|
|
||||||
|
*efivar_cpp_options:
|
||||||
|
- -Werror -Wall -std=gnu11 -Wextra
|
||||||
|
+ -Wall -Wno-nonnull-compare -Werror -Wno-error=cpp -std=gnu11 -Wextra -funsigned-char
|
||||||
|
|
||||||
|
*cpp_options:
|
||||||
|
+ %(efivar_cpp_options)
|
||||||
|
|
||||||
|
*cc1_options:
|
||||||
|
-+ %(efivar_cpp_options) -Wmaybe-uninitialized -fno-merge-constants -fvisibility=hidden %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} -grecord-gcc-switches
|
||||||
|
++ %(efivar_cpp_options) -Wmaybe-uninitialized -fno-merge-constants -funsigned-char -fvisibility=hidden %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} -grecord-gcc-switches
|
||||||
|
|
||||||
|
*self_spec:
|
||||||
|
+ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches
|
||||||
|
diff --git a/src/dp-acpi.c b/src/dp-acpi.c
|
||||||
|
index 2525fdfd073..02ec70eec7a 100644
|
||||||
|
--- a/src/dp-acpi.c
|
||||||
|
+++ b/src/dp-acpi.c
|
||||||
|
@@ -28,7 +28,7 @@
|
||||||
|
#include "efivar.h"
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-_format_acpi_adr(char *buf, size_t size,
|
||||||
|
+_format_acpi_adr(unsigned char *buf, size_t size,
|
||||||
|
const char *dp_type UNUSED,
|
||||||
|
const_efidp dp)
|
||||||
|
{
|
||||||
|
@@ -45,9 +45,10 @@ _format_acpi_adr(char *buf, size_t size,
|
||||||
|
format_helper(_format_acpi_adr, buf, size, off, "AcpiAdr", dp)
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-_format_acpi_hid_ex(char *buf, size_t size, const char *dp_type UNUSED,
|
||||||
|
- const_efidp dp,
|
||||||
|
- const char *hidstr, const char *cidstr, const char *uidstr)
|
||||||
|
+_format_acpi_hid_ex(unsigned char *buf, size_t size,
|
||||||
|
+ const char *dp_type UNUSED, const_efidp dp,
|
||||||
|
+ const char *hidstr, const char *cidstr,
|
||||||
|
+ const char *uidstr)
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
|
||||||
|
@@ -98,7 +99,7 @@ _format_acpi_hid_ex(char *buf, size_t size, const char *dp_type UNUSED,
|
||||||
|
hidstr, cidstr, uidstr)
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
-_format_acpi_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
+_format_acpi_dn(unsigned char *buf, size_t size, const_efidp dp)
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
const char *hidstr = NULL;
|
||||||
|
diff --git a/src/dp-hw.c b/src/dp-hw.c
|
||||||
|
index 1fe0f66e871..28998316d9d 100644
|
||||||
|
--- a/src/dp-hw.c
|
||||||
|
+++ b/src/dp-hw.c
|
||||||
|
@@ -26,7 +26,8 @@
|
||||||
|
#include "efivar.h"
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
-format_edd10_guid(char *buf, size_t size, const char *dp_type, const_efidp dp)
|
||||||
|
+format_edd10_guid(unsigned char *buf, size_t size,
|
||||||
|
+ const char *dp_type, const_efidp dp)
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
efidp_edd10 const *edd_dp = (efidp_edd10 *)dp;
|
||||||
|
@@ -36,7 +37,7 @@ format_edd10_guid(char *buf, size_t size, const char *dp_type, const_efidp dp)
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
-_format_hw_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
+_format_hw_dn(unsigned char *buf, size_t size, const_efidp dp)
|
||||||
|
{
|
||||||
|
efi_guid_t edd10_guid = EDD10_HARDWARE_VENDOR_PATH_GUID;
|
||||||
|
ssize_t off = 0;
|
||||||
|
diff --git a/src/dp-media.c b/src/dp-media.c
|
||||||
|
index 4728c326100..7f5d1c678ce 100644
|
||||||
|
--- a/src/dp-media.c
|
||||||
|
+++ b/src/dp-media.c
|
||||||
|
@@ -28,7 +28,7 @@
|
||||||
|
#include "efivar.h"
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
-_format_media_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
+_format_media_dn(unsigned char *buf, size_t size, const_efidp dp)
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
switch (dp->subtype) {
|
||||||
|
diff --git a/src/dp-message.c b/src/dp-message.c
|
||||||
|
index b88f17fb712..d00b2ad5d67 100644
|
||||||
|
--- a/src/dp-message.c
|
||||||
|
+++ b/src/dp-message.c
|
||||||
|
@@ -28,7 +28,7 @@
|
||||||
|
#include "efivar.h"
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-format_ipv4_addr_helper(char *buf, size_t size, const char *dp_type,
|
||||||
|
+format_ipv4_addr_helper(unsigned char *buf, size_t size, const char *dp_type,
|
||||||
|
const uint8_t *ipaddr, int32_t port)
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
@@ -40,7 +40,7 @@ format_ipv4_addr_helper(char *buf, size_t size, const char *dp_type,
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-format_ipv6_addr_helper(char *buf, size_t size, const char *dp_type,
|
||||||
|
+format_ipv6_addr_helper(unsigned char *buf, size_t size, const char *dp_type,
|
||||||
|
const uint8_t *ipaddr, int32_t port)
|
||||||
|
{
|
||||||
|
uint16_t *ip = (uint16_t *)ipaddr;
|
||||||
|
@@ -123,7 +123,7 @@ format_ipv6_addr_helper(char *buf, size_t size, const char *dp_type,
|
||||||
|
"IPv6", addr, port)
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-format_ip_addr_helper(char *buf, size_t size,
|
||||||
|
+format_ip_addr_helper(unsigned char *buf, size_t size,
|
||||||
|
const char *dp_type UNUSED,
|
||||||
|
int is_ipv6, const efi_ip_addr_t *addr)
|
||||||
|
{
|
||||||
|
@@ -142,7 +142,7 @@ format_ip_addr_helper(char *buf, size_t size,
|
||||||
|
dp_type, is_ipv6, addr)
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-format_uart(char *buf, size_t size,
|
||||||
|
+format_uart(unsigned char *buf, size_t size,
|
||||||
|
const char *dp_type UNUSED,
|
||||||
|
const_efidp dp)
|
||||||
|
{
|
||||||
|
@@ -162,7 +162,7 @@ format_uart(char *buf, size_t size,
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-format_sas(char *buf, size_t size,
|
||||||
|
+format_sas(unsigned char *buf, size_t size,
|
||||||
|
const char *dp_type UNUSED,
|
||||||
|
const_efidp dp)
|
||||||
|
{
|
||||||
|
@@ -232,7 +232,7 @@ format_sas(char *buf, size_t size,
|
||||||
|
dp->usb_class.device_protocol)
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-format_usb_class(char *buf, size_t size,
|
||||||
|
+format_usb_class(unsigned char *buf, size_t size,
|
||||||
|
const char *dp_type UNUSED,
|
||||||
|
const_efidp dp)
|
||||||
|
{
|
||||||
|
@@ -312,7 +312,7 @@ format_usb_class(char *buf, size_t size,
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t
|
||||||
|
-_format_message_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
+_format_message_dn(unsigned char *buf, size_t size, const_efidp dp)
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
switch (dp->subtype) {
|
||||||
|
@@ -393,7 +393,7 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
struct {
|
||||||
|
efi_guid_t guid;
|
||||||
|
char label[40];
|
||||||
|
- ssize_t (*formatter)(char *buf, size_t size,
|
||||||
|
+ ssize_t (*formatter)(unsigned char *buf, size_t size,
|
||||||
|
const char *dp_type UNUSED,
|
||||||
|
const_efidp dp);
|
||||||
|
} subtypes[] = {
|
||||||
|
@@ -417,7 +417,7 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
.label = "" }
|
||||||
|
};
|
||||||
|
char *label = NULL;
|
||||||
|
- ssize_t (*formatter)(char *buf, size_t size,
|
||||||
|
+ ssize_t (*formatter)(unsigned char *buf, size_t size,
|
||||||
|
const char *dp_type UNUSED,
|
||||||
|
const_efidp dp) = NULL;
|
||||||
|
|
||||||
|
@@ -455,8 +455,8 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
|
||||||
|
}
|
||||||
|
case EFIDP_MSG_IPv6: {
|
||||||
|
efidp_ipv6_addr const *a = &dp->ipv6_addr;
|
||||||
|
- char *addr0 = NULL;
|
||||||
|
- char *addr1 = NULL;
|
||||||
|
+ unsigned char *addr0 = NULL;
|
||||||
|
+ unsigned char *addr1 = NULL;
|
||||||
|
ssize_t tmpoff = 0;
|
||||||
|
ssize_t sz;
|
||||||
|
|
||||||
|
diff --git a/src/dp.c b/src/dp.c
|
||||||
|
index b6eea74878c..f6a4b2ddafa 100644
|
||||||
|
--- a/src/dp.c
|
||||||
|
+++ b/src/dp.c
|
||||||
|
@@ -298,7 +298,8 @@ efidp_append_instance(const_efidp dp, const_efidp dpi, efidp *out)
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t PUBLIC
|
||||||
|
-efidp_format_device_path(char *buf, size_t size, const_efidp dp, ssize_t limit)
|
||||||
|
+efidp_format_device_path(unsigned char *buf, size_t size, const_efidp dp,
|
||||||
|
+ ssize_t limit)
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
int first = 1;
|
||||||
|
@@ -402,7 +403,8 @@ efidp_format_device_path(char *buf, size_t size, const_efidp dp, ssize_t limit)
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t PUBLIC
|
||||||
|
-efidp_parse_device_node(char *path UNUSED, efidp out UNUSED, size_t size UNUSED)
|
||||||
|
+efidp_parse_device_node(unsigned char *path UNUSED,
|
||||||
|
+ efidp out UNUSED, size_t size UNUSED)
|
||||||
|
{
|
||||||
|
efi_error("not implented");
|
||||||
|
errno = -ENOSYS;
|
||||||
|
@@ -410,7 +412,7 @@ efidp_parse_device_node(char *path UNUSED, efidp out UNUSED, size_t size UNUSED)
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t PUBLIC
|
||||||
|
-efidp_parse_device_path(char *path UNUSED, efidp out UNUSED,
|
||||||
|
+efidp_parse_device_path(unsigned char *path UNUSED, efidp out UNUSED,
|
||||||
|
size_t size UNUSED)
|
||||||
|
{
|
||||||
|
efi_error("not implented");
|
||||||
|
diff --git a/src/dp.h b/src/dp.h
|
||||||
|
index 33a29db0d5d..6609b0d827e 100644
|
||||||
|
--- a/src/dp.h
|
||||||
|
+++ b/src/dp.h
|
||||||
|
@@ -88,8 +88,9 @@
|
||||||
|
})
|
||||||
|
|
||||||
|
static inline ssize_t UNUSED
|
||||||
|
-format_hex_helper(char *buf, size_t size, const char *dp_type, char *separator,
|
||||||
|
- int stride, const void * const addr, const size_t len)
|
||||||
|
+format_hex_helper(unsigned char *buf, size_t size, const char *dp_type,
|
||||||
|
+ char *separator, int stride, const void * const addr,
|
||||||
|
+ const size_t len)
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
for (size_t i = 0; i < len; i++) {
|
||||||
|
@@ -110,7 +111,8 @@ format_hex_helper(char *buf, size_t size, const char *dp_type, char *separator,
|
||||||
|
addr, len)
|
||||||
|
|
||||||
|
static inline ssize_t UNUSED
|
||||||
|
-format_vendor_helper(char *buf, size_t size, char *label, const_efidp dp)
|
||||||
|
+format_vendor_helper(unsigned char *buf, size_t size, char *label,
|
||||||
|
+ const_efidp dp)
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
ssize_t bytes = efidp_node_size(dp)
|
||||||
|
@@ -157,11 +159,11 @@ format_vendor_helper(char *buf, size_t size, char *label, const_efidp dp)
|
||||||
|
off; \
|
||||||
|
})
|
||||||
|
|
||||||
|
-extern ssize_t _format_hw_dn(char *buf, size_t size, const_efidp dp);
|
||||||
|
-extern ssize_t _format_acpi_dn(char *buf, size_t size, const_efidp dp);
|
||||||
|
-extern ssize_t _format_message_dn(char *buf, size_t size, const_efidp dp);
|
||||||
|
-extern ssize_t _format_media_dn(char *buf, size_t size, const_efidp dp);
|
||||||
|
-extern ssize_t _format_bios_boot_dn(char *buf, size_t size, const_efidp dp);
|
||||||
|
+extern ssize_t _format_hw_dn(unsigned char *buf, size_t size, const_efidp dp);
|
||||||
|
+extern ssize_t _format_acpi_dn(unsigned char *buf, size_t size, const_efidp dp);
|
||||||
|
+extern ssize_t _format_message_dn(unsigned char *buf, size_t size, const_efidp dp);
|
||||||
|
+extern ssize_t _format_media_dn(unsigned char *buf, size_t size, const_efidp dp);
|
||||||
|
+extern ssize_t _format_bios_boot_dn(unsigned char *buf, size_t size, const_efidp dp);
|
||||||
|
|
||||||
|
#define format_helper_2(name, buf, size, off, dp) ({ \
|
||||||
|
ssize_t _sz; \
|
||||||
|
diff --git a/src/export.c b/src/export.c
|
||||||
|
index 5b11ae883cf..6b78412cce1 100644
|
||||||
|
--- a/src/export.c
|
||||||
|
+++ b/src/export.c
|
||||||
|
@@ -35,7 +35,7 @@
|
||||||
|
struct efi_variable {
|
||||||
|
uint64_t attrs;
|
||||||
|
efi_guid_t *guid;
|
||||||
|
- char *name;
|
||||||
|
+ unsigned char *name;
|
||||||
|
uint8_t *data;
|
||||||
|
size_t data_size;
|
||||||
|
};
|
||||||
|
@@ -149,7 +149,7 @@ efi_variable_import(uint8_t *data, size_t size, efi_variable_t **var_out)
|
||||||
|
ssize_t NONNULL(1) PUBLIC
|
||||||
|
efi_variable_export(efi_variable_t *var, uint8_t *data, size_t size)
|
||||||
|
{
|
||||||
|
- size_t name_len = strlen(var->name);
|
||||||
|
+ size_t name_len = strlen((char *)var->name);
|
||||||
|
|
||||||
|
size_t needed = sizeof (uint32_t) /* magic */
|
||||||
|
+ sizeof (uint32_t) /* version */
|
||||||
|
@@ -233,13 +233,13 @@ efi_variable_free(efi_variable_t *var, int free_data)
|
||||||
|
}
|
||||||
|
|
||||||
|
int NONNULL(1, 2) PUBLIC
|
||||||
|
-efi_variable_set_name(efi_variable_t *var, char *name)
|
||||||
|
+efi_variable_set_name(efi_variable_t *var, unsigned char *name)
|
||||||
|
{
|
||||||
|
var->name = name;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-char PUBLIC NONNULL(1) *
|
||||||
|
+unsigned char PUBLIC NONNULL(1) *
|
||||||
|
efi_variable_get_name(efi_variable_t *var)
|
||||||
|
{
|
||||||
|
if (!var->name) {
|
||||||
|
@@ -329,10 +329,10 @@ efi_variable_realize(efi_variable_t *var)
|
||||||
|
}
|
||||||
|
uint32_t attrs = var->attrs & ATTRS_MASK;
|
||||||
|
if (attrs & EFI_VARIABLE_APPEND_WRITE) {
|
||||||
|
- return efi_append_variable(*var->guid, var->name,
|
||||||
|
+ return efi_append_variable(*var->guid, (char *)var->name,
|
||||||
|
var->data, var->data_size, attrs);
|
||||||
|
}
|
||||||
|
- return efi_set_variable(*var->guid, var->name, var->data,
|
||||||
|
+ return efi_set_variable(*var->guid, (char *)var->name, var->data,
|
||||||
|
var->data_size, attrs, 0600);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/include/efivar/efivar-dp.h b/src/include/efivar/efivar-dp.h
|
||||||
|
index 57453548701..706d25bdebd 100644
|
||||||
|
--- a/src/include/efivar/efivar-dp.h
|
||||||
|
+++ b/src/include/efivar/efivar-dp.h
|
||||||
|
@@ -1240,10 +1240,12 @@ efidp_is_valid(const_efidp dp, ssize_t limit)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* and now, printing and parsing */
|
||||||
|
-extern ssize_t efidp_parse_device_node(char *path, efidp out, size_t size);
|
||||||
|
-extern ssize_t efidp_parse_device_path(char *path, efidp out, size_t size);
|
||||||
|
-extern ssize_t efidp_format_device_path(char *buf, size_t size, const_efidp dp,
|
||||||
|
- ssize_t limit);
|
||||||
|
+extern ssize_t efidp_parse_device_node(unsigned char *path,
|
||||||
|
+ efidp out, size_t size);
|
||||||
|
+extern ssize_t efidp_parse_device_path(unsigned char *path,
|
||||||
|
+ efidp out, size_t size);
|
||||||
|
+extern ssize_t efidp_format_device_path(unsigned char *buf, size_t size,
|
||||||
|
+ const_efidp dp, ssize_t limit);
|
||||||
|
extern ssize_t efidp_make_vendor(uint8_t *buf, ssize_t size, uint8_t type,
|
||||||
|
uint8_t subtype, efi_guid_t vendor_guid,
|
||||||
|
void *data, size_t data_size);
|
||||||
|
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
|
||||||
|
index caa4adf056c..729b6fe80f7 100644
|
||||||
|
--- a/src/include/efivar/efivar.h
|
||||||
|
+++ b/src/include/efivar/efivar.h
|
||||||
|
@@ -144,9 +144,9 @@ extern efi_variable_t *efi_variable_alloc(void)
|
||||||
|
__attribute__((__visibility__ ("default")));
|
||||||
|
extern void efi_variable_free(efi_variable_t *var, int free_data);
|
||||||
|
|
||||||
|
-extern int efi_variable_set_name(efi_variable_t *var, char *name)
|
||||||
|
+extern int efi_variable_set_name(efi_variable_t *var, unsigned char *name)
|
||||||
|
__attribute__((__nonnull__ (1, 2)));
|
||||||
|
-extern char *efi_variable_get_name(efi_variable_t *var)
|
||||||
|
+extern unsigned char *efi_variable_get_name(efi_variable_t *var)
|
||||||
|
__attribute__((__visibility__ ("default")))
|
||||||
|
__attribute__((__nonnull__ (1)));
|
||||||
|
|
||||||
|
diff --git a/src/ucs2.h b/src/ucs2.h
|
||||||
|
index 176f9ccac57..478de23b23f 100644
|
||||||
|
--- a/src/ucs2.h
|
||||||
|
+++ b/src/ucs2.h
|
||||||
|
@@ -47,7 +47,7 @@ ucs2size(const void *s, ssize_t limit)
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline size_t UNUSED NONNULL(1)
|
||||||
|
-utf8len(uint8_t *s, ssize_t limit)
|
||||||
|
+utf8len(const unsigned char *s, ssize_t limit)
|
||||||
|
{
|
||||||
|
ssize_t i, j;
|
||||||
|
for (i = 0, j = 0; i < (limit >= 0 ? limit : i+1) && s[i] != '\0';
|
||||||
|
@@ -64,7 +64,7 @@ utf8len(uint8_t *s, ssize_t limit)
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline size_t UNUSED NONNULL(1)
|
||||||
|
-utf8size(uint8_t *s, ssize_t limit)
|
||||||
|
+utf8size(const unsigned char *s, ssize_t limit)
|
||||||
|
{
|
||||||
|
size_t ret = utf8len(s,limit);
|
||||||
|
if (ret < (limit >= 0 ? (size_t)limit : ret+1))
|
||||||
|
@@ -129,7 +129,7 @@ ucs2_to_utf8(const void * const voidchars, ssize_t limit)
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline ssize_t UNUSED NONNULL(4)
|
||||||
|
-utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, uint8_t *utf8)
|
||||||
|
+utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, const unsigned char *utf8)
|
||||||
|
{
|
||||||
|
ssize_t req;
|
||||||
|
ssize_t i, j;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
219
SOURCES/0035-ucs2-document-things-a-little-better.patch
Normal file
219
SOURCES/0035-ucs2-document-things-a-little-better.patch
Normal file
@ -0,0 +1,219 @@
|
|||||||
|
From ee7ba570f7c555f93f41badefb63397737ef7810 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 18 Jun 2019 13:12:39 -0400
|
||||||
|
Subject: [PATCH 35/63] ucs2: document things a little better
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/ucs2.h | 135 +++++++++++++++++++++++++++++++++++++++--------------
|
||||||
|
1 file changed, 100 insertions(+), 35 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ucs2.h b/src/ucs2.h
|
||||||
|
index 478de23b23f..3f8a41d8ccc 100644
|
||||||
|
--- a/src/ucs2.h
|
||||||
|
+++ b/src/ucs2.h
|
||||||
|
@@ -22,11 +22,20 @@
|
||||||
|
#define ev_bits(val, mask, shift) \
|
||||||
|
(((val) & ((mask) << (shift))) >> (shift))
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * ucs2len(): Count the number of characters in a UCS-2 string.
|
||||||
|
+ * s: a UCS-2 string
|
||||||
|
+ * limit: the maximum number of uint16_t bytepairs to examine
|
||||||
|
+ *
|
||||||
|
+ * returns the number of characters before NUL is found (i.e., excluding
|
||||||
|
+ * the NUL character). If limit is non-negative, no character index above
|
||||||
|
+ * limit will be accessed, and the maximum return value is limit.
|
||||||
|
+ */
|
||||||
|
static inline size_t UNUSED
|
||||||
|
-ucs2len(const void *vs, ssize_t limit)
|
||||||
|
+ucs2len(const void *s, ssize_t limit)
|
||||||
|
{
|
||||||
|
ssize_t i;
|
||||||
|
- const uint8_t *s8 = vs;
|
||||||
|
+ const uint8_t *s8 = s;
|
||||||
|
|
||||||
|
for (i = 0;
|
||||||
|
i < (limit >= 0 ? limit : i+1) && !(s8[0] == 0 && s8[1] == 0);
|
||||||
|
@@ -35,6 +44,15 @@ ucs2len(const void *vs, ssize_t limit)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * ucs2size(): count the number of bytes in use by a UCS-2 string.
|
||||||
|
+ * s: a UCS-2 string
|
||||||
|
+ * limit: the maximum number of uint16_t bytepairs to examine
|
||||||
|
+ *
|
||||||
|
+ * returns the number of bytes, including NUL, in the UCS-2 string s. If
|
||||||
|
+ * limit is non-negative, no character index above limit will be accessed,
|
||||||
|
+ * and the maximum return value is limit.
|
||||||
|
+ */
|
||||||
|
static inline size_t UNUSED
|
||||||
|
ucs2size(const void *s, ssize_t limit)
|
||||||
|
{
|
||||||
|
@@ -46,6 +64,18 @@ ucs2size(const void *s, ssize_t limit)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * utf8len(): Count the number of characters in a UTF-8 string.
|
||||||
|
+ * s: a UTF-8 string
|
||||||
|
+ * limit: the maximum number of bytes to examine
|
||||||
|
+ *
|
||||||
|
+ * returns the number of UTF-8 charters before NUL is found (i.e.,
|
||||||
|
+ * excluding the NUL character). If limit is non-negative, no character
|
||||||
|
+ * index above limit will be accessed, and the maximum return value is
|
||||||
|
+ * limit.
|
||||||
|
+ *
|
||||||
|
+ * Caveat: only good up to 3-byte sequences.
|
||||||
|
+ */
|
||||||
|
static inline size_t UNUSED NONNULL(1)
|
||||||
|
utf8len(const unsigned char *s, ssize_t limit)
|
||||||
|
{
|
||||||
|
@@ -63,6 +93,15 @@ utf8len(const unsigned char *s, ssize_t limit)
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * utf8size(): count the number of bytes in use by a UTF-8 string.
|
||||||
|
+ * s: a UTF-8 string
|
||||||
|
+ * limit: the maximum number of bytes to examine
|
||||||
|
+ *
|
||||||
|
+ * returns the number of bytes, including NUL, in the UTF-8 string s.
|
||||||
|
+ * If limit is non-negative, no character index above limit will be
|
||||||
|
+ * accessed, and the maximum return value is limit.
|
||||||
|
+ */
|
||||||
|
static inline size_t UNUSED NONNULL(1)
|
||||||
|
utf8size(const unsigned char *s, ssize_t limit)
|
||||||
|
{
|
||||||
|
@@ -72,68 +111,94 @@ utf8size(const unsigned char *s, ssize_t limit)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * ucs2_to_utf8(): convert UCS-2 to UTF-8
|
||||||
|
+ * s: the UCS-2 string
|
||||||
|
+ * limit: the maximum number of characters to copy from s, including the
|
||||||
|
+ * NUL terminator, or -1 for no limit.
|
||||||
|
+ *
|
||||||
|
+ * returns an allocated string, into which at most limit - 1 characters of
|
||||||
|
+ * UTF-8 are translated from UCS-2. The return value is *always*
|
||||||
|
+ * NUL-terminated.
|
||||||
|
+ */
|
||||||
|
static inline unsigned char * UNUSED
|
||||||
|
-ucs2_to_utf8(const void * const voidchars, ssize_t limit)
|
||||||
|
+ucs2_to_utf8(const void * const s, ssize_t limit)
|
||||||
|
{
|
||||||
|
ssize_t i, j;
|
||||||
|
- unsigned char *ret;
|
||||||
|
- const uint16_t * const chars = voidchars;
|
||||||
|
+ unsigned char *out, *ret;
|
||||||
|
+ const uint16_t * const chars = s;
|
||||||
|
|
||||||
|
if (limit < 0)
|
||||||
|
limit = ucs2len(chars, -1);
|
||||||
|
- ret = malloc(limit * 6 + 1);
|
||||||
|
- if (!ret)
|
||||||
|
+ out = malloc(limit * 6 + 1);
|
||||||
|
+ if (!out)
|
||||||
|
return NULL;
|
||||||
|
- memset(ret, 0, limit * 6 +1);
|
||||||
|
+ memset(out, 0, limit * 6 +1);
|
||||||
|
|
||||||
|
for (i=0, j=0; chars[i] && i < (limit >= 0 ? limit : i+1); i++,j++) {
|
||||||
|
if (chars[i] <= 0x7f) {
|
||||||
|
- ret[j] = chars[i];
|
||||||
|
+ out[j] = chars[i];
|
||||||
|
} else if (chars[i] > 0x7f && chars[i] <= 0x7ff) {
|
||||||
|
- ret[j++] = 0xc0 | ev_bits(chars[i], 0x1f, 6);
|
||||||
|
- ret[j] = 0x80 | ev_bits(chars[i], 0x3f, 0);
|
||||||
|
+ out[j++] = 0xc0 | ev_bits(chars[i], 0x1f, 6);
|
||||||
|
+ out[j] = 0x80 | ev_bits(chars[i], 0x3f, 0);
|
||||||
|
#if 1
|
||||||
|
} else if (chars[i] > 0x7ff) {
|
||||||
|
- ret[j++] = 0xe0 | ev_bits(chars[i], 0xf, 12);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
- ret[j] = 0x80| ev_bits(chars[i], 0x3f, 0);
|
||||||
|
+ out[j++] = 0xe0 | ev_bits(chars[i], 0xf, 12);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
+ out[j] = 0x80| ev_bits(chars[i], 0x3f, 0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
} else if (chars[i] > 0x7ff && chars[i] < 0x10000) {
|
||||||
|
- ret[j++] = 0xe0 | ev_bits(chars[i], 0xf, 12);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
- ret[j] = 0x80| ev_bits(chars[i], 0x3f, 0);
|
||||||
|
+ out[j++] = 0xe0 | ev_bits(chars[i], 0xf, 12);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
+ out[j] = 0x80| ev_bits(chars[i], 0x3f, 0);
|
||||||
|
} else if (chars[i] > 0xffff && chars[i] < 0x200000) {
|
||||||
|
- ret[j++] = 0xf0 | ev_bits(chars[i], 0x7, 18);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 12);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
- ret[j] = 0x80| ev_bits(chars[i], 0x3f, 0);
|
||||||
|
+ out[j++] = 0xf0 | ev_bits(chars[i], 0x7, 18);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 12);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
+ out[j] = 0x80| ev_bits(chars[i], 0x3f, 0);
|
||||||
|
} else if (chars[i] > 0x1fffff && chars[i] < 0x4000000) {
|
||||||
|
- ret[j++] = 0xf8 | ev_bits(chars[i], 0x3, 24);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 18);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 12);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
- ret[j] = 0x80 | ev_bits(chars[i], 0x3f, 0);
|
||||||
|
+ out[j++] = 0xf8 | ev_bits(chars[i], 0x3, 24);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 18);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 12);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
+ out[j] = 0x80 | ev_bits(chars[i], 0x3f, 0);
|
||||||
|
} else if (chars[i] > 0x3ffffff) {
|
||||||
|
- ret[j++] = 0xfc | ev_bits(chars[i], 0x1, 30);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 24);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 18);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 12);
|
||||||
|
- ret[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
- ret[j] = 0x80 | ev_bits(chars[i], 0x3f, 0);
|
||||||
|
+ out[j++] = 0xfc | ev_bits(chars[i], 0x1, 30);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 24);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 18);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 12);
|
||||||
|
+ out[j++] = 0x80 | ev_bits(chars[i], 0x3f, 6);
|
||||||
|
+ out[j] = 0x80 | ev_bits(chars[i], 0x3f, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
- ret[j] = '\0';
|
||||||
|
+ out[j++] = '\0';
|
||||||
|
+ ret = realloc(out, j);
|
||||||
|
+ if (!ret) {
|
||||||
|
+ free(out);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * utf8_to_ucs2(): convert UTF-8 to UCS-2
|
||||||
|
+ * s: the destination buffer to write to.
|
||||||
|
+ * size: the size of the allocation to write to
|
||||||
|
+ * terminate: whether or not to add a terminator to the string
|
||||||
|
+ * utf8: the utf8 source
|
||||||
|
+ *
|
||||||
|
+ * returns the number of characters written to s, including the NUL
|
||||||
|
+ * terminator if "terminate" is true, or -1 on error. In the case of an
|
||||||
|
+ * error, the buffer will not be modified.
|
||||||
|
+ */
|
||||||
|
static inline ssize_t UNUSED NONNULL(4)
|
||||||
|
-utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, const unsigned char *utf8)
|
||||||
|
+utf8_to_ucs2(void *s, ssize_t size, bool terminate, const unsigned char *utf8)
|
||||||
|
{
|
||||||
|
ssize_t req;
|
||||||
|
ssize_t i, j;
|
||||||
|
- uint16_t *ucs2 = ucs2void;
|
||||||
|
+ uint16_t *ucs2 = s;
|
||||||
|
uint16_t val16;
|
||||||
|
|
||||||
|
if (!ucs2 && size > 0) {
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,370 @@
|
|||||||
|
From 73635c7e096eb36b52c1e874f9b76856c6a41228 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 17 Jun 2019 16:37:29 -0400
|
||||||
|
Subject: [PATCH 36/63] util.h: implement add()/mul()/sub() for more integer
|
||||||
|
types.
|
||||||
|
|
||||||
|
This adds the following:
|
||||||
|
uint_add()
|
||||||
|
uint_mul()
|
||||||
|
uint_sub()
|
||||||
|
long_sub()
|
||||||
|
ulong_sub()
|
||||||
|
|
||||||
|
Additionally it renames ulong_mult() to ulong_mul() and long_mult() to
|
||||||
|
long_mul().
|
||||||
|
|
||||||
|
As before, all of these are available without caring about the types,
|
||||||
|
as if declared:
|
||||||
|
|
||||||
|
bool add(TYPE addend, TYPE addend, TYPE *sum);
|
||||||
|
bool mul(TYPE factor, TYPE factor, TYPE *product);
|
||||||
|
bool sub(TYPE minuend, TYPE subtractahend, TYPE *difference);
|
||||||
|
|
||||||
|
If overflow would occur, the pointer target for the result is not
|
||||||
|
changed and the function returns true, otherwise it returns false.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/efivar.h | 1 +
|
||||||
|
src/safemath.h | 208 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
src/util.h | 96 -----------------------
|
||||||
|
3 files changed, 209 insertions(+), 96 deletions(-)
|
||||||
|
create mode 100644 src/safemath.h
|
||||||
|
|
||||||
|
diff --git a/src/efivar.h b/src/efivar.h
|
||||||
|
index 3d4b429631e..646863d14c5 100644
|
||||||
|
--- a/src/efivar.h
|
||||||
|
+++ b/src/efivar.h
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
#include <efivar/efivar.h>
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
+#include "safemath.h"
|
||||||
|
#include "efivar_endian.h"
|
||||||
|
#include "lib.h"
|
||||||
|
#include "guid.h"
|
||||||
|
diff --git a/src/safemath.h b/src/safemath.h
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..08dfef7ec0b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/safemath.h
|
||||||
|
@@ -0,0 +1,208 @@
|
||||||
|
+/*
|
||||||
|
+ * safemath.h
|
||||||
|
+ * Copyright 2016-2019 Peter Jones <pjones@redhat.com>
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public License as
|
||||||
|
+ * published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
+ * License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ * License along with this library; if not, see
|
||||||
|
+ * <http://www.gnu.org/licenses/>.
|
||||||
|
+ *
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef SAFEMATH_H_
|
||||||
|
+#define SAFEMATH_H_
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * I'm not actually sure when these appear, but they're present in the
|
||||||
|
+ * version in front of me.
|
||||||
|
+ */
|
||||||
|
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||||
|
+#if __GNUC__ >= 5 && __GNUC_MINOR__ >= 1
|
||||||
|
+#define int_add(a, b, c) __builtin_add_overflow(a, b, c)
|
||||||
|
+#define uint_add(a, b, c) __builtin_add_overflow(a, b, c)
|
||||||
|
+#define long_add(a, b, c) __builtin_add_overflow(a, b, c)
|
||||||
|
+#define ulong_add(a, b, c) __builtin_add_overflow(a, b, c)
|
||||||
|
+
|
||||||
|
+#define int_mul(a, b, c) __builtin_mul_overflow(a, b, c)
|
||||||
|
+#define uint_mul(a, b, c) __builtin_mul_overflow(a, b, c)
|
||||||
|
+#define long_mul(a, b, c) __builtin_mul_overflow(a, b, c)
|
||||||
|
+#define ulong_mul(a, b, c) __builtin_mul_overflow(a, b, c)
|
||||||
|
+
|
||||||
|
+#define int_sub(a, b, c) __builtin_sub_overflow(a, b, c)
|
||||||
|
+#define uint_sub(a, b, c) __builtin_sub_overflow(a, b, c)
|
||||||
|
+#define long_sub(a, b, c) __builtin_sub_overflow(a, b, c)
|
||||||
|
+#define ulong_sub(a, b, c) __builtin_sub_overflow(a, b, c)
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef int_add
|
||||||
|
+#define int_add(a, b, c) ({ \
|
||||||
|
+ const int _limit = INT_MAX; \
|
||||||
|
+ long int _ret = _limit - (a); \
|
||||||
|
+ _ret = _ret > (b); \
|
||||||
|
+ if (!_ret) \
|
||||||
|
+ *(c) = ((a) + (b)); \
|
||||||
|
+ (bool)_ret; \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef uint_add
|
||||||
|
+#define uint_add(a, b, c) ({ \
|
||||||
|
+ const unsigned int _limit = UINT_MAX; \
|
||||||
|
+ unsigned int _ret = _limit - (a); \
|
||||||
|
+ _ret = _ret > (b); \
|
||||||
|
+ if (!_ret) \
|
||||||
|
+ *(c) = ((a) + (b)); \
|
||||||
|
+ (bool)_ret; \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef long_add
|
||||||
|
+#define long_add(a, b, c) ({ \
|
||||||
|
+ const long _limit = LONG_MAX; \
|
||||||
|
+ long _ret = _limit - (a); \
|
||||||
|
+ _ret = _ret > (b); \
|
||||||
|
+ if (!_ret) \
|
||||||
|
+ *(c) = ((a) + (b)); \
|
||||||
|
+ (bool)_ret; \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef ulong_add
|
||||||
|
+#define ulong_add(a, b, c) ({ \
|
||||||
|
+ const unsigned long _limit = ULONG_MAX; \
|
||||||
|
+ unsigned long _ret = _limit - (a); \
|
||||||
|
+ _ret = _ret > (b); \
|
||||||
|
+ if (!_ret) \
|
||||||
|
+ *(c) = ((a) + (b)); \
|
||||||
|
+ (bool)_ret; \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef int_mul
|
||||||
|
+#define int_mul(a, b, c) ({ \
|
||||||
|
+ int _ret; \
|
||||||
|
+ _ret = __builtin_popcount(a) + __builtin_popcount(b); \
|
||||||
|
+ _ret = _ret < ((sizeof(a) + sizeof(b)) << 4); \
|
||||||
|
+ if (!_ret) \
|
||||||
|
+ *(c) = ((a) * (b)); \
|
||||||
|
+ (bool)_ret; \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef uint_mul
|
||||||
|
+#define uint_mul(a, b, c) int_mul(a, b, c)
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef long_mul
|
||||||
|
+#define long_mul(a, b, c) int_mul(a, b, c)
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef ulong_mul
|
||||||
|
+#define ulong_mul(a, b, c) int_mul(a, b, c)
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef int_sub
|
||||||
|
+#define int_sub(a, b, c) ({ \
|
||||||
|
+ const long _min_limit = INT_MIN; \
|
||||||
|
+ const long _max_limit = INT_MAX; \
|
||||||
|
+ int _ret; \
|
||||||
|
+ _ret = _min_limit + (b); \
|
||||||
|
+ _ret = !(_ret < (a)); \
|
||||||
|
+ if (!_ret) { \
|
||||||
|
+ _ret = _max_limit - (a); \
|
||||||
|
+ _ret = _ret > (b); \
|
||||||
|
+ } \
|
||||||
|
+ if (!_ret) \
|
||||||
|
+ *(c) = ((a) - (b)); \
|
||||||
|
+ (bool)_ret; \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef uint_sub
|
||||||
|
+#define uint_sub(a, b, c) ({ \
|
||||||
|
+ const unsigned int _limit = UINT_MAX; \
|
||||||
|
+ unsigned int _ret = _limit - (a); \
|
||||||
|
+ _ret = _ret > (b); \
|
||||||
|
+ if (!_ret) \
|
||||||
|
+ *(c) = ((a) - (b)); \
|
||||||
|
+ (bool)_ret; \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef long_sub
|
||||||
|
+#define long_sub(a, b, c) ({ \
|
||||||
|
+ const long _min_limit = LONG_MIN; \
|
||||||
|
+ const long _max_limit = LONG_MAX; \
|
||||||
|
+ int _ret; \
|
||||||
|
+ _ret = _min_limit + (b); \
|
||||||
|
+ _ret = !(_ret < (a)); \
|
||||||
|
+ if (!_ret) { \
|
||||||
|
+ _ret = _max_limit - (a); \
|
||||||
|
+ _ret = _ret > (b); \
|
||||||
|
+ } \
|
||||||
|
+ if (!_ret) \
|
||||||
|
+ *(c) = ((a) - (b)); \
|
||||||
|
+ (bool)_ret; \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef ulong_sub
|
||||||
|
+#define ulong_sub(a, b, c) ({ \
|
||||||
|
+ const unsigned long _limit = ULONG_MAX; \
|
||||||
|
+ unsigned long _ret = _limit - (a); \
|
||||||
|
+ _ret = _ret > (b); \
|
||||||
|
+ if (!_ret) \
|
||||||
|
+ *(c) = ((a) - (b)); \
|
||||||
|
+ _ret; \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||||
|
+#if __GNUC__ >= 5 && __GNUC_MINOR__ >= 1
|
||||||
|
+#define add(a, b, c) _Generic((c), \
|
||||||
|
+ int *: int_add(a, b, c), \
|
||||||
|
+ unsigned int *: uint_add(a, b, c), \
|
||||||
|
+ long *: long_add(a, b, c), \
|
||||||
|
+ unsigned long *: ulong_add(a, b, c))
|
||||||
|
+#define sub(a, b, c) _Generic((c), \
|
||||||
|
+ int *: int_sub(a, b, c), \
|
||||||
|
+ unsigned int *: uint_sub(a, b, c), \
|
||||||
|
+ long *: long_sub(a, b, c), \
|
||||||
|
+ unsigned long *: ulong_sub(a, b, c))
|
||||||
|
+#define mul(a, b, c) _Generic((c), \
|
||||||
|
+ int *: int_sub(a, b, c), \
|
||||||
|
+ unsigned int *: uint_mul(a, b, c), \
|
||||||
|
+ long *: long_mul(a, b, c), \
|
||||||
|
+ unsigned long *: ulong_mul(a, b, c))
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifndef add
|
||||||
|
+#define add(a, b, c) ({ \
|
||||||
|
+ (*(c)) = ((a) + (b)); \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+#ifndef mul
|
||||||
|
+#define mul(a, b, c) ({ \
|
||||||
|
+ (*(c)) = ((a) * (b)); \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+#ifndef sub
|
||||||
|
+#define sub(a, b, c) ({ \
|
||||||
|
+ (*(c)) = ((a) - (b)); \
|
||||||
|
+ })
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#endif /* !SAFEMATH_H_ */
|
||||||
|
+// vim:fenc=utf-8:tw=75:noet
|
||||||
|
diff --git a/src/util.h b/src/util.h
|
||||||
|
index 712abea2d42..3f68d812700 100644
|
||||||
|
--- a/src/util.h
|
||||||
|
+++ b/src/util.h
|
||||||
|
@@ -61,102 +61,6 @@
|
||||||
|
#define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-/*
|
||||||
|
- * I'm not actually sure when these appear, but they're present in the
|
||||||
|
- * version in front of me.
|
||||||
|
- */
|
||||||
|
-#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||||
|
-#if __GNUC__ >= 5 && __GNUC_MINOR__ >= 1
|
||||||
|
-#define int_add(a, b, c) __builtin_add_overflow(a, b, c)
|
||||||
|
-#define long_add(a, b, c) __builtin_add_overflow(a, b, c)
|
||||||
|
-#define long_mult(a, b, c) __builtin_mul_overflow(a, b, c)
|
||||||
|
-#define ulong_add(a, b, c) __builtin_add_overflow(a, b, c)
|
||||||
|
-#define ulong_mult(a, b, c) __builtin_mul_overflow(a, b, c)
|
||||||
|
-#endif
|
||||||
|
-#endif
|
||||||
|
-#ifndef int_add
|
||||||
|
-#define int_add(a, b, c) ({ \
|
||||||
|
- const int _limit = INT_MAX; \
|
||||||
|
- int _ret; \
|
||||||
|
- _ret = _limit - ((unsigned long long)a) > \
|
||||||
|
- ((unsigned long long)b); \
|
||||||
|
- if (!_ret) \
|
||||||
|
- *(c) = ((a) + (b)); \
|
||||||
|
- _ret; \
|
||||||
|
- })
|
||||||
|
-#endif
|
||||||
|
-#ifndef long_add
|
||||||
|
-#define long_add(a, b, c) ({ \
|
||||||
|
- const long _limit = LONG_MAX; \
|
||||||
|
- int _ret; \
|
||||||
|
- _ret = _limit - ((unsigned long long)a) > \
|
||||||
|
- ((unsigned long long)b); \
|
||||||
|
- if (!_ret) \
|
||||||
|
- *(c) = ((a) + (b)); \
|
||||||
|
- _ret; \
|
||||||
|
- })
|
||||||
|
-#endif
|
||||||
|
-#ifndef long_mult
|
||||||
|
-#define long_mult(a, b, c) ({ \
|
||||||
|
- const long _limit = LONG_MAX; \
|
||||||
|
- int _ret = 1; \
|
||||||
|
- if ((a) == 0 || (b) == 0) \
|
||||||
|
- _ret = 0; \
|
||||||
|
- else \
|
||||||
|
- _ret = _limit / (a) < (b); \
|
||||||
|
- if (!_ret) \
|
||||||
|
- *(c) = ((a) * (b)); \
|
||||||
|
- _ret; \
|
||||||
|
- })
|
||||||
|
-#endif
|
||||||
|
-#ifndef ulong_add
|
||||||
|
-#define ulong_add(a, b, c) ({ \
|
||||||
|
- const unsigned long _limit = ULONG_MAX; \
|
||||||
|
- int _ret; \
|
||||||
|
- _ret = _limit - ((unsigned long long)a) > \
|
||||||
|
- ((unsigned long long)b); \
|
||||||
|
- if (!_ret) \
|
||||||
|
- *(c) = ((a) + (b)); \
|
||||||
|
- _ret; \
|
||||||
|
- })
|
||||||
|
-#endif
|
||||||
|
-#ifndef ulong_mult
|
||||||
|
-#define ulong_mult(a, b, c) ({ \
|
||||||
|
- const unsigned long _limit = ULONG_MAX; \
|
||||||
|
- int _ret = 1; \
|
||||||
|
- if ((a) == 0 || (b) == 0) \
|
||||||
|
- _ret = 0; \
|
||||||
|
- else \
|
||||||
|
- _ret = _limit / (a) < (b); \
|
||||||
|
- if (!_ret) \
|
||||||
|
- *(c) = ((a) * (b)); \
|
||||||
|
- _ret; \
|
||||||
|
- })
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||||
|
-#if __GNUC__ >= 5 && __GNUC_MINOR__ >= 1
|
||||||
|
-#define add(a, b, c) _Generic((c), \
|
||||||
|
- int *: int_add(a,b,c), \
|
||||||
|
- long *: long_add(a,b,c), \
|
||||||
|
- unsigned long *: ulong_add(a,b,c))
|
||||||
|
-#define mult(a, b, c) _Generic((c), \
|
||||||
|
- long *: long_mult(a,b,c), \
|
||||||
|
- unsigned long *: ulong_mult(a,b,c))
|
||||||
|
-#endif
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-#ifndef add
|
||||||
|
-#define add(a, b, c) ({ \
|
||||||
|
- (*(c)) = ((a) + (b)); \
|
||||||
|
- })
|
||||||
|
-#endif
|
||||||
|
-#ifndef mult
|
||||||
|
-#define mult(a, b, c) ({ \
|
||||||
|
- (*(c)) = ((a) * (b)); \
|
||||||
|
- })
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
static inline int UNUSED
|
||||||
|
read_file(int fd, uint8_t **result, size_t *bufsize)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
1194
SOURCES/0037-Implement-efivar-export-foo.var.patch
Normal file
1194
SOURCES/0037-Implement-efivar-export-foo.var.patch
Normal file
File diff suppressed because it is too large
Load Diff
187
SOURCES/0038-Add-some-test-cases-for-efivar-export-import.patch
Normal file
187
SOURCES/0038-Add-some-test-cases-for-efivar-export-import.patch
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
From 693dbef8d7d6287b438ad7e385b383f60df74a8c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 18 Jun 2019 13:21:45 -0400
|
||||||
|
Subject: [PATCH 38/63] Add some test cases for efivar export/import
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
Makefile | 3 ++
|
||||||
|
tests/.gitignore | 2 +
|
||||||
|
tests/Makefile | 86 ++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
tests/test.0.goal.var | Bin 0 -> 562 bytes
|
||||||
|
tests/test.1.goal.var | Bin 0 -> 574 bytes
|
||||||
|
tests/test.3.goal.var | Bin 0 -> 66 bytes
|
||||||
|
tests/test.4.goal.var | Bin 0 -> 365 bytes
|
||||||
|
7 files changed, 91 insertions(+)
|
||||||
|
create mode 100644 tests/.gitignore
|
||||||
|
create mode 100644 tests/Makefile
|
||||||
|
create mode 100644 tests/test.0.goal.var
|
||||||
|
create mode 100644 tests/test.1.goal.var
|
||||||
|
create mode 100644 tests/test.3.goal.var
|
||||||
|
create mode 100644 tests/test.4.goal.var
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 9c2620cb485..2d134ea9d6f 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -51,6 +51,9 @@ clean :
|
||||||
|
done
|
||||||
|
@rm -vf efivar.spec vgcore.* core.*
|
||||||
|
|
||||||
|
+test : all
|
||||||
|
+ @$(MAKE) -C tests
|
||||||
|
+
|
||||||
|
test-archive: abicheck efivar.spec
|
||||||
|
@rm -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp
|
||||||
|
@mkdir -p /tmp/efivar-$(GITTAG)-tmp
|
||||||
|
diff --git a/tests/.gitignore b/tests/.gitignore
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..a0149cf75de
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/.gitignore
|
||||||
|
@@ -0,0 +1,2 @@
|
||||||
|
+!*.var
|
||||||
|
+*.result.*
|
||||||
|
diff --git a/tests/Makefile b/tests/Makefile
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..5e0c604e355
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/Makefile
|
||||||
|
@@ -0,0 +1,86 @@
|
||||||
|
+#
|
||||||
|
+# Makefile
|
||||||
|
+# Peter Jones, 2019-06-18 11:10
|
||||||
|
+#
|
||||||
|
+
|
||||||
|
+all: clean test0 test1 test2 test3 test4
|
||||||
|
+
|
||||||
|
+GRUB_PREFIX ?= grub2
|
||||||
|
+TOPDIR ?= ..
|
||||||
|
+EFIVAR ?= ../src/efivar
|
||||||
|
+
|
||||||
|
+clean:
|
||||||
|
+ @rm -f *.result.env *.result.var
|
||||||
|
+
|
||||||
|
+test0:
|
||||||
|
+ @echo testing export to DMPSTORE format
|
||||||
|
+ @$(GRUB_PREFIX)-editenv test.0.result.env create
|
||||||
|
+ @$(GRUB_PREFIX)-editenv test.0.result.env set debug=all,-scripting,-lexer
|
||||||
|
+ @truncate -s 512 test.0.result.env
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.0.result.env -D -e test.0.result.var
|
||||||
|
+ @cmp test.0.result.var test.0.goal.var
|
||||||
|
+ @rm test.0.result.*
|
||||||
|
+ @echo passed
|
||||||
|
+
|
||||||
|
+test1:
|
||||||
|
+ @echo testing export to libefivar format
|
||||||
|
+ @$(GRUB_PREFIX)-editenv test.1.result.env create
|
||||||
|
+ @$(GRUB_PREFIX)-editenv test.1.result.env set debug=all,-scripting,-lexer
|
||||||
|
+ @truncate -s 512 test.1.result.env
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.1.result.env -e test.1.result.var
|
||||||
|
+ @cmp test.1.result.var test.1.goal.var
|
||||||
|
+ @rm test.1.result.*
|
||||||
|
+ @echo passed
|
||||||
|
+
|
||||||
|
+test2:
|
||||||
|
+ @$(GRUB_PREFIX)-editenv test.2.result.env create
|
||||||
|
+ @$(GRUB_PREFIX)-editenv test.2.result.env set debug=all,-scripting,-lexer
|
||||||
|
+ @truncate -s 512 test.2.result.env
|
||||||
|
+ @echo test importing from DMPSTORE and exporting to DMPSTORE and symbolic guid-name validation
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.2.result.env -D -e test.2.0.goal.var
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.2.0.goal.var -e test.2.0.result.var -D
|
||||||
|
+ @cmp test.2.0.result.var test.2.0.result.var
|
||||||
|
+ @rm test.2.0.*
|
||||||
|
+ @echo passed
|
||||||
|
+ @echo test importing from DMPSTORE and exporting to libefivar
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.2.result.env -D -e test.2.1.goal.var
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.2.1.goal.var -e test.2.1.result.var
|
||||||
|
+ @cmp test.2.1.result.var test.2.1.result.var
|
||||||
|
+ @rm test.2.1.*
|
||||||
|
+ @echo passed
|
||||||
|
+ @echo test importing from libefivar and exporting to DMPSTORE and mixed-case guid-name validation
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n 91376aff-cBa6-42bE-949d-06fde81128e8-GRUB_ENV -f test.2.result.env -e test.2.2.goal.var
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.2.2.goal.var -e test.2.2.result.var -D
|
||||||
|
+ @cmp test.2.2.result.var test.2.2.result.var
|
||||||
|
+ @rm test.2.2.*
|
||||||
|
+ @echo passed
|
||||||
|
+ @echo test importing from libefivar and exporting to libefivar and guid-name validation
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n 91376aff-cba6-42be-949d-06fde81128e8-GRUB_ENV -f test.2.result.env -e test.2.3.goal.var
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.2.3.goal.var -e test.2.3.result.var
|
||||||
|
+ @cmp test.2.3.result.var test.2.3.result.var
|
||||||
|
+ @rm test.2.3.* test.2.result.env
|
||||||
|
+ @echo passed
|
||||||
|
+ @echo testing efivar -L
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -L | \
|
||||||
|
+ grep -q '^{91376aff-cba6-42be-949d-06fde81128e8} {grub} efi_guid_grub GRUB$$'
|
||||||
|
+ @echo passed
|
||||||
|
+
|
||||||
|
+test3:
|
||||||
|
+ @echo testing with BootOrder variable dmpstore generated
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.3.goal.var -e test.3.0.result.var
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.3.0.result.var -e test.3.1.result.var -D
|
||||||
|
+ @cmp test.3.goal.var test.3.1.result.var
|
||||||
|
+ @rm test.3.0.result.var test.3.1.result.var
|
||||||
|
+ @echo passed
|
||||||
|
+
|
||||||
|
+test4:
|
||||||
|
+ @echo testing with ConIn variable dmpstore generated
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.4.goal.var -e test.4.0.result.var
|
||||||
|
+ @LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.4.0.result.var -e test.4.1.result.var -D
|
||||||
|
+ @cmp test.4.goal.var test.4.1.result.var
|
||||||
|
+ @rm test.4.0.result.var test.4.1.result.var
|
||||||
|
+ @echo passed
|
||||||
|
+
|
||||||
|
+.PHONY: all clean test0
|
||||||
|
+# vim:ft=make
|
||||||
|
+#
|
||||||
|
diff --git a/tests/test.0.goal.var b/tests/test.0.goal.var
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..a3bfb4db5ea49c8b26b0b9a0e118da4109969efb
|
||||||
|
GIT binary patch
|
||||||
|
literal 562
|
||||||
|
zcmWe)00Jfk26u)ahEN74hIj^720w-{py2;3^NGt&?{k_mm+kKhL5&yeKrv+n_n=TG
|
||||||
|
z1=qZ?%%c3f+|;}h1*e?+<ZP~#)TGjM+r*q49o^#OqRfJl%)E3R-JH~l)FLkBQ7~LW
|
||||||
|
Jz?Da0CID%RU7r8|
|
||||||
|
|
||||||
|
literal 0
|
||||||
|
HcmV?d00001
|
||||||
|
|
||||||
|
diff --git a/tests/test.1.goal.var b/tests/test.1.goal.var
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..7f70c93317d996c429430ec434098c0417370970
|
||||||
|
GIT binary patch
|
||||||
|
literal 574
|
||||||
|
zcmbO(djB&c0|Ns)5QD(~Ec1!WPVaM?GMDY|3qg$+LLfmV1_pPAAcjx|Cx&<iR|Y?Z
|
||||||
|
zFrc8af_qS?lY(nrS!PjwUT$h$iGov3esVTfN@`MRx@}@kj*f0|a#3bMNoHQUj&4qB
|
||||||
|
SMQRb3@+cTCAs{>T<#Pa%YGIxL
|
||||||
|
|
||||||
|
literal 0
|
||||||
|
HcmV?d00001
|
||||||
|
|
||||||
|
diff --git a/tests/test.3.goal.var b/tests/test.3.goal.var
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..972dd553e2043e782b096c9a8ad509c07b73782d
|
||||||
|
GIT binary patch
|
||||||
|
literal 66
|
||||||
|
zcmWe(U|`?_Vkd@tAS_|<XDDJwVMqm%3=E0)pLCy^d`WN>FT;Zw%-TKdKru!JW+2JL
|
||||||
|
Pz{0@Fz{b#`@+=nsxhf5!
|
||||||
|
|
||||||
|
literal 0
|
||||||
|
HcmV?d00001
|
||||||
|
|
||||||
|
diff --git a/tests/test.4.goal.var b/tests/test.4.goal.var
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..549ed5b717dd23843883d3d45f65f4dafeede870
|
||||||
|
GIT binary patch
|
||||||
|
literal 365
|
||||||
|
zcmWe)U|_IjWMFV+$Y;o7@C0HPhE#?!plIU#C*7weUlLr!%kW?Zvvv;~P>hj9gu%OZ
|
||||||
|
z#$~DL@y<Q#J=0$&6*)5V2?J$-U>bztU}R+G5@85-KlotZ&r5={co-(A+aL6;XJjEo
|
||||||
|
zduqb6`;uEO3(nFdOFQ@Rb=42T%Y6FU_2+4DG&_@MdqeKT+KtgYu1oqK#orBlKZQi?
|
||||||
|
e*A|Gbebas3YeDe^+2?h-9rgcN7(R2c?F0Zk6=943
|
||||||
|
|
||||||
|
literal 0
|
||||||
|
HcmV?d00001
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,119 @@
|
|||||||
|
From 9819ec7325089d325ff13af3c3d615209f3fb2c9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 18 Jun 2019 15:54:58 -0400
|
||||||
|
Subject: [PATCH 39/63] Fix a case clang-analyzer found where we may try to
|
||||||
|
parse a NULL
|
||||||
|
|
||||||
|
I don't think this is something that can *actually* happen - it didn't
|
||||||
|
trigger before save_variable() was added, and the save_variable() path
|
||||||
|
that calls this calls validate_name() immediately prior to this call.
|
||||||
|
validate_name() calls exit() if it's NULL. But that's weird as well,
|
||||||
|
because that's the same pattern all the other users of parse_name() use.
|
||||||
|
|
||||||
|
Anyway, this patch expands validate_name() and moves it into
|
||||||
|
parse_name() so we don't need to call it from everywhere when we're just
|
||||||
|
calling the two in a row anyway.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/efivar.c | 45 ++++++++++++++++++++++++++++++---------------
|
||||||
|
1 file changed, 30 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/efivar.c b/src/efivar.c
|
||||||
|
index 885a9af864b..8b1da8888f6 100644
|
||||||
|
--- a/src/efivar.c
|
||||||
|
+++ b/src/efivar.c
|
||||||
|
@@ -95,6 +95,34 @@ show_errors(void)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline void
|
||||||
|
+validate_name(const char *name)
|
||||||
|
+{
|
||||||
|
+ if (name == NULL) {
|
||||||
|
+err:
|
||||||
|
+ warnx("Invalid variable name \"%s\"",
|
||||||
|
+ (name == NULL) ? "(null)" : name);
|
||||||
|
+ show_errors();
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+ if (name[0] == '{') {
|
||||||
|
+ const char *next = strchr(name+1, '}');
|
||||||
|
+ if (!next)
|
||||||
|
+ goto err;
|
||||||
|
+ if (next[1] != '-')
|
||||||
|
+ goto err;
|
||||||
|
+ if (next[2] == '\000')
|
||||||
|
+ goto err;
|
||||||
|
+ } else {
|
||||||
|
+ if (strlen(name) < 38)
|
||||||
|
+ goto err;
|
||||||
|
+ if (name[8] != '-' || name[13] != '-' ||
|
||||||
|
+ name[18] != '-' || name[23] != '-' ||
|
||||||
|
+ name[36] != '-')
|
||||||
|
+ goto err;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
list_all_variables(void)
|
||||||
|
{
|
||||||
|
@@ -124,6 +152,8 @@ parse_name(const char *guid_name, char **name, efi_guid_t *guid)
|
||||||
|
|
||||||
|
const char *left, *right;
|
||||||
|
|
||||||
|
+ validate_name(guid_name);
|
||||||
|
+
|
||||||
|
left = strchr(guid_name, '{');
|
||||||
|
right = strchr(guid_name, '}');
|
||||||
|
if (left && right) {
|
||||||
|
@@ -408,16 +438,6 @@ edit_variable(const char *guid_name, void *data, size_t data_size,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void
|
||||||
|
-validate_name(const char *name)
|
||||||
|
-{
|
||||||
|
- if (name == NULL) {
|
||||||
|
- fprintf(stderr, "Invalid variable name\n");
|
||||||
|
- show_errors();
|
||||||
|
- exit(1);
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static void
|
||||||
|
prepare_data(const char *filename, uint8_t **data, size_t *data_size)
|
||||||
|
{
|
||||||
|
@@ -588,21 +608,17 @@ int main(int argc, char *argv[])
|
||||||
|
list_all_variables();
|
||||||
|
break;
|
||||||
|
case ACTION_PRINT:
|
||||||
|
- validate_name(guid_name);
|
||||||
|
show_variable(guid_name, SHOW_VERBOSE);
|
||||||
|
break;
|
||||||
|
case ACTION_PRINT_DEC | ACTION_PRINT:
|
||||||
|
- validate_name(guid_name);
|
||||||
|
show_variable(guid_name, SHOW_DECIMAL);
|
||||||
|
break;
|
||||||
|
case ACTION_APPEND | ACTION_PRINT:
|
||||||
|
- validate_name(guid_name);
|
||||||
|
prepare_data(infile, &data, &data_size);
|
||||||
|
edit_variable(guid_name, data, data_size, attributes,
|
||||||
|
EDIT_APPEND);
|
||||||
|
break;
|
||||||
|
case ACTION_WRITE | ACTION_PRINT:
|
||||||
|
- validate_name(guid_name);
|
||||||
|
prepare_data(infile, &data, &data_size);
|
||||||
|
edit_variable(guid_name, data, data_size, attributes,
|
||||||
|
EDIT_WRITE);
|
||||||
|
@@ -653,7 +669,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
efi_variable_free(var, false);
|
||||||
|
} else {
|
||||||
|
- validate_name(guid_name);
|
||||||
|
save_variable(guid_name, outfile, dmpstore);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From 4baa930ea79314e778a5ca84e3f85e94b2f9968f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Dmitry Torokhov <dtor@chromium.org>
|
||||||
|
Date: Tue, 6 Aug 2019 09:22:25 -0700
|
||||||
|
Subject: [PATCH 40/63] Make sure makeguids helper is compiled for the host's
|
||||||
|
arch
|
||||||
|
|
||||||
|
Currently makeguids is compiled with the same flags/settings as the rest
|
||||||
|
of the package, which does not work in case of cross-compiles when arch
|
||||||
|
of the build host and the target host are different. Let's force
|
||||||
|
compiling for the native host arch to avoid this issue.
|
||||||
|
|
||||||
|
Note that this is not a full cross-compile solution as this does not
|
||||||
|
account for potential differences in host/target compilers (versions,
|
||||||
|
clang vs gcc, etc), but it removes one of the issue with package build
|
||||||
|
aborting due to invalid instruction on the host.
|
||||||
|
|
||||||
|
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
|
||||||
|
---
|
||||||
|
src/Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/Makefile b/src/Makefile
|
||||||
|
index addfaa03c85..3729d2b8f35 100644
|
||||||
|
--- a/src/Makefile
|
||||||
|
+++ b/src/Makefile
|
||||||
|
@@ -52,7 +52,7 @@ include/efivar/efivar-guids.h : makeguids guids.txt
|
||||||
|
./makeguids guids.txt guids.bin names.bin \
|
||||||
|
guid-symbols.c include/efivar/efivar-guids.h
|
||||||
|
|
||||||
|
-makeguids : CPPFLAGS+=-DEFIVAR_BUILD_ENVIRONMENT
|
||||||
|
+makeguids : CPPFLAGS+=-DEFIVAR_BUILD_ENVIRONMENT -march=native
|
||||||
|
makeguids : LIBS=dl
|
||||||
|
makeguids : $(MAKEGUIDS_SOURCES)
|
||||||
|
makeguids : CCLD=$(CCLD_FOR_BUILD)
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
From 709afd3e2c946a765550992fa93adca8a88f2952 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pierre Bourdon <delroth@gmail.com>
|
||||||
|
Date: Tue, 13 Aug 2019 05:08:20 +0200
|
||||||
|
Subject: [PATCH 41/63] Makefile: sort $(wildcard) output for reproducibility
|
||||||
|
|
||||||
|
https://reproducible-builds.org/docs/stable-inputs/
|
||||||
|
|
||||||
|
This should fix reproducibility issues noticed on Debian[1] and NixOS[2]
|
||||||
|
|
||||||
|
[1] https://tests.reproducible-builds.org/debian/rb-pkg/buster/i386/diffoscope-results/efivar.html
|
||||||
|
[2] https://r13y.com/diff/b32a9d1c4159dab6aa15e873c0e5fc315ea2bdf545416d21d5b4a29f3c138727-3473019ee52f59732b13253b828bf2eb545384510f30db34413eb6c91dd3d047.html
|
||||||
|
---
|
||||||
|
src/Makefile | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/Makefile b/src/Makefile
|
||||||
|
index 3729d2b8f35..253d1f1d56c 100644
|
||||||
|
--- a/src/Makefile
|
||||||
|
+++ b/src/Makefile
|
||||||
|
@@ -15,7 +15,7 @@ TARGETS=$(LIBTARGETS) $(BINTARGETS) $(PCTARGETS)
|
||||||
|
STATICTARGETS=$(STATICLIBTARGETS) $(STATICBINTARGETS)
|
||||||
|
|
||||||
|
LIBEFIBOOT_SOURCES = crc32.c creator.c disk.c gpt.c loadopt.c path-helpers.c \
|
||||||
|
- linux.c $(wildcard linux-*.c)
|
||||||
|
+ linux.c $(sort $(wildcard linux-*.c))
|
||||||
|
LIBEFIBOOT_OBJECTS = $(patsubst %.c,%.o,$(LIBEFIBOOT_SOURCES))
|
||||||
|
LIBEFIVAR_SOURCES = crc32.c dp.c dp-acpi.c dp-hw.c dp-media.c dp-message.c \
|
||||||
|
efivarfs.c error.c export.c guid.c guids.S guid-symbols.c \
|
||||||
|
@@ -25,7 +25,7 @@ EFIVAR_SOURCES = efivar.c
|
||||||
|
GENERATED_SOURCES = include/efivar/efivar-guids.h guid-symbols.c
|
||||||
|
MAKEGUIDS_SOURCES = makeguids.c guid.c
|
||||||
|
ALL_SOURCES=$(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) $(MAKEGUIDS_SOURCES) \
|
||||||
|
- $(wildcard include/efivar/*.h) $(GENERATED_SOURCES) $(EFIVAR_SOURCES)
|
||||||
|
+ $(sort $(wildcard include/efivar/*.h)) $(GENERATED_SOURCES) $(EFIVAR_SOURCES)
|
||||||
|
|
||||||
|
$(call deps-of,$(ALL_SOURCES)) : | deps
|
||||||
|
-include $(call deps-of,$(ALL_SOURCES))
|
||||||
|
@@ -103,7 +103,7 @@ install : all
|
||||||
|
$(INSTALL) -d -m 755 $(DESTDIR)$(PCDIR)
|
||||||
|
$(foreach x, $(PCTARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)$(PCDIR) ;)
|
||||||
|
$(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/efivar
|
||||||
|
- $(foreach x, $(wildcard $(TOPDIR)/src/include/efivar/*.h), $(INSTALL) -m 644 $(x) $(DESTDIR)$(INCLUDEDIR)/efivar/$(notdir $(x));)
|
||||||
|
+ $(foreach x, $(sort $(wildcard $(TOPDIR)/src/include/efivar/*.h)), $(INSTALL) -m 644 $(x) $(DESTDIR)$(INCLUDEDIR)/efivar/$(notdir $(x));)
|
||||||
|
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
|
||||||
|
$(foreach x, $(BINTARGETS), $(INSTALL) -m 755 $(x) $(DESTDIR)$(BINDIR);)
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
22
SOURCES/0042-guids.txt-correct-sentinal-typo.patch
Normal file
22
SOURCES/0042-guids.txt-correct-sentinal-typo.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
From 636aefebf32527dc8c7a592687a9bca3bdf028d2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Will Thompson <will@willthompson.co.uk>
|
||||||
|
Date: Thu, 29 Aug 2019 10:39:39 +0100
|
||||||
|
Subject: [PATCH 42/63] guids.txt: correct "sentinal" typo
|
||||||
|
|
||||||
|
---
|
||||||
|
src/guids.txt | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/guids.txt b/src/guids.txt
|
||||||
|
index 2486255b26c..f2f0282b3be 100644
|
||||||
|
--- a/src/guids.txt
|
||||||
|
+++ b/src/guids.txt
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-00000000-0000-0000-0000-000000000000 zero zeroed sentinal guid
|
||||||
|
+00000000-0000-0000-0000-000000000000 zero zeroed sentinel guid
|
||||||
|
093e0fae-a6c4-4f50-9f1b-d41e2b89c19a sha512 SHA-512
|
||||||
|
0abba7dc-e516-4167-bbf5-4d9d1c739416 fwupdate Linux Firmware Update Tool
|
||||||
|
0b6e5233-a65c-44c9-9407-d9ab83bfc8bd sha224 SHA-224
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,73 @@
|
|||||||
|
From f46b0d46545419e9db9853fc73919064f367ca34 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Robert Bisewski <contact@ibiscybernetics.com>
|
||||||
|
Date: Wed, 25 Sep 2019 15:38:02 -0500
|
||||||
|
Subject: [PATCH 43/63] update manpage for efivar such that it reflects the
|
||||||
|
current options of the efivar util
|
||||||
|
|
||||||
|
---
|
||||||
|
docs/efivar.1 | 30 ++++++++++++++++++++++--------
|
||||||
|
1 file changed, 22 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/docs/efivar.1 b/docs/efivar.1
|
||||||
|
index e4c84bb1fe8..6a3036f5dcd 100644
|
||||||
|
--- a/docs/efivar.1
|
||||||
|
+++ b/docs/efivar.1
|
||||||
|
@@ -1,5 +1,4 @@
|
||||||
|
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.45.1.
|
||||||
|
-.TH EFIVAR "1" "June 2014" "efivar 0.10" "User Commands"
|
||||||
|
+.TH EFIVAR "1" "September 2019" "efivar 37" "User Commands"
|
||||||
|
.SH NAME
|
||||||
|
efivar \- Tool to manipulate UEFI variables
|
||||||
|
.SH SYNOPSIS
|
||||||
|
@@ -7,8 +6,8 @@ efivar \- Tool to manipulate UEFI variables
|
||||||
|
[\fI\,OPTION\/\fR...]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.TP
|
||||||
|
-\fB\-L\fR, \fB\-\-list\-guids\fR
|
||||||
|
-list guids efivar knows about
|
||||||
|
+\fB\-t\fR, \fB\-\-attributes=\fR<attributes>
|
||||||
|
+attributes to use on append
|
||||||
|
.TP
|
||||||
|
\fB\-l\fR, \fB\-\-list\fR
|
||||||
|
list current variables
|
||||||
|
@@ -16,6 +15,12 @@ list current variables
|
||||||
|
\fB\-p\fR, \fB\-\-print\fR
|
||||||
|
print variable specified by \fB\-\-name\fR
|
||||||
|
.TP
|
||||||
|
+\fB\-D\fR, \fB\-\-dmpstore\fR
|
||||||
|
+use DMPSTORE format when exporting
|
||||||
|
+.TP
|
||||||
|
+\fB\-d\fR, \fB\-\-print\-decimal\fR
|
||||||
|
+print variable in decimal format values specified by \fB\-\-name\fR
|
||||||
|
+.TP
|
||||||
|
\fB\-n\fR, \fB\-\-name=\fR<guid\-name>
|
||||||
|
variable to manipulate, in the form
|
||||||
|
8be4df61\-93ca\-11d2\-aa0d\-00e098032b8c\-Boot0000
|
||||||
|
@@ -23,11 +28,20 @@ variable to manipulate, in the form
|
||||||
|
\fB\-a\fR, \fB\-\-append\fR
|
||||||
|
append to variable specified by \fB\-\-name\fR
|
||||||
|
.TP
|
||||||
|
-\fB\-f\fR, \fB\-\-fromfile=\fR<file>
|
||||||
|
-use data from <file>
|
||||||
|
+\fB\-f\fR, \fB\-\-datafile=\fR<file>
|
||||||
|
+load or save variable contents from <file>
|
||||||
|
.TP
|
||||||
|
-\fB\-t\fR, \fB\-\-attributes=\fR<attributes>
|
||||||
|
-attributes to use on append
|
||||||
|
+\fB\-e\fR, \fB\-\-export=\fR<file>
|
||||||
|
+export variable to <file>
|
||||||
|
+.TP
|
||||||
|
+\fB\-i\fR, \fB\-\-import=\fR<file>
|
||||||
|
+import variable from <file>
|
||||||
|
+.TP
|
||||||
|
+\fB\-L\fR, \fB\-\-list\-guids\fR
|
||||||
|
+show internal guid list
|
||||||
|
+.TP
|
||||||
|
+\fB\-w\fR, \fB\-\-write\fR
|
||||||
|
+write to variable specified by \fB\-\-name\fR
|
||||||
|
.SS "Help options:"
|
||||||
|
.TP
|
||||||
|
\-?, \fB\-\-help\fR
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,53 @@
|
|||||||
|
From 150873b00fdb2d5aca2e7c66d0545ad55801409a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Fri, 11 Oct 2019 10:44:53 -0400
|
||||||
|
Subject: [PATCH 44/63] Fix some 32-bit size_t format specifier errors
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/export.c | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/export.c b/src/export.c
|
||||||
|
index cfb021525ff..732b4bf30ad 100644
|
||||||
|
--- a/src/export.c
|
||||||
|
+++ b/src/export.c
|
||||||
|
@@ -149,7 +149,7 @@ overflow:
|
||||||
|
}
|
||||||
|
|
||||||
|
crc = efi_crc32(data, size - sizeof(uint32_t));
|
||||||
|
- debug("efi_crc32(%p, %lu) -> 0x%"PRIx32", expected 0x%"PRIx32,
|
||||||
|
+ debug("efi_crc32(%p, %zu) -> 0x%"PRIx32", expected 0x%"PRIx32,
|
||||||
|
data, size - sizeof(uint32_t), crc,
|
||||||
|
*(uint32_t*)(data + size - sizeof(uint32_t)));
|
||||||
|
|
||||||
|
@@ -282,7 +282,7 @@ efi_variable_import_efivar(uint8_t *data, size_t datasz, efi_variable_t **var_ou
|
||||||
|
}
|
||||||
|
|
||||||
|
crc = efi_crc32(data, datasz - sizeof(uint32_t));
|
||||||
|
- debug("efi_crc32(%p, %lu) -> 0x%"PRIx32", expected 0x%"PRIx32,
|
||||||
|
+ debug("efi_crc32(%p, %zu) -> 0x%"PRIx32", expected 0x%"PRIx32,
|
||||||
|
data, datasz - sizeof(uint32_t), crc,
|
||||||
|
*(uint32_t*)(data + datasz - sizeof(uint32_t)));
|
||||||
|
|
||||||
|
@@ -473,7 +473,7 @@ overflow:
|
||||||
|
ptr += var->data_size;
|
||||||
|
|
||||||
|
crc = efi_crc32(data, needed - sizeof(uint32_t));
|
||||||
|
- debug("efi_crc32(%p, %lu) -> 0x%"PRIx32,
|
||||||
|
+ debug("efi_crc32(%p, %zu) -> 0x%"PRIx32,
|
||||||
|
data, needed - sizeof(uint32_t), crc);
|
||||||
|
*(uint32_t *)ptr = crc;
|
||||||
|
|
||||||
|
@@ -611,7 +611,7 @@ overflow:
|
||||||
|
ptr += var->data_size;
|
||||||
|
|
||||||
|
crc = efi_crc32(data, needed - sizeof(uint32_t));
|
||||||
|
- debug("efi_crc32(%p, %lu) -> 0x%"PRIx32,
|
||||||
|
+ debug("efi_crc32(%p, %zu) -> 0x%"PRIx32,
|
||||||
|
data, needed - sizeof(uint32_t), crc);
|
||||||
|
*(uint32_t *)ptr = crc;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
From aae6a63e34320299a3707a9a468ab78333230283 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Fri, 11 Oct 2019 10:52:12 -0400
|
||||||
|
Subject: [PATCH 45/63] Make the top level makefile not parallelize.
|
||||||
|
|
||||||
|
Right now if you run:
|
||||||
|
|
||||||
|
make
|
||||||
|
make -j9 clean all
|
||||||
|
|
||||||
|
"clean" and "all" will run in parallel, and "all" will often finish
|
||||||
|
before "clean" will. This is obviously wrong.
|
||||||
|
|
||||||
|
This patch adds .NOTPARALLEL: at the top level, so none of the top-level
|
||||||
|
targets will parallelize, because we really never want that.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 2d134ea9d6f..61b79a60369 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -83,4 +83,4 @@ archive: abicheck bumpver abidw tag efivar.spec
|
||||||
|
@rm -rf /tmp/efivar-$(GITTAG)
|
||||||
|
@echo "The archive is in efivar-$(GITTAG).tar.bz2"
|
||||||
|
|
||||||
|
-
|
||||||
|
+.NOTPARALLEL:
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
25
SOURCES/0046-guids-add-auto_created_boot_option.patch
Normal file
25
SOURCES/0046-guids-add-auto_created_boot_option.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From 8922c5692eebfe05e59bd5c4de464f3db10a69f3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Fri, 11 Oct 2019 14:30:42 -0400
|
||||||
|
Subject: [PATCH 46/63] guids: add auto_created_boot_option
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/guids.txt | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/guids.txt b/src/guids.txt
|
||||||
|
index f2f0282b3be..95d93c0df74 100644
|
||||||
|
--- a/src/guids.txt
|
||||||
|
+++ b/src/guids.txt
|
||||||
|
@@ -18,6 +18,7 @@
|
||||||
|
721c8b66-426c-4e86-8e99-3457c46ab0b9 lenovo_setup Lenovo Firmware Setup
|
||||||
|
77fa9abd-0359-4d32-bd60-28f4e78f784b microsoft Microsoft
|
||||||
|
7FACC7B6-127F-4E9C-9C5D-080F98994345 lenovo_2 Lenovo
|
||||||
|
+8108ac4e-9f11-4d59-850e-e21a522c59b2 auto_created_boot_option Automatically Created Boot Option
|
||||||
|
826ca512-cf10-4ac9-b187-be01496631bd sha1 SHA-1
|
||||||
|
82988420-7467-4490-9059-feb448dd1963 lenovo_me_config Lenovo ME Configuration Menu
|
||||||
|
8be4df61-93ca-11d2-aa0d-00e098032b8c global EFI Global Variable
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,260 @@
|
|||||||
|
From 1249545850373e9c1717eab077a74b87069e90ba Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Thu, 10 Oct 2019 13:52:22 -0400
|
||||||
|
Subject: [PATCH 47/63] Move our infrastructure makefiles out of the topdir.
|
||||||
|
|
||||||
|
No sense in leaving all this cluttering up what's usually my working
|
||||||
|
directory...
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
Makefile | 22 ++++++++++----------
|
||||||
|
docs/Makefile | 11 +++++-----
|
||||||
|
src/Android.mk | 2 +-
|
||||||
|
src/Makefile | 11 +++++-----
|
||||||
|
Make.coverity => src/include/coverity.mk | 0
|
||||||
|
Make.defaults => src/include/defaults.mk | 2 +-
|
||||||
|
Make.deprecated => src/include/deprecated.mk | 0
|
||||||
|
src/{Make.deps => include/deps.mk} | 7 +++----
|
||||||
|
gcc.specs => src/include/gcc.specs | 0
|
||||||
|
Make.rules => src/include/rules.mk | 2 +-
|
||||||
|
Make.scan-build => src/include/scan-build.mk | 0
|
||||||
|
Make.version => src/include/version.mk | 0
|
||||||
|
src/test/Makefile | 7 +++----
|
||||||
|
tests/Makefile | 3 +--
|
||||||
|
14 files changed, 31 insertions(+), 36 deletions(-)
|
||||||
|
rename Make.coverity => src/include/coverity.mk (100%)
|
||||||
|
rename Make.defaults => src/include/defaults.mk (97%)
|
||||||
|
rename Make.deprecated => src/include/deprecated.mk (100%)
|
||||||
|
rename src/{Make.deps => include/deps.mk} (65%)
|
||||||
|
rename gcc.specs => src/include/gcc.specs (100%)
|
||||||
|
rename Make.rules => src/include/rules.mk (98%)
|
||||||
|
rename Make.scan-build => src/include/scan-build.mk (100%)
|
||||||
|
rename Make.version => src/include/version.mk (100%)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 61b79a60369..7a4ac8c62e4 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -1,15 +1,15 @@
|
||||||
|
-TOPDIR = $(shell echo $$PWD)
|
||||||
|
+export TOPDIR = $(realpath $(dir $(firstword $(MAKEFILE_LIST))))
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.deprecated
|
||||||
|
-include $(TOPDIR)/Make.version
|
||||||
|
-include $(TOPDIR)/Make.rules
|
||||||
|
-include $(TOPDIR)/Make.defaults
|
||||||
|
-include $(TOPDIR)/Make.coverity
|
||||||
|
-include $(TOPDIR)/Make.scan-build
|
||||||
|
+include $(TOPDIR)/src/include/deprecated.mk
|
||||||
|
+include $(TOPDIR)/src/include/version.mk
|
||||||
|
+include $(TOPDIR)/src/include/rules.mk
|
||||||
|
+include $(TOPDIR)/src/include/defaults.mk
|
||||||
|
+include $(TOPDIR)/src/include/coverity.mk
|
||||||
|
+include $(TOPDIR)/src/include/scan-build.mk
|
||||||
|
|
||||||
|
SUBDIRS := src docs
|
||||||
|
|
||||||
|
-all : | efivar.spec Make.version
|
||||||
|
+all : | efivar.spec src/include/version.mk
|
||||||
|
all :
|
||||||
|
@set -e ; for x in $(SUBDIRS) ; do \
|
||||||
|
$(MAKE) -C $$x $@ ; \
|
||||||
|
@@ -43,7 +43,7 @@ a :
|
||||||
|
|
||||||
|
GITTAG = $(shell bash -c "echo $$(($(VERSION) + 1))")
|
||||||
|
|
||||||
|
-efivar.spec : | Makefile Make.version
|
||||||
|
+efivar.spec : | Makefile src/include/version.mk
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@set -e ; for x in $(SUBDIRS) ; do \
|
||||||
|
@@ -66,8 +66,8 @@ test-archive: abicheck efivar.spec
|
||||||
|
@echo "The archive is in efivar-$(GITTAG).tar.bz2"
|
||||||
|
|
||||||
|
bumpver :
|
||||||
|
- @echo VERSION=$(GITTAG) > Make.version
|
||||||
|
- @git add Make.version
|
||||||
|
+ @echo VERSION=$(GITTAG) > src/include/version.mk
|
||||||
|
+ @git add src/include/version.mk
|
||||||
|
git commit -m "Bump version to $(GITTAG)" -s
|
||||||
|
|
||||||
|
tag:
|
||||||
|
diff --git a/docs/Makefile b/docs/Makefile
|
||||||
|
index 0f610d9d9a9..2f6fc89b694 100644
|
||||||
|
--- a/docs/Makefile
|
||||||
|
+++ b/docs/Makefile
|
||||||
|
@@ -1,10 +1,9 @@
|
||||||
|
SRCDIR = $(realpath .)
|
||||||
|
-TOPDIR = $(realpath ..)
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.deprecated
|
||||||
|
-include $(TOPDIR)/Make.version
|
||||||
|
-include $(TOPDIR)/Make.rules
|
||||||
|
-include $(TOPDIR)/Make.defaults
|
||||||
|
+include $(TOPDIR)/src/include/deprecated.mk
|
||||||
|
+include $(TOPDIR)/src/include/version.mk
|
||||||
|
+include $(TOPDIR)/src/include/rules.mk
|
||||||
|
+include $(TOPDIR)/src/include/defaults.mk
|
||||||
|
|
||||||
|
MAN1TARGETS = efivar.1
|
||||||
|
MAN3TARGETS = efi_append_variable.3 \
|
||||||
|
@@ -51,4 +50,4 @@ install :
|
||||||
|
|
||||||
|
.PHONY: all clean install
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.rules
|
||||||
|
+include $(TOPDIR)/src/include/rules.mk
|
||||||
|
diff --git a/src/Android.mk b/src/Android.mk
|
||||||
|
index bf6cfb2e91b..ea6ee3f9432 100644
|
||||||
|
--- a/src/Android.mk
|
||||||
|
+++ b/src/Android.mk
|
||||||
|
@@ -46,7 +46,7 @@ LIBEFIVAR_SOURCES := \
|
||||||
|
lib.c \
|
||||||
|
vars.c
|
||||||
|
|
||||||
|
-include $(LOCAL_PATH)/../Make.version
|
||||||
|
+include $(LOCAL_PATH)/../version.mk
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES)
|
||||||
|
LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -std=gnu11 -DLIBEFIVAR_VERSION=$(VERSION)
|
||||||
|
diff --git a/src/Makefile b/src/Makefile
|
||||||
|
index 253d1f1d56c..e5f10d4c7bf 100644
|
||||||
|
--- a/src/Makefile
|
||||||
|
+++ b/src/Makefile
|
||||||
|
@@ -1,10 +1,9 @@
|
||||||
|
SRCDIR = $(realpath .)
|
||||||
|
-TOPDIR = $(realpath ..)
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.deprecated
|
||||||
|
-include $(TOPDIR)/Make.version
|
||||||
|
-include $(TOPDIR)/Make.rules
|
||||||
|
-include $(TOPDIR)/Make.defaults
|
||||||
|
+include $(TOPDIR)/src/include/deprecated.mk
|
||||||
|
+include $(TOPDIR)/src/include/version.mk
|
||||||
|
+include $(TOPDIR)/src/include/rules.mk
|
||||||
|
+include $(TOPDIR)/src/include/defaults.mk
|
||||||
|
|
||||||
|
LIBTARGETS=libefivar.so libefiboot.so
|
||||||
|
STATICLIBTARGETS=libefivar.a libefiboot.a
|
||||||
|
@@ -84,7 +83,7 @@ libefiboot.so : LIBS=efivar
|
||||||
|
libefiboot.so : MAP=libefiboot.map
|
||||||
|
|
||||||
|
deps : $(ALL_SOURCES)
|
||||||
|
- @$(MAKE) -f $(SRCDIR)/Make.deps deps SOURCES="$(ALL_SOURCES)"
|
||||||
|
+ @$(MAKE) -f $(SRCDIR)/include/deps.mk deps SOURCES="$(ALL_SOURCES)"
|
||||||
|
|
||||||
|
clean :
|
||||||
|
@rm -rfv *~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \
|
||||||
|
diff --git a/Make.coverity b/src/include/coverity.mk
|
||||||
|
similarity index 100%
|
||||||
|
rename from Make.coverity
|
||||||
|
rename to src/include/coverity.mk
|
||||||
|
diff --git a/Make.defaults b/src/include/defaults.mk
|
||||||
|
similarity index 97%
|
||||||
|
rename from Make.defaults
|
||||||
|
rename to src/include/defaults.mk
|
||||||
|
index 36e922f5ba7..7290187ceba 100644
|
||||||
|
--- a/Make.defaults
|
||||||
|
+++ b/src/include/defaults.mk
|
||||||
|
@@ -34,7 +34,7 @@ CPPFLAGS += -DLIBEFIVAR_VERSION=$(VERSION)
|
||||||
|
clang_cflags = -D_GNU_SOURCE -std=gnu11 -Wno-address-of-packed-member \
|
||||||
|
-funsigned-char -Wall -Wno-nonnull-compare \
|
||||||
|
-Werror -Wno-error=cpp
|
||||||
|
-gcc_cflags = -specs=$(TOPDIR)/gcc.specs
|
||||||
|
+gcc_cflags = -specs=$(TOPDIR)/src/include/gcc.specs
|
||||||
|
cflags = $(CFLAGS) -I${TOPDIR}/src/include/ \
|
||||||
|
$(if $(findstring clang,$(CC)),$(clang_cflags),) \
|
||||||
|
$(if $(findstring ccc-analyzer,$(CC)),$(clang_cflags),) \
|
||||||
|
diff --git a/Make.deprecated b/src/include/deprecated.mk
|
||||||
|
similarity index 100%
|
||||||
|
rename from Make.deprecated
|
||||||
|
rename to src/include/deprecated.mk
|
||||||
|
diff --git a/src/Make.deps b/src/include/deps.mk
|
||||||
|
similarity index 65%
|
||||||
|
rename from src/Make.deps
|
||||||
|
rename to src/include/deps.mk
|
||||||
|
index c3df9e46559..a797d1bdbf5 100644
|
||||||
|
--- a/src/Make.deps
|
||||||
|
+++ b/src/include/deps.mk
|
||||||
|
@@ -1,11 +1,10 @@
|
||||||
|
SRCDIR = $(realpath .)
|
||||||
|
-TOPDIR = $(realpath ..)
|
||||||
|
|
||||||
|
all : deps
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.version
|
||||||
|
-include $(TOPDIR)/Make.rules
|
||||||
|
-include $(TOPDIR)/Make.defaults
|
||||||
|
+include $(TOPDIR)/src/include/version.mk
|
||||||
|
+include $(TOPDIR)/src/include/rules.mk
|
||||||
|
+include $(TOPDIR)/src/include/defaults.mk
|
||||||
|
|
||||||
|
.%.d : %.c
|
||||||
|
$(CC) $(cflags) $(CPPFLAGS) -MM -MG -MF $@ $^
|
||||||
|
diff --git a/gcc.specs b/src/include/gcc.specs
|
||||||
|
similarity index 100%
|
||||||
|
rename from gcc.specs
|
||||||
|
rename to src/include/gcc.specs
|
||||||
|
diff --git a/Make.rules b/src/include/rules.mk
|
||||||
|
similarity index 98%
|
||||||
|
rename from Make.rules
|
||||||
|
rename to src/include/rules.mk
|
||||||
|
index 042585b533c..1783dda573b 100644
|
||||||
|
--- a/Make.rules
|
||||||
|
+++ b/src/include/rules.mk
|
||||||
|
@@ -2,7 +2,7 @@ default : all
|
||||||
|
|
||||||
|
.PHONY: default all clean install test
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.version
|
||||||
|
+include $(TOPDIR)/src/include/version.mk
|
||||||
|
|
||||||
|
%.a :
|
||||||
|
$(AR) -cvqs $@ $^
|
||||||
|
diff --git a/Make.scan-build b/src/include/scan-build.mk
|
||||||
|
similarity index 100%
|
||||||
|
rename from Make.scan-build
|
||||||
|
rename to src/include/scan-build.mk
|
||||||
|
diff --git a/Make.version b/src/include/version.mk
|
||||||
|
similarity index 100%
|
||||||
|
rename from Make.version
|
||||||
|
rename to src/include/version.mk
|
||||||
|
diff --git a/src/test/Makefile b/src/test/Makefile
|
||||||
|
index 4c2a18f8426..df16c7a5f3b 100644
|
||||||
|
--- a/src/test/Makefile
|
||||||
|
+++ b/src/test/Makefile
|
||||||
|
@@ -1,8 +1,7 @@
|
||||||
|
SRCDIR = $(realpath .)
|
||||||
|
-TOPDIR = $(realpath $(SRCDIR)/../..)
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.defaults
|
||||||
|
-include $(TOPDIR)/Make.version
|
||||||
|
+include $(TOPDIR)/src/include/defaults.mk
|
||||||
|
+include $(TOPDIR)/src/include/version.mk
|
||||||
|
|
||||||
|
ccldflags += -L$(TOPDIR)/src/ -Wl,-rpath=$(TOPDIR)/src/
|
||||||
|
LIBS=efivar
|
||||||
|
@@ -22,4 +21,4 @@ tester :: tester.o
|
||||||
|
|
||||||
|
.PHONY: all clean install test
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.rules
|
||||||
|
+include $(TOPDIR)/src/include/rules.mk
|
||||||
|
diff --git a/tests/Makefile b/tests/Makefile
|
||||||
|
index 5e0c604e355..6f233d53fd1 100644
|
||||||
|
--- a/tests/Makefile
|
||||||
|
+++ b/tests/Makefile
|
||||||
|
@@ -6,8 +6,7 @@
|
||||||
|
all: clean test0 test1 test2 test3 test4
|
||||||
|
|
||||||
|
GRUB_PREFIX ?= grub2
|
||||||
|
-TOPDIR ?= ..
|
||||||
|
-EFIVAR ?= ../src/efivar
|
||||||
|
+EFIVAR ?= $(TOPDIR)/src/efivar
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@rm -f *.result.env *.result.var
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From 9fa2e902ad0581b57e6e387ec629a70b16a26095 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Thu, 10 Oct 2019 13:52:46 -0400
|
||||||
|
Subject: [PATCH 48/63] Make CC_FOR_BUILD and CCLD_FOR_BUILD override
|
||||||
|
HOSTCC/HOSTCCLD
|
||||||
|
|
||||||
|
---
|
||||||
|
src/include/deprecated.mk | 10 ++++++++++
|
||||||
|
1 file changed, 10 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/include/deprecated.mk b/src/include/deprecated.mk
|
||||||
|
index a31b080dbf6..00abc8c8226 100644
|
||||||
|
--- a/src/include/deprecated.mk
|
||||||
|
+++ b/src/include/deprecated.mk
|
||||||
|
@@ -38,5 +38,15 @@ ifneq ($(origin bindir),undefined)
|
||||||
|
override BINDIR = $(bindir)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
+ifneq ($(origin CC_FOR_BUILD),undefined)
|
||||||
|
+ ifeq ($(origin HOSTCC),file)
|
||||||
|
+ override HOSTCC = $(CC_FOR_BUILD)
|
||||||
|
+ endif
|
||||||
|
+endif
|
||||||
|
+ifneq ($(origin CCLD_FOR_BUILD),undefined)
|
||||||
|
+ ifeq ($(origin HOSTCCLD),file)
|
||||||
|
+ override HOSTCCLD = $(CCLD_FOR_BUILD)
|
||||||
|
+ endif
|
||||||
|
+endif
|
||||||
|
|
||||||
|
# vim:ft=make
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,299 @@
|
|||||||
|
From 88663428b13a281d0b759718d7c8faa454b3409a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Thu, 10 Oct 2019 15:45:10 -0400
|
||||||
|
Subject: [PATCH 49/63] Rework some makefile bits to make overriding some
|
||||||
|
options simpler.
|
||||||
|
|
||||||
|
This reworks a lot of defaults.mk to make some variables more regularly
|
||||||
|
partially overridden on the command line, making e.g. suppression of
|
||||||
|
-Werror easier when warranted. It also makes having per-compiler
|
||||||
|
versions of each thing simpler.
|
||||||
|
|
||||||
|
The following variables can be overridden, though in some cases only
|
||||||
|
partially:
|
||||||
|
|
||||||
|
name kind of things in it
|
||||||
|
COMPILER gcc
|
||||||
|
CROSS_COMPILE arm-linux-gnu-
|
||||||
|
CC $(CROSS_COMPILE)$(COMPILER)
|
||||||
|
DEBUGINFO -g
|
||||||
|
OPTIMIZE -O2 -flto
|
||||||
|
WARNINGS -Wfoo -Wno-bar
|
||||||
|
ERRORS -Werror -Wno-error=cpp
|
||||||
|
CPPFLAGS -D and -I
|
||||||
|
CFLAGS $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS)
|
||||||
|
LDFLAGS linker options (add-only)
|
||||||
|
CCLDFLAGS -Wl, prefixed linker options (add-only and it's
|
||||||
|
normally machine generated from LDFLAGS
|
||||||
|
HOSTCC $(COMPILER)
|
||||||
|
HOST_CPPFLAGS $(CPPFLAGS) (add-only)
|
||||||
|
HOST_CFLAGS $(CFLAGS) (add-only)
|
||||||
|
HOST_CCLDFLAGS $(CCLDFLAGS) (add-only)
|
||||||
|
|
||||||
|
This resolves issue #31
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/Makefile | 5 ++-
|
||||||
|
src/include/defaults.mk | 83 +++++++++++++++++++++++++++--------------
|
||||||
|
src/include/gcc.specs | 11 +-----
|
||||||
|
src/include/rules.mk | 51 +++++++++++++------------
|
||||||
|
src/test/Makefile | 2 +-
|
||||||
|
5 files changed, 87 insertions(+), 65 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/Makefile b/src/Makefile
|
||||||
|
index e5f10d4c7bf..1d0e217c89b 100644
|
||||||
|
--- a/src/Makefile
|
||||||
|
+++ b/src/Makefile
|
||||||
|
@@ -51,10 +51,11 @@ include/efivar/efivar-guids.h : makeguids guids.txt
|
||||||
|
./makeguids guids.txt guids.bin names.bin \
|
||||||
|
guid-symbols.c include/efivar/efivar-guids.h
|
||||||
|
|
||||||
|
-makeguids : CPPFLAGS+=-DEFIVAR_BUILD_ENVIRONMENT -march=native
|
||||||
|
+makeguids : CPPFLAGS=$(HOST_CPPFLAGS)
|
||||||
|
makeguids : LIBS=dl
|
||||||
|
+makeguids : CCLD=$(HOSTCCLD)
|
||||||
|
+makeguids : CFLAGS=$(HOST_CFLAGS)
|
||||||
|
makeguids : $(MAKEGUIDS_SOURCES)
|
||||||
|
-makeguids : CCLD=$(CCLD_FOR_BUILD)
|
||||||
|
|
||||||
|
guids.o : guids.S | guids.bin names.bin
|
||||||
|
|
||||||
|
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
|
||||||
|
index 7290187ceba..df738feddea 100644
|
||||||
|
--- a/src/include/defaults.mk
|
||||||
|
+++ b/src/include/defaults.mk
|
||||||
|
@@ -8,19 +8,63 @@ BINDIR ?= $(EXEC_PREFIX)/bin
|
||||||
|
PCDIR ?= $(LIBDIR)/pkgconfig
|
||||||
|
DESTDIR ?=
|
||||||
|
|
||||||
|
-INSTALL ?= install
|
||||||
|
CROSS_COMPILE ?=
|
||||||
|
COMPILER ?= gcc
|
||||||
|
-PKG_CONFIG = $(shell if [ -e "$$(env $(CROSS_COMPILE)pkg-config 2>&1)" ]; then echo $(CROSS_COMPILE)pkg-config ; else echo pkg-config ; fi)
|
||||||
|
-CC_FOR_BUILD ?= cc
|
||||||
|
-CC := $(if $(filter default,$(origin CC)),$(CROSS_COMPILE)$(COMPILER),$(CC))
|
||||||
|
-CCLD_FOR_BUILD ?= $(CC_FOR_BUILD)
|
||||||
|
-CCLD := $(if $(filter undefined,$(origin CCLD)),$(CC),$(CCLD))
|
||||||
|
+$(call set-if-undefined,CC,$(CROSS_COMPILE)$(COMPILER))
|
||||||
|
+$(call set-if-undefined,CCLD,$(CC))
|
||||||
|
+$(call set-if-undefined,HOSTCC,$(COMPILER))
|
||||||
|
+$(call set-if-undefined,HOSTCCLD,$(HOSTCC))
|
||||||
|
+
|
||||||
|
OPTIMIZE ?= -O2 -flto
|
||||||
|
-CFLAGS ?= $(OPTIMIZE) -g3
|
||||||
|
-CFLAGS := $(CFLAGS)
|
||||||
|
+DEBUGINFO ?= -g3
|
||||||
|
+WARNINGS_GCC ?= -Wmaybe-uninitialized \
|
||||||
|
+ -Wno-nonnull-compare
|
||||||
|
+WARNINGS_CCC_ANALYZER ?= $(WARNINGS_GCC)
|
||||||
|
+WARNINGS ?= -Wall -Wextra \
|
||||||
|
+ -Wno-address-of-packed-member \
|
||||||
|
+ $(call family,WARNINGS)
|
||||||
|
+ERRORS ?= -Werror -Wno-error=cpp $(call family,ERRORS)
|
||||||
|
+CPPFLAGS ?=
|
||||||
|
+override _CPPFLAGS := $(CPPFLAGS)
|
||||||
|
+override CPPFLAGS = $(_CPPFLAGS) -DLIBEFIVAR_VERSION=$(VERSION) \
|
||||||
|
+ -D_GNU_SOURCE \
|
||||||
|
+ -I$(TOPDIR)/src/include/
|
||||||
|
+CFLAGS ?= $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS)
|
||||||
|
+CFLAGS_GCC ?= -specs=$(TOPDIR)/src/include/gcc.specs \
|
||||||
|
+ -fno-merge-constants
|
||||||
|
+override _CFLAGS := $(CFLAGS)
|
||||||
|
+override CFLAGS = $(_CFLAGS) \
|
||||||
|
+ -std=gnu11 \
|
||||||
|
+ -funsigned-char \
|
||||||
|
+ -fvisibility=hidden \
|
||||||
|
+ $(call family,CFLAGS) \
|
||||||
|
+ $(call pkg-config-cflags)
|
||||||
|
+LDFLAGS_CLANG ?= --fatal-warnings -pie -z relro
|
||||||
|
LDFLAGS ?=
|
||||||
|
-LDFLAGS := $(LDFLAGS)
|
||||||
|
+override _LDFLAGS := $(LDFLAGS)
|
||||||
|
+override LDFLAGS = $(_LDFLAGS) \
|
||||||
|
+ --add-needed \
|
||||||
|
+ --build-id \
|
||||||
|
+ --no-allow-shlib-undefined \
|
||||||
|
+ --no-undefined-version \
|
||||||
|
+ -z now \
|
||||||
|
+ -z muldefs \
|
||||||
|
+ $(call family,LDFLAGS)
|
||||||
|
+CCLDFLAGS ?=
|
||||||
|
+override _CCLDFLAGS := $(CCLDFLAGS)
|
||||||
|
+override CCLDFLAGS = $(CFLAGS) -L. $(_CCLDFLAGS) \
|
||||||
|
+ $(call add-prefix,-Wl,$(LDFLAGS)) \
|
||||||
|
+ $(call pkg-config-ccldflags)
|
||||||
|
+HOST_CPPFLAGS ?= $(CPPFLAGS)
|
||||||
|
+override _HOST_CPPFLAGS := $(HOST_CPPFLAGS)
|
||||||
|
+override HOST_CPPFLAGS = $(_HOST_CPPFLAGS) \
|
||||||
|
+ -DEFIVAR_BUILD_ENVIRONMENT -march=native
|
||||||
|
+HOST_CFLAGS ?= $(CFLAGS)
|
||||||
|
+override _HOST_CFLAGS := $(HOST_CFLAGS)
|
||||||
|
+override HOST_CFLAGS = $(_HOST_CFLAGS)
|
||||||
|
+
|
||||||
|
+PKG_CONFIG = $(shell if [ -e "$$(env $(CROSS_COMPILE)pkg-config 2>&1)" ]; then echo $(CROSS_COMPILE)pkg-config ; else echo pkg-config ; fi)
|
||||||
|
+INSTALL ?= install
|
||||||
|
AR := $(CROSS_COMPILE)$(COMPILER)-ar
|
||||||
|
NM := $(CROSS_COMPILE)$(COMPILER)-nm
|
||||||
|
RANLIB := $(CROSS_COMPILE)$(COMPILER)-ranlib
|
||||||
|
@@ -29,26 +73,7 @@ ABIDIFF := abidiff
|
||||||
|
|
||||||
|
PKGS =
|
||||||
|
|
||||||
|
-CPPFLAGS += -DLIBEFIVAR_VERSION=$(VERSION)
|
||||||
|
-
|
||||||
|
-clang_cflags = -D_GNU_SOURCE -std=gnu11 -Wno-address-of-packed-member \
|
||||||
|
- -funsigned-char -Wall -Wno-nonnull-compare \
|
||||||
|
- -Werror -Wno-error=cpp
|
||||||
|
-gcc_cflags = -specs=$(TOPDIR)/src/include/gcc.specs
|
||||||
|
-cflags = $(CFLAGS) -I${TOPDIR}/src/include/ \
|
||||||
|
- $(if $(findstring clang,$(CC)),$(clang_cflags),) \
|
||||||
|
- $(if $(findstring ccc-analyzer,$(CC)),$(clang_cflags),) \
|
||||||
|
- $(if $(findstring gcc,$(CC)),$(gcc_cflags),) \
|
||||||
|
- $(call pkg-config-cflags)
|
||||||
|
-clang_ccldflags =
|
||||||
|
-gcc_ccldflags =
|
||||||
|
-ccldflags = $(cflags) -L. $(CCLDFLAGS) $(LDFLAGS) \
|
||||||
|
- -Wl,-z,muldefs \
|
||||||
|
- $(if $(findstring clang,$(CCLD)),$(clang_ccldflags),) \
|
||||||
|
- $(if $(findstring ccc-analyzer,$(CCLD)),$(clang_ccldflags),) \
|
||||||
|
- $(if $(findstring gcc,$(CCLD)),$(gcc_ccldflags),) \
|
||||||
|
- $(call pkg-config-ldflags)
|
||||||
|
-SOFLAGS=-shared
|
||||||
|
+SOFLAGS=-shared $(call family,SOFLAGS)
|
||||||
|
LDLIBS=$(foreach lib,$(LIBS),-l$(lib)) $(call pkg-config-ldlibs)
|
||||||
|
|
||||||
|
COMMIT_ID=$(shell git log -1 --pretty=%H 2>/dev/null || echo master)
|
||||||
|
diff --git a/src/include/gcc.specs b/src/include/gcc.specs
|
||||||
|
index 9d2b145ee6e..ef28e2bb51a 100644
|
||||||
|
--- a/src/include/gcc.specs
|
||||||
|
+++ b/src/include/gcc.specs
|
||||||
|
@@ -1,14 +1,5 @@
|
||||||
|
-*cpp:
|
||||||
|
-+ -D_GNU_SOURCE
|
||||||
|
-
|
||||||
|
-*efivar_cpp_options:
|
||||||
|
- -Wall -Wno-nonnull-compare -Werror -Wno-error=cpp -std=gnu11 -Wextra -funsigned-char
|
||||||
|
-
|
||||||
|
-*cpp_options:
|
||||||
|
-+ %(efivar_cpp_options)
|
||||||
|
-
|
||||||
|
*cc1_options:
|
||||||
|
-+ %(efivar_cpp_options) -Wmaybe-uninitialized -fno-merge-constants -funsigned-char -fvisibility=hidden %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} -grecord-gcc-switches
|
||||||
|
++ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} -grecord-gcc-switches
|
||||||
|
|
||||||
|
*self_spec:
|
||||||
|
+ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches
|
||||||
|
diff --git a/src/include/rules.mk b/src/include/rules.mk
|
||||||
|
index 1783dda573b..ff0ff4ef61b 100644
|
||||||
|
--- a/src/include/rules.mk
|
||||||
|
+++ b/src/include/rules.mk
|
||||||
|
@@ -4,20 +4,32 @@ default : all
|
||||||
|
|
||||||
|
include $(TOPDIR)/src/include/version.mk
|
||||||
|
|
||||||
|
+comma:= ,
|
||||||
|
+empty:=
|
||||||
|
+space:= $(empty) $(empty)
|
||||||
|
+
|
||||||
|
+set-if-undefined = $(call eval,$(1) := $(if $(filter default undefined,$(origin $(1))),$(2),$($(1))))
|
||||||
|
+add-prefix = $(subst $(space),$(empty),$(1)$(foreach x,$(2),$(comma)$(x)))
|
||||||
|
+
|
||||||
|
+FAMILY_SUFFIXES = $(if $(findstring clang,$(CC)),CLANG,) \
|
||||||
|
+ $(if $(findstring ccc-analyzer,$(CC)),CCC_ANALYZER,) \
|
||||||
|
+ $(if $(findstring gcc,$(CC)),GCC,)
|
||||||
|
+family = $(foreach FAMILY_SUFFIX,$(FAMILY_SUFFIXES),$($(1)_$(FAMILY_SUFFIX)))
|
||||||
|
+
|
||||||
|
%.a :
|
||||||
|
$(AR) -cvqs $@ $^
|
||||||
|
|
||||||
|
% : %.c
|
||||||
|
|
||||||
|
% : %.c
|
||||||
|
- $(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
|
||||||
|
+ $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
|
||||||
|
|
||||||
|
-%-static : ccldflags+=-static
|
||||||
|
+%-static : CCLDFLAGS+=-static
|
||||||
|
%-static : %.c
|
||||||
|
- $(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
|
||||||
|
+ $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
|
||||||
|
|
||||||
|
%.so :
|
||||||
|
- $(CCLD) $(ccldflags) $(CPPFLAGS) $(SOFLAGS) \
|
||||||
|
+ $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) $(SOFLAGS) \
|
||||||
|
-Wl,-soname,$@.1 \
|
||||||
|
-Wl,--version-script=$(MAP) \
|
||||||
|
-o $@ $^ $(LDLIBS)
|
||||||
|
@@ -35,22 +47,22 @@ include $(TOPDIR)/src/include/version.mk
|
||||||
|
$<
|
||||||
|
|
||||||
|
%.o : %.c
|
||||||
|
- $(CC) $(cflags) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
|
||||||
|
+ $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
|
||||||
|
|
||||||
|
%.static.o : %.c
|
||||||
|
- $(CC) $(cflags) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
|
||||||
|
+ $(CC) $(CFLAGS) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
|
||||||
|
|
||||||
|
%.o : %.S
|
||||||
|
- $(CC) $(cflags) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
|
||||||
|
+ $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
|
||||||
|
|
||||||
|
%.static.o : %.S
|
||||||
|
- $(CC) $(cflags) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
|
||||||
|
+ $(CC) $(CFLAGS) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
|
||||||
|
|
||||||
|
%.S: %.c
|
||||||
|
- $(CC) $(cflags) $(CPPFLAGS) -S $< -o $@
|
||||||
|
+ $(CC) $(CFLAGS) $(CPPFLAGS) -S $< -o $@
|
||||||
|
|
||||||
|
%.E: %.c
|
||||||
|
- $(CC) $(cflags) $(CPPFLAGS) -E $< -o $@
|
||||||
|
+ $(CC) $(CFLAGS) $(CPPFLAGS) -E $< -o $@
|
||||||
|
|
||||||
|
%.c : %.h
|
||||||
|
|
||||||
|
@@ -71,20 +83,13 @@ endef
|
||||||
|
%.map : %.map.in
|
||||||
|
@$(call substitute-version,$<,$@)
|
||||||
|
|
||||||
|
-pkg-config-cflags = \
|
||||||
|
- $(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --cflags $(PKGS); fi)
|
||||||
|
-pkg-config-ldflags = \
|
||||||
|
- $(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --libs-only-L --libs-only-other $(PKGS) ; fi)
|
||||||
|
-pkg-config-ldlibs = \
|
||||||
|
- $(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --libs-only-l $(PKGS) ; fi)
|
||||||
|
+pkg-config-cflags = $(if $(PKGS),$(shell $(PKG_CONFIG) --cflags $(PKGS)))
|
||||||
|
+pkg-config-ccldflags = $(if $(PKGS),$(shell $(PKG_CONFIG) --libs-only-L --libs-only-other $(PKGS)))
|
||||||
|
+pkg-config-ldlibs = $(if $(PKGS),$(shell $(PKG_CONFIG) --libs-only-l $(PKGS)))
|
||||||
|
|
||||||
|
-define deps-of
|
||||||
|
- $(foreach src,$(filter %.c,$(1)),$(patsubst %.c,.%.d,$(src))) \
|
||||||
|
- $(foreach src,$(filter %.S,$(1)),$(patsubst %.S,.%.d,$(src)))
|
||||||
|
-endef
|
||||||
|
+deps-of = $(foreach src,$(filter %.c,$(1)),$(patsubst %.c,.%.d,$(src))) \
|
||||||
|
+ $(foreach src,$(filter %.S,$(1)),$(patsubst %.S,.%.d,$(src)))
|
||||||
|
|
||||||
|
-define get-config
|
||||||
|
-$(shell git config --local --get "efivar.$(1)")
|
||||||
|
-endef
|
||||||
|
+get-config = $(shell git config --local --get "efivar.$(1)")
|
||||||
|
|
||||||
|
# vim:ft=make
|
||||||
|
diff --git a/src/test/Makefile b/src/test/Makefile
|
||||||
|
index df16c7a5f3b..7a2aa496b48 100644
|
||||||
|
--- a/src/test/Makefile
|
||||||
|
+++ b/src/test/Makefile
|
||||||
|
@@ -3,7 +3,7 @@ SRCDIR = $(realpath .)
|
||||||
|
include $(TOPDIR)/src/include/defaults.mk
|
||||||
|
include $(TOPDIR)/src/include/version.mk
|
||||||
|
|
||||||
|
-ccldflags += -L$(TOPDIR)/src/ -Wl,-rpath=$(TOPDIR)/src/
|
||||||
|
+CCLDFLAGS += -L$(TOPDIR)/src/ -Wl,-rpath=$(TOPDIR)/src/
|
||||||
|
LIBS=efivar
|
||||||
|
|
||||||
|
all : tester
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
55
SOURCES/0050-Make-add-Wno-missing-field-initializers.patch
Normal file
55
SOURCES/0050-Make-add-Wno-missing-field-initializers.patch
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
From 1b5da030b19e6f7f086ef2f1719159951c574fa7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 15 Oct 2019 16:49:54 -0400
|
||||||
|
Subject: [PATCH 50/63] Make: add -Wno-missing-field-initializers
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Ritchie wrote in '84:
|
||||||
|
|
||||||
|
If there are fewer initializers in the list than there are members of
|
||||||
|
the aggregate, then the aggregate is padded with 0's.
|
||||||
|
|
||||||
|
c99 §6.7.8 and c11 §6.7.9 each say:
|
||||||
|
|
||||||
|
10 If an object that has automatic storage duration is not initialized
|
||||||
|
explicitly, its value is indeterminate. If an object that has static
|
||||||
|
storage duration is not initialized explicitly, then:
|
||||||
|
— if it has pointer type, it is initialized to a null pointer;
|
||||||
|
— if it has arithmetic type, it is initialized to (positive or
|
||||||
|
unsigned) zero;
|
||||||
|
— if it is an aggregate, every member is initialized (recursively)
|
||||||
|
according to these rules;
|
||||||
|
— if it is a union, the first named member is initialized
|
||||||
|
(recursively) according to these rules.
|
||||||
|
...
|
||||||
|
21 If there are fewer initializers in a brace-enclosed list than there
|
||||||
|
are elements or members of an aggregate, or fewer characters in a
|
||||||
|
string literal used to initialize an array of known size than there
|
||||||
|
are elements in the array, the remainder of the aggregate shall be
|
||||||
|
initialized implicitly the same as objects that have static storage
|
||||||
|
duration.
|
||||||
|
|
||||||
|
This warning is thoroughly pointless.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/include/defaults.mk | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
|
||||||
|
index df738feddea..af6a41a9824 100644
|
||||||
|
--- a/src/include/defaults.mk
|
||||||
|
+++ b/src/include/defaults.mk
|
||||||
|
@@ -22,6 +22,7 @@ WARNINGS_GCC ?= -Wmaybe-uninitialized \
|
||||||
|
WARNINGS_CCC_ANALYZER ?= $(WARNINGS_GCC)
|
||||||
|
WARNINGS ?= -Wall -Wextra \
|
||||||
|
-Wno-address-of-packed-member \
|
||||||
|
+ -Wno-missing-field-initializers \
|
||||||
|
$(call family,WARNINGS)
|
||||||
|
ERRORS ?= -Werror -Wno-error=cpp $(call family,ERRORS)
|
||||||
|
CPPFLAGS ?=
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
78
SOURCES/0051-debug-don-t-write-newlines-to-memfd.patch
Normal file
78
SOURCES/0051-debug-don-t-write-newlines-to-memfd.patch
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
From f9797c91e190fc53ce997beb1e7c2a140abfd665 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 15 Oct 2019 16:27:39 -0400
|
||||||
|
Subject: [PATCH 51/63] debug(): don't write newlines to memfd
|
||||||
|
|
||||||
|
If we know our log will only be seen by strace, the newlines don't add
|
||||||
|
anything to the strings but clutter.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/error.c | 16 ++++++++++++++--
|
||||||
|
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/error.c b/src/error.c
|
||||||
|
index 083de15e984..8ceba31dd55 100644
|
||||||
|
--- a/src/error.c
|
||||||
|
+++ b/src/error.c
|
||||||
|
@@ -27,6 +27,7 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
+#include <sys/random.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "efiboot.h"
|
||||||
|
@@ -166,6 +167,7 @@ efi_error_pop(void)
|
||||||
|
static int efi_verbose;
|
||||||
|
static FILE *efi_errlog, *efi_dbglog;
|
||||||
|
static int efi_dbglog_fd = -1;
|
||||||
|
+static intptr_t efi_dbglog_cookie;
|
||||||
|
static int log_level;
|
||||||
|
static char efi_dbglog_buf[4096];
|
||||||
|
|
||||||
|
@@ -176,7 +178,7 @@ efi_set_loglevel(int level)
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-dbglog_write(void *cookie UNUSED, const char *buf, size_t size)
|
||||||
|
+dbglog_write(void *cookie, const char *buf, size_t size)
|
||||||
|
{
|
||||||
|
FILE *log = efi_errlog ? efi_errlog : stderr;
|
||||||
|
ssize_t ret = size;
|
||||||
|
@@ -185,6 +187,11 @@ dbglog_write(void *cookie UNUSED, const char *buf, size_t size)
|
||||||
|
ret = fwrite(buf, 1, size, log);
|
||||||
|
} else if (efi_dbglog_fd >= 0) {
|
||||||
|
lseek(efi_dbglog_fd, 0, SEEK_SET);
|
||||||
|
+ if ((intptr_t)cookie != 0 &&
|
||||||
|
+ (intptr_t)cookie == efi_dbglog_cookie &&
|
||||||
|
+ size > 0 &&
|
||||||
|
+ buf[size-1] == '\n')
|
||||||
|
+ size -= 1;
|
||||||
|
ret = write(efi_dbglog_fd, buf, size);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
@@ -248,6 +255,7 @@ efi_error_fini(void)
|
||||||
|
static void CONSTRUCTOR
|
||||||
|
efi_error_init(void)
|
||||||
|
{
|
||||||
|
+ ssize_t bytes;
|
||||||
|
cookie_io_functions_t io_funcs = {
|
||||||
|
.write = dbglog_write,
|
||||||
|
.seek = dbglog_seek,
|
||||||
|
@@ -258,7 +266,11 @@ efi_error_init(void)
|
||||||
|
if (efi_dbglog_fd == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- efi_dbglog = fopencookie(NULL, "a", io_funcs);
|
||||||
|
+ bytes = getrandom(&efi_dbglog_cookie, sizeof(efi_dbglog_cookie), 0);
|
||||||
|
+ if (bytes < (ssize_t)sizeof(efi_dbglog_cookie))
|
||||||
|
+ efi_dbglog_cookie = 0;
|
||||||
|
+
|
||||||
|
+ efi_dbglog = fopencookie((void *)efi_dbglog_cookie, "a", io_funcs);
|
||||||
|
if (efi_dbglog)
|
||||||
|
setvbuf(efi_dbglog, efi_dbglog_buf, _IOLBF,
|
||||||
|
sizeof(efi_dbglog_buf));
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
314
SOURCES/0052-sysfs-parsing-add-some-more-debugging-output.patch
Normal file
314
SOURCES/0052-sysfs-parsing-add-some-more-debugging-output.patch
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
From f1d09655cbc47a738410b601ac1f7ddde2d72b26 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 2 Oct 2019 16:59:14 -0400
|
||||||
|
Subject: [PATCH 52/63] sysfs parsing: add some more debugging output
|
||||||
|
|
||||||
|
This adds highlights under the things we've found when searching, like:
|
||||||
|
|
||||||
|
linux-pci.c:66 parse_pci(): searching for 0000:00:00.0/
|
||||||
|
linux-pci.c:69 parse_pci(): current:'0000:00:1d.4/0000:6e:00.0/nvme/nvme0/nvme0n1' rc:4 pos0:0 pos1:13
|
||||||
|
linux-pci.c:70 parse_pci(): ^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/linux-acpi-root.c | 3 +++
|
||||||
|
src/linux-emmc.c | 1 +
|
||||||
|
src/linux-md.c | 1 +
|
||||||
|
src/linux-nvme.c | 1 +
|
||||||
|
src/linux-pci-root.c | 2 ++
|
||||||
|
src/linux-pci.c | 1 +
|
||||||
|
src/linux-pmem.c | 2 ++
|
||||||
|
src/linux-sata.c | 4 ++++
|
||||||
|
src/linux-scsi.c | 8 ++++++++
|
||||||
|
src/linux-soc-root.c | 2 ++
|
||||||
|
src/linux-virtblk.c | 1 +
|
||||||
|
src/util.h | 35 +++++++++++++++++++++++++++++++++++
|
||||||
|
12 files changed, 61 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/linux-acpi-root.c b/src/linux-acpi-root.c
|
||||||
|
index f48d4be9ac6..5ed4d7f5b86 100644
|
||||||
|
--- a/src/linux-acpi-root.c
|
||||||
|
+++ b/src/linux-acpi-root.c
|
||||||
|
@@ -63,6 +63,7 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
*/
|
||||||
|
rc = sscanf(devpart, "../../devices/platform/%n", &pos);
|
||||||
|
debug("devpart:\"%s\" rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
if (rc != 0 || pos < 1)
|
||||||
|
return 0;
|
||||||
|
devpart += pos;
|
||||||
|
@@ -97,6 +98,7 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
|
||||||
|
pos -= 4;
|
||||||
|
debug("devpart:\"%s\" rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
acpi_header = strndupa(devpart, pos);
|
||||||
|
if (!acpi_header)
|
||||||
|
return 0;
|
||||||
|
@@ -114,6 +116,7 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
}
|
||||||
|
debug("devpart:\"%s\" parsed:%04hx:%02hhx pos:%d rc:%d",
|
||||||
|
devpart, pad0, pad1, pos, rc);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
|
||||||
|
devpart += pos;
|
||||||
|
|
||||||
|
diff --git a/src/linux-emmc.c b/src/linux-emmc.c
|
||||||
|
index 8af316a1723..59ef8e7524d 100644
|
||||||
|
--- a/src/linux-emmc.c
|
||||||
|
+++ b/src/linux-emmc.c
|
||||||
|
@@ -58,6 +58,7 @@ parse_emmc(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
&tosser0, &tosser1, &tosser2, &slot_id,
|
||||||
|
&pos0, &tosser3, &partition, &pos1);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our emmc devices.
|
||||||
|
*/
|
||||||
|
diff --git a/src/linux-md.c b/src/linux-md.c
|
||||||
|
index 3d5975d8195..1d7bd3195c0 100644
|
||||||
|
--- a/src/linux-md.c
|
||||||
|
+++ b/src/linux-md.c
|
||||||
|
@@ -51,6 +51,7 @@ parse_md(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
rc = sscanf(current, "md%d/%nmd%dp%d%n",
|
||||||
|
&md, &pos0, &tosser0, &part, &pos1);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our partitioned md devices.
|
||||||
|
*/
|
||||||
|
diff --git a/src/linux-nvme.c b/src/linux-nvme.c
|
||||||
|
index e6e42c7a3fc..0b4eae74f79 100644
|
||||||
|
--- a/src/linux-nvme.c
|
||||||
|
+++ b/src/linux-nvme.c
|
||||||
|
@@ -62,6 +62,7 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
&tosser0, &ctrl_id, &ns_id, &pos0,
|
||||||
|
&tosser1, &tosser2, &partition, &pos1);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our nvme devices.
|
||||||
|
*/
|
||||||
|
diff --git a/src/linux-pci-root.c b/src/linux-pci-root.c
|
||||||
|
index ede9321395c..c84b639cbfe 100644
|
||||||
|
--- a/src/linux-pci-root.c
|
||||||
|
+++ b/src/linux-pci-root.c
|
||||||
|
@@ -57,6 +57,8 @@ parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
* ^d ^p
|
||||||
|
*/
|
||||||
|
rc = sscanf(devpart, "../../devices/pci%hx:%hhx/%n", &root_domain, &root_bus, &pos);
|
||||||
|
+ debug("current:\"%s\" rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
/*
|
||||||
|
* If we can't find that, it's not a PCI device.
|
||||||
|
*/
|
||||||
|
diff --git a/src/linux-pci.c b/src/linux-pci.c
|
||||||
|
index 4c715df3d6e..0de330db628 100644
|
||||||
|
--- a/src/linux-pci.c
|
||||||
|
+++ b/src/linux-pci.c
|
||||||
|
@@ -68,6 +68,7 @@ parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
rc = sscanf(devpart, "%hx:%hhx:%hhx.%hhx/%n",
|
||||||
|
&domain, &bus, &device, &function, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
if (rc != 4)
|
||||||
|
break;
|
||||||
|
devpart += pos;
|
||||||
|
diff --git a/src/linux-pmem.c b/src/linux-pmem.c
|
||||||
|
index 099ac8aef8c..18eb7dce5e3 100644
|
||||||
|
--- a/src/linux-pmem.c
|
||||||
|
+++ b/src/linux-pmem.c
|
||||||
|
@@ -105,6 +105,8 @@ parse_pmem(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
"../../devices/LNXSYSTM:%hhx/LNXSYBUS:%hhx/ACPI%hx:%hhx/ndbus%d/region%d/btt%d.%d/%n",
|
||||||
|
&system, &sysbus, &pnp_id, &acpi_id, &ndbus, ®ion,
|
||||||
|
&btt_region_id, &btt_id, &pos);
|
||||||
|
+ debug("current:\"%s\" rc:%d pos:%d", current, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
if (rc < 8)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
diff --git a/src/linux-sata.c b/src/linux-sata.c
|
||||||
|
index ee285d84a76..b0caa3fa401 100644
|
||||||
|
--- a/src/linux-sata.c
|
||||||
|
+++ b/src/linux-sata.c
|
||||||
|
@@ -162,6 +162,7 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
debug("searching for ata1/");
|
||||||
|
rc = sscanf(current, "ata%"PRIu32"/%n", &print_id, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
/*
|
||||||
|
* If we don't find this one, it isn't an ata device, so return 0 not
|
||||||
|
* error. Later errors mean it is an ata device, but we can't parse
|
||||||
|
@@ -175,6 +176,7 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
debug("searching for host0/");
|
||||||
|
rc = sscanf(current, "host%"PRIu32"/%n", &scsi_bus, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
if (rc != 1)
|
||||||
|
return -1;
|
||||||
|
current += pos;
|
||||||
|
@@ -184,6 +186,7 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
rc = sscanf(current, "target%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
&scsi_device, &scsi_target, &scsi_lun, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
if (rc != 3)
|
||||||
|
return -1;
|
||||||
|
current += pos;
|
||||||
|
@@ -193,6 +196,7 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
rc = sscanf(current, "%"PRIu32":%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
&tosser0, &tosser1, &tosser2, &tosser3, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
if (rc != 4)
|
||||||
|
return -1;
|
||||||
|
current += pos;
|
||||||
|
diff --git a/src/linux-scsi.c b/src/linux-scsi.c
|
||||||
|
index 90a85836b1c..96fde7e15fa 100644
|
||||||
|
--- a/src/linux-scsi.c
|
||||||
|
+++ b/src/linux-scsi.c
|
||||||
|
@@ -101,6 +101,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
debug("searching for host4/");
|
||||||
|
rc = sscanf(current, "host%d/%n", scsi_host, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ dbgmk(" ", pos0);
|
||||||
|
if (rc != 1)
|
||||||
|
return -1;
|
||||||
|
sz += pos0;
|
||||||
|
@@ -118,6 +119,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
rc = sscanf(current+sz, "port-%d:%d%n:%d%n", &tosser0,
|
||||||
|
&tosser1, &pos0, &tosser2, &pos1);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current+sz, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc == 2 || rc == 3) {
|
||||||
|
sz += pos0;
|
||||||
|
pos0 = 0;
|
||||||
|
@@ -143,6 +145,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
debug("searching for expander-4:0/");
|
||||||
|
rc = sscanf(current+sz, "expander-%d:%d/%n", &tosser0, &tosser1, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ dbgmk(" ", pos0);
|
||||||
|
if (rc == 2) {
|
||||||
|
if (!remote_target_id) {
|
||||||
|
efi_error("Device is PHY is a remote target, but remote_target_id is NULL");
|
||||||
|
@@ -158,6 +161,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
debug("searching for port-2:0:2/");
|
||||||
|
rc = sscanf(current+sz, "port-%d:%d:%d/%n", &tosser0, &tosser1, &tosser2, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ dbgmk(" ", pos0);
|
||||||
|
if (rc != 3) {
|
||||||
|
efi_error("Couldn't parse port expander port string");
|
||||||
|
return -1;
|
||||||
|
@@ -182,6 +186,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
rc = sscanf(current + sz + pos0, ":%d%n", &tosser2, &pos1);
|
||||||
|
if (rc != 0 && rc != 1)
|
||||||
|
return -1;
|
||||||
|
+ dbgmk(" ", pos0, pos0+pos1);
|
||||||
|
if (remote_port_id && rc == 1)
|
||||||
|
*remote_port_id = tosser2;
|
||||||
|
if (local_port_id && rc == 0)
|
||||||
|
@@ -203,6 +208,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
rc = sscanf(current + sz, "target%d:%d:%"PRIu64"/%n", &tosser0, &tosser1,
|
||||||
|
&tosser3, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ dbgmk(" ", pos0);
|
||||||
|
if (rc != 3)
|
||||||
|
return -1;
|
||||||
|
sz += pos0;
|
||||||
|
@@ -215,6 +221,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
rc = sscanf(current + sz, "%d:%d:%d:%"PRIu64"/%n",
|
||||||
|
scsi_bus, scsi_device, scsi_target, scsi_lun, &pos0);
|
||||||
|
debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ dbgmk(" ", pos0);
|
||||||
|
if (rc != 4)
|
||||||
|
return -1;
|
||||||
|
sz += pos0;
|
||||||
|
@@ -242,6 +249,7 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
&dev->scsi_info.scsi_lun,
|
||||||
|
&pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", dev->device, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
if (rc != 4)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
diff --git a/src/linux-soc-root.c b/src/linux-soc-root.c
|
||||||
|
index 27633d69c97..c932670ef15 100644
|
||||||
|
--- a/src/linux-soc-root.c
|
||||||
|
+++ b/src/linux-soc-root.c
|
||||||
|
@@ -49,6 +49,8 @@ parse_soc_root(struct device *dev UNUSED, const char *current, const char *root
|
||||||
|
rc = sscanf(devpart, "../../devices/platform/soc/%*[^/]/%n", &pos);
|
||||||
|
if (rc != 0)
|
||||||
|
return 0;
|
||||||
|
+ debug("current:\"%s\" rc:%d pos:%d", current, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
devpart += pos;
|
||||||
|
debug("new position is \"%s\"", devpart);
|
||||||
|
|
||||||
|
diff --git a/src/linux-virtblk.c b/src/linux-virtblk.c
|
||||||
|
index 891c262fe05..7517db55555 100644
|
||||||
|
--- a/src/linux-virtblk.c
|
||||||
|
+++ b/src/linux-virtblk.c
|
||||||
|
@@ -56,6 +56,7 @@ parse_virtblk(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
debug("searching for virtio0/");
|
||||||
|
rc = sscanf(current, "virtio%x/%n", &tosser, &pos);
|
||||||
|
debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ dbgmk(" ", pos);
|
||||||
|
/*
|
||||||
|
* If we couldn't find virtioX/ then it isn't a virtio device.
|
||||||
|
*/
|
||||||
|
diff --git a/src/util.h b/src/util.h
|
||||||
|
index 3f68d812700..845989bbfe9 100644
|
||||||
|
--- a/src/util.h
|
||||||
|
+++ b/src/util.h
|
||||||
|
@@ -284,6 +284,40 @@ swizzle_guid_to_uuid(efi_guid_t *guid)
|
||||||
|
u16[1] = __builtin_bswap16(u16[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline void UNUSED
|
||||||
|
+debug_markers_(const char * const file, int line,
|
||||||
|
+ const char * const func, int level,
|
||||||
|
+ const char * const prefix, ...)
|
||||||
|
+{
|
||||||
|
+ FILE *logfile;
|
||||||
|
+ va_list ap;
|
||||||
|
+ int pos;
|
||||||
|
+ int n = 0;
|
||||||
|
+ bool on = false;
|
||||||
|
+
|
||||||
|
+ va_start(ap, prefix);
|
||||||
|
+ for (n = 0, pos = va_arg(ap, int); pos >= 0; pos = va_arg(ap, int), n++)
|
||||||
|
+ ;
|
||||||
|
+ va_end(ap);
|
||||||
|
+ if (n < 2)
|
||||||
|
+ return;
|
||||||
|
+ n = 0;
|
||||||
|
+
|
||||||
|
+ efi_set_loglevel(level);
|
||||||
|
+ logfile = efi_get_logfile();
|
||||||
|
+ fprintf(logfile, "%s:%d %s(): %s", file, line, func, prefix ? prefix : "");
|
||||||
|
+ va_start(ap, prefix);
|
||||||
|
+ while ((pos = va_arg(ap, int)) >= 0) {
|
||||||
|
+ for (; n <= pos; n++) {
|
||||||
|
+ if (n == pos)
|
||||||
|
+ on = !on;
|
||||||
|
+ fprintf(logfile, "%c", on ? '^' : ' ');
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ fprintf(logfile, "\n");
|
||||||
|
+ va_end(ap);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
#define log_(file, line, func, level, fmt, args...) \
|
||||||
|
({ \
|
||||||
|
efi_set_loglevel(level); \
|
||||||
|
@@ -312,6 +346,7 @@ swizzle_guid_to_uuid(efi_guid_t *guid)
|
||||||
|
})
|
||||||
|
#define log_hex(level, buf, size) log_hex_(__FILE__, __LINE__, __func__, level, buf, size)
|
||||||
|
#define debug_hex(buf, size) log_hex(LOG_DEBUG, buf, size)
|
||||||
|
+#define dbgmk(prefix, args...) debug_markers_(__FILE__, __LINE__, __func__, LOG_DEBUG, prefix, ## args, -1)
|
||||||
|
|
||||||
|
#endif /* EFIVAR_UTIL_H */
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
25
SOURCES/0053-gitignore-ignore-.strace.patch
Normal file
25
SOURCES/0053-gitignore-ignore-.strace.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From 45d1aa955a38541ba8e1554026847e582ae28bfd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 16 Oct 2019 10:01:00 -0400
|
||||||
|
Subject: [PATCH 53/63] gitignore: ignore *.strace
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
.gitignore | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/.gitignore b/.gitignore
|
||||||
|
index 947d88eec42..f61b0bcb340 100644
|
||||||
|
--- a/.gitignore
|
||||||
|
+++ b/.gitignore
|
||||||
|
@@ -14,6 +14,7 @@
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.spec
|
||||||
|
+*.strace
|
||||||
|
*.tar.*
|
||||||
|
*.var
|
||||||
|
core.*
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
809
SOURCES/0054-Improve-consistency-of-debug-prints.patch
Normal file
809
SOURCES/0054-Improve-consistency-of-debug-prints.patch
Normal file
@ -0,0 +1,809 @@
|
|||||||
|
From cb81253cc60d9641ee766fa2be691d82821710ca Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 15 Oct 2019 16:26:30 -0400
|
||||||
|
Subject: [PATCH 54/63] Improve consistency of debug prints
|
||||||
|
|
||||||
|
This changes debug prints in a couple of ways:
|
||||||
|
- always calls the path we're parsing "current" in the output
|
||||||
|
- always use ' not " for quoting in the debug output, so tools that
|
||||||
|
escape strings won't change the lenghts
|
||||||
|
- everything that parses "current" has a debug print after each parse
|
||||||
|
attempt and before returning.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/dp-acpi.c | 6 ++---
|
||||||
|
src/linux-acpi-root.c | 20 +++++++++--------
|
||||||
|
src/linux-acpi.c | 4 ++--
|
||||||
|
src/linux-ata.c | 6 ++---
|
||||||
|
src/linux-emmc.c | 5 +++--
|
||||||
|
src/linux-i2o.c | 8 +++----
|
||||||
|
src/linux-md.c | 4 ++--
|
||||||
|
src/linux-nvme.c | 8 +++++--
|
||||||
|
src/linux-pci-root.c | 16 ++++++++------
|
||||||
|
src/linux-pci.c | 17 +++++++--------
|
||||||
|
src/linux-pmem.c | 19 +++++++++-------
|
||||||
|
src/linux-sas.c | 3 +++
|
||||||
|
src/linux-sata.c | 9 ++++----
|
||||||
|
src/linux-scsi.c | 51 +++++++++++++++++++++++++++----------------
|
||||||
|
src/linux-soc-root.c | 6 ++---
|
||||||
|
src/linux-virtblk.c | 5 +++--
|
||||||
|
src/linux.c | 27 ++++++++++++++---------
|
||||||
|
17 files changed, 125 insertions(+), 89 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dp-acpi.c b/src/dp-acpi.c
|
||||||
|
index 02ec70eec7a..4845410c2cf 100644
|
||||||
|
--- a/src/dp-acpi.c
|
||||||
|
+++ b/src/dp-acpi.c
|
||||||
|
@@ -52,9 +52,9 @@ _format_acpi_hid_ex(unsigned char *buf, size_t size,
|
||||||
|
{
|
||||||
|
ssize_t off = 0;
|
||||||
|
|
||||||
|
- debug("hid:0x%08x hidstr:\"%s\"", dp->acpi_hid_ex.hid, hidstr);
|
||||||
|
- debug("cid:0x%08x cidstr:\"%s\"", dp->acpi_hid_ex.cid, cidstr);
|
||||||
|
- debug("uid:0x%08x uidstr:\"%s\"", dp->acpi_hid_ex.uid, uidstr);
|
||||||
|
+ debug("hid:0x%08x hidstr:'%s'", dp->acpi_hid_ex.hid, hidstr);
|
||||||
|
+ debug("cid:0x%08x cidstr:'%s'", dp->acpi_hid_ex.cid, cidstr);
|
||||||
|
+ debug("uid:0x%08x uidstr:'%s'", dp->acpi_hid_ex.uid, uidstr);
|
||||||
|
|
||||||
|
if (!hidstr && !cidstr && (uidstr || dp->acpi_hid_ex.uid)) {
|
||||||
|
format(buf, size, off, "AcpiExp",
|
||||||
|
diff --git a/src/linux-acpi-root.c b/src/linux-acpi-root.c
|
||||||
|
index 5ed4d7f5b86..57a648981b3 100644
|
||||||
|
--- a/src/linux-acpi-root.c
|
||||||
|
+++ b/src/linux-acpi-root.c
|
||||||
|
@@ -44,7 +44,7 @@ static ssize_t
|
||||||
|
parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos = 0;
|
||||||
|
+ int pos = -1;
|
||||||
|
uint16_t pad0;
|
||||||
|
uint8_t pad1;
|
||||||
|
char *acpi_header = NULL;
|
||||||
|
@@ -62,7 +62,7 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
* side in sscanf.
|
||||||
|
*/
|
||||||
|
rc = sscanf(devpart, "../../devices/platform/%n", &pos);
|
||||||
|
- debug("devpart:\"%s\" rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
+ debug("current:'%s' rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
if (rc != 0 || pos < 1)
|
||||||
|
return 0;
|
||||||
|
@@ -94,16 +94,16 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
dev->acpi_root.acpi_hid_str[pos] = 0;
|
||||||
|
- debug("acpi_hid_str:\"%s\"", dev->acpi_root.acpi_hid_str);
|
||||||
|
+ debug("acpi_hid_str:'%s'", dev->acpi_root.acpi_hid_str);
|
||||||
|
|
||||||
|
pos -= 4;
|
||||||
|
- debug("devpart:\"%s\" rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
+ debug("current:'%s' rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
acpi_header = strndupa(devpart, pos);
|
||||||
|
if (!acpi_header)
|
||||||
|
return 0;
|
||||||
|
acpi_header[pos] = 0;
|
||||||
|
- debug("devpart:\"%s\" acpi_header:\"%s\"", devpart, acpi_header);
|
||||||
|
+ debug("current:'%s' acpi_header:'%s'", devpart, acpi_header);
|
||||||
|
devpart += pos;
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -114,7 +114,7 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
efi_error("Could not parse ACPI path \"%s\"", devpart);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
- debug("devpart:\"%s\" parsed:%04hx:%02hhx pos:%d rc:%d",
|
||||||
|
+ debug("current:'%s' parsed:%04hx:%02hhx pos:%d rc:%d",
|
||||||
|
devpart, pad0, pad1, pos, rc);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
|
||||||
|
@@ -134,12 +134,14 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
efi_error("Could not parse hid/uid");
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
- debug("Parsed HID:0x%08x UID:0x%"PRIx64" uidstr:\"%s\" path:\"%s\"",
|
||||||
|
+ debug("Parsed HID:0x%08x UID:0x%"PRIx64" uidstr:'%s' path:'%s'",
|
||||||
|
dev->acpi_root.acpi_hid, dev->acpi_root.acpi_uid,
|
||||||
|
dev->acpi_root.acpi_uid_str,
|
||||||
|
dev->acpi_root.acpi_cid_str);
|
||||||
|
|
||||||
|
- return devpart - current;
|
||||||
|
+ size_t sz = devpart - current;
|
||||||
|
+ debug("current:'%s' sz:%zd", devpart, sz);
|
||||||
|
+ return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
@@ -151,7 +153,7 @@ dp_create_acpi_root(struct device *dev,
|
||||||
|
debug("entry buf:%p size:%zd off:%zd", buf, size, off);
|
||||||
|
|
||||||
|
if (dev->acpi_root.acpi_uid_str || dev->acpi_root.acpi_cid_str) {
|
||||||
|
- debug("creating acpi_hid_ex dp hid:0x%08x uid:0x%"PRIx64" uidstr:\"%s\" cidstr:\"%s\"",
|
||||||
|
+ debug("creating acpi_hid_ex dp hid:0x%08x uid:0x%"PRIx64" uidstr:'%s' cidstr:'%s'",
|
||||||
|
dev->acpi_root.acpi_hid, dev->acpi_root.acpi_uid,
|
||||||
|
dev->acpi_root.acpi_uid_str, dev->acpi_root.acpi_cid_str);
|
||||||
|
new = efidp_make_acpi_hid_ex(buf + off, size ? size - off : 0,
|
||||||
|
diff --git a/src/linux-acpi.c b/src/linux-acpi.c
|
||||||
|
index 919f4654ae3..70161ca7b9e 100644
|
||||||
|
--- a/src/linux-acpi.c
|
||||||
|
+++ b/src/linux-acpi.c
|
||||||
|
@@ -54,7 +54,7 @@ parse_acpi_hid_uid(struct device *dev, const char *fmt, ...)
|
||||||
|
if (l > 1) {
|
||||||
|
fbuf[l-1] = 0;
|
||||||
|
dev->acpi_root.acpi_cid_str = strdup(fbuf);
|
||||||
|
- debug("Setting ACPI root path to \"%s\"", fbuf);
|
||||||
|
+ debug("Setting ACPI root path to '%s'", fbuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -111,7 +111,7 @@ hid_err:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- debug("acpi root UID:0x%"PRIx64" uidstr:\"%s\"",
|
||||||
|
+ debug("acpi root UID:0x%"PRIx64" uidstr:'%s'",
|
||||||
|
dev->acpi_root.acpi_uid, dev->acpi_root.acpi_uid_str);
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
diff --git a/src/linux-ata.c b/src/linux-ata.c
|
||||||
|
index b6a7c2dcf8a..7bb23da60f5 100644
|
||||||
|
--- a/src/linux-ata.c
|
||||||
|
+++ b/src/linux-ata.c
|
||||||
|
@@ -126,9 +126,9 @@ parse_ata(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
dev->ata_info.scsi_lun = scsi_lun;
|
||||||
|
|
||||||
|
char *block = strstr(current, "/block/");
|
||||||
|
- if (!block)
|
||||||
|
- return -1;
|
||||||
|
- return block + 1 - current;
|
||||||
|
+ ssize_t sz = block ? block + 1 - current : -1;
|
||||||
|
+ debug("current:'%s' sz:%zd", current, sz);
|
||||||
|
+ return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
diff --git a/src/linux-emmc.c b/src/linux-emmc.c
|
||||||
|
index 59ef8e7524d..74cf54aa336 100644
|
||||||
|
--- a/src/linux-emmc.c
|
||||||
|
+++ b/src/linux-emmc.c
|
||||||
|
@@ -49,7 +49,7 @@ parse_emmc(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
int32_t tosser0, tosser1, tosser2, tosser3, slot_id, partition;
|
||||||
|
- int pos0 = 0, pos1 = 0;
|
||||||
|
+ int pos0 = -1, pos1 = -1;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ parse_emmc(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
rc = sscanf(current, "mmc_host/mmc%d/mmc%d:%d/block/mmcblk%d%n/mmcblk%dp%d%n",
|
||||||
|
&tosser0, &tosser1, &tosser2, &slot_id,
|
||||||
|
&pos0, &tosser3, &partition, &pos1);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
dbgmk(" ", pos0, pos1);
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our emmc devices.
|
||||||
|
@@ -75,6 +75,7 @@ parse_emmc(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
pos0 = pos1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ debug("current:'%s' sz:%d\n", current, pos0);
|
||||||
|
return pos0;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/linux-i2o.c b/src/linux-i2o.c
|
||||||
|
index ebd92aeeb53..76b3d4d5d39 100644
|
||||||
|
--- a/src/linux-i2o.c
|
||||||
|
+++ b/src/linux-i2o.c
|
||||||
|
@@ -33,7 +33,7 @@
|
||||||
|
* ... probably doesn't work.
|
||||||
|
*/
|
||||||
|
static ssize_t
|
||||||
|
-parse_i2o(struct device *dev, const char *current UNUSED, const char *root UNUSED)
|
||||||
|
+parse_i2o(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
debug("entry");
|
||||||
|
/* I2O disks can have up to 16 partitions, or 4 bits worth. */
|
||||||
|
@@ -47,9 +47,9 @@ parse_i2o(struct device *dev, const char *current UNUSED, const char *root UNUSE
|
||||||
|
}
|
||||||
|
|
||||||
|
char *block = strstr(current, "/block/");
|
||||||
|
- if (!block)
|
||||||
|
- return -1;
|
||||||
|
- return block + 1 - current;
|
||||||
|
+ ssize_t sz = block ? block + 1 - current : -1;
|
||||||
|
+ debug("current:'%s' sz:%zd", current, sz);
|
||||||
|
+ return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum interface_type i2o_iftypes[] = { i2o, unknown };
|
||||||
|
diff --git a/src/linux-md.c b/src/linux-md.c
|
||||||
|
index 1d7bd3195c0..ded7cbd169c 100644
|
||||||
|
--- a/src/linux-md.c
|
||||||
|
+++ b/src/linux-md.c
|
||||||
|
@@ -50,7 +50,7 @@ parse_md(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
debug("searching for mdM/mdMpN");
|
||||||
|
rc = sscanf(current, "md%d/%nmd%dp%d%n",
|
||||||
|
&md, &pos0, &tosser0, &part, &pos1);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
dbgmk(" ", pos0, pos1);
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our partitioned md devices.
|
||||||
|
@@ -63,10 +63,10 @@ parse_md(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
if (dev->part == -1)
|
||||||
|
dev->part = part;
|
||||||
|
|
||||||
|
+ debug("current:'%s' sz:%d\n", current, pos1);
|
||||||
|
return pos1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
static char *
|
||||||
|
make_part_name(struct device *dev)
|
||||||
|
{
|
||||||
|
diff --git a/src/linux-nvme.c b/src/linux-nvme.c
|
||||||
|
index 0b4eae74f79..7b18d7990ac 100644
|
||||||
|
--- a/src/linux-nvme.c
|
||||||
|
+++ b/src/linux-nvme.c
|
||||||
|
@@ -53,6 +53,7 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
int rc;
|
||||||
|
int32_t tosser0, tosser1, tosser2, ctrl_id, ns_id, partition;
|
||||||
|
uint8_t *filebuf = NULL;
|
||||||
|
+ ssize_t sz = 0;
|
||||||
|
int pos0 = 0, pos1 = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
@@ -61,7 +62,7 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
rc = sscanf(current, "nvme/nvme%d/nvme%dn%d%n/nvme%dn%dp%d%n",
|
||||||
|
&tosser0, &ctrl_id, &ns_id, &pos0,
|
||||||
|
&tosser1, &tosser2, &partition, &pos1);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
dbgmk(" ", pos0, pos1);
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our nvme devices.
|
||||||
|
@@ -81,6 +82,8 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
pos0 = pos1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ sz += pos0;
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* now fish the eui out of sysfs is there is one...
|
||||||
|
*/
|
||||||
|
@@ -111,7 +114,8 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
memcpy(dev->nvme_info.eui, eui, sizeof(eui));
|
||||||
|
}
|
||||||
|
|
||||||
|
- return pos0;
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, sz);
|
||||||
|
+ return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
diff --git a/src/linux-pci-root.c b/src/linux-pci-root.c
|
||||||
|
index c84b639cbfe..c7e279118f5 100644
|
||||||
|
--- a/src/linux-pci-root.c
|
||||||
|
+++ b/src/linux-pci-root.c
|
||||||
|
@@ -44,7 +44,7 @@ static ssize_t
|
||||||
|
parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos = 0;
|
||||||
|
+ int pos0 = -1, pos1 = -1;
|
||||||
|
uint16_t root_domain;
|
||||||
|
uint8_t root_bus;
|
||||||
|
const char *devpart = current;
|
||||||
|
@@ -56,15 +56,16 @@ parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
* pci0000:00/
|
||||||
|
* ^d ^p
|
||||||
|
*/
|
||||||
|
- rc = sscanf(devpart, "../../devices/pci%hx:%hhx/%n", &root_domain, &root_bus, &pos);
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
+ rc = sscanf(devpart, "%n../../devices/pci%hx:%hhx/%n", &pos0, &root_domain, &root_bus, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d", devpart, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* If we can't find that, it's not a PCI device.
|
||||||
|
*/
|
||||||
|
if (rc != 2)
|
||||||
|
return 0;
|
||||||
|
- devpart += pos;
|
||||||
|
+ devpart += pos1;
|
||||||
|
|
||||||
|
dev->pci_root.pci_domain = root_domain;
|
||||||
|
dev->pci_root.pci_bus = root_bus;
|
||||||
|
@@ -75,7 +76,8 @@ parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
- return devpart - current;
|
||||||
|
+ debug("current:'%s' sz:%d\n", devpart, pos1);
|
||||||
|
+ return pos1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
@@ -86,7 +88,7 @@ dp_create_pci_root(struct device *dev UNUSED,
|
||||||
|
debug("entry buf:%p size:%zd off:%zd", buf, size, off);
|
||||||
|
debug("returning 0");
|
||||||
|
if (dev->acpi_root.acpi_uid_str) {
|
||||||
|
- debug("creating acpi_hid_ex dp hid:0x%08x uid:\"%s\"",
|
||||||
|
+ debug("creating acpi_hid_ex dp hid:0x%08x uid:'%s'",
|
||||||
|
dev->acpi_root.acpi_hid,
|
||||||
|
dev->acpi_root.acpi_uid_str);
|
||||||
|
new = efidp_make_acpi_hid_ex(buf + off, size ? size - off : 0,
|
||||||
|
diff --git a/src/linux-pci.c b/src/linux-pci.c
|
||||||
|
index 0de330db628..a3a0dc28afd 100644
|
||||||
|
--- a/src/linux-pci.c
|
||||||
|
+++ b/src/linux-pci.c
|
||||||
|
@@ -46,7 +46,7 @@ static ssize_t
|
||||||
|
parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos = 0;
|
||||||
|
+ int pos0 = -1, pos1 = -1;
|
||||||
|
const char *devpart = current;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
@@ -62,16 +62,15 @@ parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
unsigned int i = dev->n_pci_devs;
|
||||||
|
struct stat statbuf;
|
||||||
|
|
||||||
|
- debug("devpart is \"%s\"", devpart);
|
||||||
|
- pos = 0;
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
debug("searching for 0000:00:00.0/");
|
||||||
|
- rc = sscanf(devpart, "%hx:%hhx:%hhx.%hhx/%n",
|
||||||
|
- &domain, &bus, &device, &function, &pos);
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
+ rc = sscanf(devpart, "%n%hx:%hhx:%hhx.%hhx/%n",
|
||||||
|
+ &pos0, &domain, &bus, &device, &function, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d", devpart, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc != 4)
|
||||||
|
break;
|
||||||
|
- devpart += pos;
|
||||||
|
+ devpart += pos1;
|
||||||
|
|
||||||
|
debug("found pci domain %04hx:%02hhx:%02hhx.%02hhx",
|
||||||
|
domain, bus, device, function);
|
||||||
|
@@ -115,7 +114,7 @@ parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
dev->n_pci_devs += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- debug("next:\"%s\"", devpart);
|
||||||
|
+ debug("current:'%s' sz:%zd\n", devpart, devpart - current);
|
||||||
|
return devpart - current;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/linux-pmem.c b/src/linux-pmem.c
|
||||||
|
index 18eb7dce5e3..49db24560fa 100644
|
||||||
|
--- a/src/linux-pmem.c
|
||||||
|
+++ b/src/linux-pmem.c
|
||||||
|
@@ -75,7 +75,7 @@ parse_pmem(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
uint8_t *filebuf = NULL;
|
||||||
|
uint8_t system, sysbus, acpi_id;
|
||||||
|
uint16_t pnp_id;
|
||||||
|
- int ndbus, region, btt_region_id, btt_id, rc, pos;
|
||||||
|
+ int ndbus, region, btt_region_id, btt_id, rc, pos0, pos1;
|
||||||
|
char *namespace = NULL;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
@@ -101,14 +101,16 @@ parse_pmem(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
*
|
||||||
|
* 259:0 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/ndbus0/region12/btt12.1/block/pmem12s
|
||||||
|
*/
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
rc = sscanf(current,
|
||||||
|
- "../../devices/LNXSYSTM:%hhx/LNXSYBUS:%hhx/ACPI%hx:%hhx/ndbus%d/region%d/btt%d.%d/%n",
|
||||||
|
- &system, &sysbus, &pnp_id, &acpi_id, &ndbus, ®ion,
|
||||||
|
- &btt_region_id, &btt_id, &pos);
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d", current, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
+ "../../devices/%nLNXSYSTM:%hhx/LNXSYBUS:%hhx/ACPI%hx:%hhx/ndbus%d/region%d/btt%d.%d/%n",
|
||||||
|
+ &pos0, &system, &sysbus, &pnp_id, &acpi_id, &ndbus,
|
||||||
|
+ ®ion, &btt_region_id, &btt_id, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc < 8)
|
||||||
|
return 0;
|
||||||
|
+ current += pos1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* but the UUID we really do need to have.
|
||||||
|
@@ -123,7 +125,7 @@ parse_pmem(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
filebuf = NULL;
|
||||||
|
- debug("nvdimm namespace is \"%s\"", namespace);
|
||||||
|
+ debug("nvdimm namespace is '%s'", namespace);
|
||||||
|
rc = read_sysfs_file(&filebuf, "bus/nd/devices/%s/uuid", namespace);
|
||||||
|
free(namespace);
|
||||||
|
if (rc < 0 || filebuf == NULL)
|
||||||
|
@@ -158,7 +160,8 @@ parse_pmem(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
|
||||||
|
dev->interface_type = nd_pmem;
|
||||||
|
|
||||||
|
- return pos;
|
||||||
|
+ debug("current:'%s' sz:%d\n", current, pos1);
|
||||||
|
+ return pos1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
diff --git a/src/linux-sas.c b/src/linux-sas.c
|
||||||
|
index f985deeaa3f..d14fcfb231a 100644
|
||||||
|
--- a/src/linux-sas.c
|
||||||
|
+++ b/src/linux-sas.c
|
||||||
|
@@ -172,6 +172,7 @@ parse_sas(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
*/
|
||||||
|
if (pos < 0)
|
||||||
|
return 0;
|
||||||
|
+ current += pos;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure it has the actual /SAS/ bits before we continue
|
||||||
|
@@ -236,6 +237,8 @@ parse_sas(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
dev->scsi_info.scsi_target = scsi_target;
|
||||||
|
dev->scsi_info.scsi_lun = scsi_lun;
|
||||||
|
dev->interface_type = sas;
|
||||||
|
+
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, pos);
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/linux-sata.c b/src/linux-sata.c
|
||||||
|
index b0caa3fa401..4f4e983568e 100644
|
||||||
|
--- a/src/linux-sata.c
|
||||||
|
+++ b/src/linux-sata.c
|
||||||
|
@@ -161,7 +161,7 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
*/
|
||||||
|
debug("searching for ata1/");
|
||||||
|
rc = sscanf(current, "ata%"PRIu32"/%n", &print_id, &pos);
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
/*
|
||||||
|
* If we don't find this one, it isn't an ata device, so return 0 not
|
||||||
|
@@ -175,7 +175,7 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
|
||||||
|
debug("searching for host0/");
|
||||||
|
rc = sscanf(current, "host%"PRIu32"/%n", &scsi_bus, &pos);
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
if (rc != 1)
|
||||||
|
return -1;
|
||||||
|
@@ -185,7 +185,7 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
debug("searching for target0:0:0:0/");
|
||||||
|
rc = sscanf(current, "target%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
&scsi_device, &scsi_target, &scsi_lun, &pos);
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
if (rc != 3)
|
||||||
|
return -1;
|
||||||
|
@@ -195,7 +195,7 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
debug("searching for 0:0:0:0/");
|
||||||
|
rc = sscanf(current, "%"PRIu32":%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
&tosser0, &tosser1, &tosser2, &tosser3, &pos);
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
if (rc != 4)
|
||||||
|
return -1;
|
||||||
|
@@ -213,6 +213,7 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
if (dev->interface_type == unknown)
|
||||||
|
dev->interface_type = sata;
|
||||||
|
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, current - devlink);
|
||||||
|
return current - devlink;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/linux-scsi.c b/src/linux-scsi.c
|
||||||
|
index 96fde7e15fa..6b92908d6bc 100644
|
||||||
|
--- a/src/linux-scsi.c
|
||||||
|
+++ b/src/linux-scsi.c
|
||||||
|
@@ -43,7 +43,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
uint32_t *remote_target_id)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int sz = 0;
|
||||||
|
+ ssize_t sz = 0;
|
||||||
|
int pos0 = 0, pos1 = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
@@ -100,10 +100,11 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
*/
|
||||||
|
debug("searching for host4/");
|
||||||
|
rc = sscanf(current, "host%d/%n", scsi_host, &pos0);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
dbgmk(" ", pos0);
|
||||||
|
if (rc != 1)
|
||||||
|
return -1;
|
||||||
|
+ current += pos0;
|
||||||
|
sz += pos0;
|
||||||
|
pos0 = 0;
|
||||||
|
|
||||||
|
@@ -116,11 +117,12 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
* port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
|
||||||
|
*/
|
||||||
|
debug("searching for port-4:0 or port-4:0:0");
|
||||||
|
- rc = sscanf(current+sz, "port-%d:%d%n:%d%n", &tosser0,
|
||||||
|
+ rc = sscanf(current, "port-%d:%d%n:%d%n", &tosser0,
|
||||||
|
&tosser1, &pos0, &tosser2, &pos1);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d pos1:%d\n", current+sz, rc, pos0, pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc == 2 || rc == 3) {
|
||||||
|
+ current += pos0;
|
||||||
|
sz += pos0;
|
||||||
|
pos0 = 0;
|
||||||
|
if (local_port_id && rc == 2)
|
||||||
|
@@ -128,8 +130,10 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
if (remote_port_id && rc == 3)
|
||||||
|
*remote_port_id = tosser2;
|
||||||
|
|
||||||
|
- if (current[sz] == '/')
|
||||||
|
+ if (current[0] == '/') {
|
||||||
|
+ current += 1;
|
||||||
|
sz += 1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We might have this next:
|
||||||
|
@@ -143,8 +147,8 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
* to get past it.
|
||||||
|
*/
|
||||||
|
debug("searching for expander-4:0/");
|
||||||
|
- rc = sscanf(current+sz, "expander-%d:%d/%n", &tosser0, &tosser1, &pos0);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ rc = sscanf(current, "expander-%d:%d/%n", &tosser0, &tosser1, &pos0);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
dbgmk(" ", pos0);
|
||||||
|
if (rc == 2) {
|
||||||
|
if (!remote_target_id) {
|
||||||
|
@@ -152,6 +156,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*remote_target_id = tosser1;
|
||||||
|
+ current += pos0;
|
||||||
|
sz += pos0;
|
||||||
|
pos0 = 0;
|
||||||
|
|
||||||
|
@@ -159,13 +164,14 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
* if we have that, we should have a 3-part port next
|
||||||
|
*/
|
||||||
|
debug("searching for port-2:0:2/");
|
||||||
|
- rc = sscanf(current+sz, "port-%d:%d:%d/%n", &tosser0, &tosser1, &tosser2, &pos0);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ rc = sscanf(current, "port-%d:%d:%d/%n", &tosser0, &tosser1, &tosser2, &pos0);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
dbgmk(" ", pos0);
|
||||||
|
if (rc != 3) {
|
||||||
|
efi_error("Couldn't parse port expander port string");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
+ current += pos0;
|
||||||
|
sz += pos0;
|
||||||
|
}
|
||||||
|
pos0 = 0;
|
||||||
|
@@ -177,13 +183,13 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
* but we don't care for now about any of them anyway.
|
||||||
|
*/
|
||||||
|
debug("searching for end_device-4:0/ or end_device-4:0:0/");
|
||||||
|
- rc = sscanf(current + sz, "end_device-%d:%d%n", &tosser0, &tosser1, &pos0);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ rc = sscanf(current, "end_device-%d:%d%n", &tosser0, &tosser1, &pos0);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
if (rc != 2)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
pos1 = 0;
|
||||||
|
- rc = sscanf(current + sz + pos0, ":%d%n", &tosser2, &pos1);
|
||||||
|
+ rc = sscanf(current + pos0, ":%d%n", &tosser2, &pos1);
|
||||||
|
if (rc != 0 && rc != 1)
|
||||||
|
return -1;
|
||||||
|
dbgmk(" ", pos0, pos0+pos1);
|
||||||
|
@@ -191,11 +197,14 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
*remote_port_id = tosser2;
|
||||||
|
if (local_port_id && rc == 0)
|
||||||
|
*local_port_id = tosser1;
|
||||||
|
+ current += pos0 + pos1;
|
||||||
|
sz += pos0 + pos1;
|
||||||
|
pos0 = pos1 = 0;
|
||||||
|
|
||||||
|
- if (current[sz] == '/')
|
||||||
|
+ if (current[0] == '/') {
|
||||||
|
+ current += sz;
|
||||||
|
sz += 1;
|
||||||
|
+ }
|
||||||
|
} else if (rc != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
@@ -205,12 +214,13 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
*/
|
||||||
|
uint64_t tosser3;
|
||||||
|
debug("searching for target4:0:0/");
|
||||||
|
- rc = sscanf(current + sz, "target%d:%d:%"PRIu64"/%n", &tosser0, &tosser1,
|
||||||
|
+ rc = sscanf(current, "target%d:%d:%"PRIu64"/%n", &tosser0, &tosser1,
|
||||||
|
&tosser3, &pos0);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
dbgmk(" ", pos0);
|
||||||
|
if (rc != 3)
|
||||||
|
return -1;
|
||||||
|
+ current += pos0;
|
||||||
|
sz += pos0;
|
||||||
|
pos0 = 0;
|
||||||
|
|
||||||
|
@@ -218,15 +228,16 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
* %d:%d:%d:%llu/
|
||||||
|
*/
|
||||||
|
debug("searching for 4:0:0:0/");
|
||||||
|
- rc = sscanf(current + sz, "%d:%d:%d:%"PRIu64"/%n",
|
||||||
|
+ rc = sscanf(current, "%d:%d:%d:%"PRIu64"/%n",
|
||||||
|
scsi_bus, scsi_device, scsi_target, scsi_lun, &pos0);
|
||||||
|
- debug("current:\"%s\" rc:%d pos0:%d\n", current+sz, rc, pos0);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
dbgmk(" ", pos0);
|
||||||
|
if (rc != 4)
|
||||||
|
return -1;
|
||||||
|
+ current += pos0;
|
||||||
|
sz += pos0;
|
||||||
|
|
||||||
|
- debug("returning %d", sz);
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, sz);
|
||||||
|
return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -248,7 +259,7 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
&dev->scsi_info.scsi_target,
|
||||||
|
&dev->scsi_info.scsi_lun,
|
||||||
|
&pos);
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d\n", dev->device, rc, pos);
|
||||||
|
+ debug("current:'%s' rc:%d pos:%d\n", dev->device, rc, pos);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
if (rc != 4)
|
||||||
|
return 0;
|
||||||
|
@@ -259,6 +270,7 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
if (sz < 0)
|
||||||
|
return 0;
|
||||||
|
+ current += sz;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SCSI disks can have up to 16 partitions, or 4 bits worth
|
||||||
|
@@ -281,6 +293,7 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, sz);
|
||||||
|
return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/linux-soc-root.c b/src/linux-soc-root.c
|
||||||
|
index c932670ef15..9c9e9573dcd 100644
|
||||||
|
--- a/src/linux-soc-root.c
|
||||||
|
+++ b/src/linux-soc-root.c
|
||||||
|
@@ -49,12 +49,12 @@ parse_soc_root(struct device *dev UNUSED, const char *current, const char *root
|
||||||
|
rc = sscanf(devpart, "../../devices/platform/soc/%*[^/]/%n", &pos);
|
||||||
|
if (rc != 0)
|
||||||
|
return 0;
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d", current, rc, pos);
|
||||||
|
+ debug("current:'%s' rc:%d pos:%d", current, rc, pos);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
devpart += pos;
|
||||||
|
- debug("new position is \"%s\"", devpart);
|
||||||
|
|
||||||
|
- return devpart - current;
|
||||||
|
+ debug("current:'%s' sz:%d\n", devpart, pos);
|
||||||
|
+ return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum interface_type soc_root_iftypes[] = { soc_root, unknown };
|
||||||
|
diff --git a/src/linux-virtblk.c b/src/linux-virtblk.c
|
||||||
|
index 7517db55555..df14673dac8 100644
|
||||||
|
--- a/src/linux-virtblk.c
|
||||||
|
+++ b/src/linux-virtblk.c
|
||||||
|
@@ -48,14 +48,14 @@ static ssize_t
|
||||||
|
parse_virtblk(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
uint32_t tosser;
|
||||||
|
- int pos = 0;
|
||||||
|
+ int pos = -1;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
debug("searching for virtio0/");
|
||||||
|
rc = sscanf(current, "virtio%x/%n", &tosser, &pos);
|
||||||
|
- debug("current:\"%s\" rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
+ debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
dbgmk(" ", pos);
|
||||||
|
/*
|
||||||
|
* If we couldn't find virtioX/ then it isn't a virtio device.
|
||||||
|
@@ -65,6 +65,7 @@ parse_virtblk(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
|
||||||
|
dev->interface_type = virtblk;
|
||||||
|
|
||||||
|
+ debug("current:'%s' sz:%d\n", current, pos);
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/linux.c b/src/linux.c
|
||||||
|
index 45b1ee2d96f..45f07d3913c 100644
|
||||||
|
--- a/src/linux.c
|
||||||
|
+++ b/src/linux.c
|
||||||
|
@@ -182,10 +182,10 @@ set_disk_and_part_name(struct device *dev)
|
||||||
|
errno = 0;
|
||||||
|
debug("dev->disk_name:%p dev->part_name:%p", dev->disk_name, dev->part_name);
|
||||||
|
debug("dev->part:%d", dev->part);
|
||||||
|
- debug("ultimate:\"%s\"", ultimate ? : "");
|
||||||
|
- debug("penultimate:\"%s\"", penultimate ? : "");
|
||||||
|
- debug("approximate:\"%s\"", approximate ? : "");
|
||||||
|
- debug("proximate:\"%s\"", proximate ? : "");
|
||||||
|
+ debug("ultimate:'%s'", ultimate ? : "");
|
||||||
|
+ debug("penultimate:'%s'", penultimate ? : "");
|
||||||
|
+ debug("approximate:'%s'", approximate ? : "");
|
||||||
|
+ debug("proximate:'%s'", proximate ? : "");
|
||||||
|
|
||||||
|
if (ultimate && penultimate &&
|
||||||
|
((proximate && !strcmp(proximate, "nvme")) ||
|
||||||
|
@@ -455,7 +455,11 @@ struct device HIDDEN
|
||||||
|
efi_error("parsing %s failed", probe->name);
|
||||||
|
goto err;
|
||||||
|
} else if (pos > 0) {
|
||||||
|
- debug("%s matched %s", probe->name, current);
|
||||||
|
+ char match[pos+1];
|
||||||
|
+
|
||||||
|
+ strncpy(match, current, pos);
|
||||||
|
+ match[pos] = '\0';
|
||||||
|
+ debug("%s matched '%s'", probe->name, match);
|
||||||
|
dev->flags |= probe->flags;
|
||||||
|
|
||||||
|
if (probe->flags & DEV_PROVIDES_HD ||
|
||||||
|
@@ -465,7 +469,10 @@ struct device HIDDEN
|
||||||
|
|
||||||
|
dev->probes[n++] = dev_probes[i];
|
||||||
|
current += pos;
|
||||||
|
- debug("current:%s", current);
|
||||||
|
+ if (current[0] == '\0')
|
||||||
|
+ debug("finished");
|
||||||
|
+ else
|
||||||
|
+ debug("current:'%s'", current);
|
||||||
|
last_successful_probe = i;
|
||||||
|
|
||||||
|
if (!*current || !strncmp(current, "block/", 6))
|
||||||
|
@@ -474,8 +481,8 @@ struct device HIDDEN
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- debug("dev_probes[i+1]: %p dev->interface_type: %d\n",
|
||||||
|
- dev_probes[i+1], dev->interface_type);
|
||||||
|
+ debug("dev_probes[%d]: %p dev->interface_type: %d\n",
|
||||||
|
+ i+1, dev_probes[i+1], dev->interface_type);
|
||||||
|
if (dev_probes[i+1] == NULL && dev->interface_type == unknown) {
|
||||||
|
pos = 0;
|
||||||
|
rc = sscanf(current, "%*[^/]/%n", &pos);
|
||||||
|
@@ -491,8 +498,8 @@ slash_err:
|
||||||
|
if (!current[pos])
|
||||||
|
goto slash_err;
|
||||||
|
|
||||||
|
- debug("Cannot parse device link segment \"%s\"", current);
|
||||||
|
- debug("Skipping to \"%s\"", current + pos);
|
||||||
|
+ debug("Cannot parse device link segment '%s'", current);
|
||||||
|
+ debug("Skipping to '%s'", current + pos);
|
||||||
|
debug("This means we can only create abbreviated paths");
|
||||||
|
dev->flags |= DEV_ABBREV_ONLY;
|
||||||
|
i = last_successful_probe;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,63 @@
|
|||||||
|
From 74aa359f7474040aef2bd18b66201412f853b5c4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 2 Oct 2019 17:01:00 -0400
|
||||||
|
Subject: [PATCH 55/63] Fix the error path in set_disk_and_part_name()
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/linux.c | 10 +++++++++-
|
||||||
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/linux.c b/src/linux.c
|
||||||
|
index 45f07d3913c..73c67cbafd3 100644
|
||||||
|
--- a/src/linux.c
|
||||||
|
+++ b/src/linux.c
|
||||||
|
@@ -169,6 +169,8 @@ set_disk_name(struct device *dev, const char * const fmt, ...)
|
||||||
|
int HIDDEN
|
||||||
|
set_disk_and_part_name(struct device *dev)
|
||||||
|
{
|
||||||
|
+ int rc = -1;
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* results are like such:
|
||||||
|
* maj:min -> ../../devices/pci$PCI_STUFF/$BLOCKDEV_STUFF/block/$DISK/$PART
|
||||||
|
@@ -200,6 +202,7 @@ set_disk_and_part_name(struct device *dev)
|
||||||
|
set_disk_name(dev, "%s", penultimate);
|
||||||
|
set_part_name(dev, "%s", ultimate);
|
||||||
|
debug("disk:%s part:%s", penultimate, ultimate);
|
||||||
|
+ rc = 0;
|
||||||
|
} else if (ultimate && approximate && !strcmp(approximate, "nvme")) {
|
||||||
|
/*
|
||||||
|
* 259:0 -> ../../devices/pci0000:00/0000:00:1d.0/0000:05:00.0/nvme/nvme0/nvme0n1
|
||||||
|
@@ -207,6 +210,7 @@ set_disk_and_part_name(struct device *dev)
|
||||||
|
set_disk_name(dev, "%s", ultimate);
|
||||||
|
set_part_name(dev, "%sp%d", ultimate, dev->part);
|
||||||
|
debug("disk:%s part:%sp%d", ultimate, ultimate, dev->part);
|
||||||
|
+ rc = 0;
|
||||||
|
} else if (ultimate && penultimate && !strcmp(penultimate, "block")) {
|
||||||
|
/*
|
||||||
|
* 253:0 -> ../../devices/virtual/block/dm-0 (... I guess)
|
||||||
|
@@ -220,15 +224,19 @@ set_disk_and_part_name(struct device *dev)
|
||||||
|
set_disk_name(dev, "%s", ultimate);
|
||||||
|
set_part_name(dev, "%s%d", ultimate, dev->part);
|
||||||
|
debug("disk:%s part:%s%d", ultimate, ultimate, dev->part);
|
||||||
|
+ rc = 0;
|
||||||
|
} else if (ultimate && approximate && !strcmp(approximate, "mtd")) {
|
||||||
|
/*
|
||||||
|
* 31:0 -> ../../devices/platform/1e000000.palmbus/1e000b00.spi/spi_master/spi32766/spi32766.0/mtd/mtd0/mtdblock0
|
||||||
|
*/
|
||||||
|
set_disk_name(dev, "%s", ultimate);
|
||||||
|
debug("disk:%s", ultimate);
|
||||||
|
+ rc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return 0;
|
||||||
|
+ if (rc < 0)
|
||||||
|
+ efi_error("Could not parse disk name:\"%s\"", dev->link);
|
||||||
|
+ return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct dev_probe *dev_probes[] = {
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,204 @@
|
|||||||
|
From 156d7a1e123f85863db854aae5c10acd3864f9d8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Fri, 11 Oct 2019 14:20:54 -0400
|
||||||
|
Subject: [PATCH 56/63] Try even harder to find disk device symlinks in sysfs.
|
||||||
|
|
||||||
|
Today's realization is that the thing encoded into the structure of
|
||||||
|
sysfs is, in the best case, the dependency graph of the makefile targets
|
||||||
|
to build a device driver.
|
||||||
|
|
||||||
|
In the case of nvme-fabric, or really wherever the kernel has
|
||||||
|
class_create() and device_create() in the same function, there's an
|
||||||
|
extra level of indirection.
|
||||||
|
|
||||||
|
Anyway, in this patch we stop pretending sysfs isn't completely absurd,
|
||||||
|
and just try adding "/device" in the middle of the driver symlink path,
|
||||||
|
until we actually either get ENOENT on the device symlink or find a
|
||||||
|
device symlink that actually has a driver symlink under it.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/linux-nvme.c | 13 +++++----
|
||||||
|
src/linux.c | 46 ++++++++++++++++++--------------
|
||||||
|
src/linux.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 101 insertions(+), 27 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/linux-nvme.c b/src/linux-nvme.c
|
||||||
|
index 7b18d7990ac..455c4c7ba9b 100644
|
||||||
|
--- a/src/linux-nvme.c
|
||||||
|
+++ b/src/linux-nvme.c
|
||||||
|
@@ -87,13 +87,12 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
/*
|
||||||
|
* now fish the eui out of sysfs is there is one...
|
||||||
|
*/
|
||||||
|
- rc = read_sysfs_file(&filebuf,
|
||||||
|
- "class/block/nvme%dn%d/eui",
|
||||||
|
- ctrl_id, ns_id);
|
||||||
|
- if ((rc < 0 && errno == ENOENT) || filebuf == NULL) {
|
||||||
|
- rc = read_sysfs_file(&filebuf,
|
||||||
|
- "class/block/nvme%dn%d/device/eui",
|
||||||
|
- ctrl_id, ns_id);
|
||||||
|
+ char *euipath = NULL;
|
||||||
|
+ rc = read_sysfs_file(&filebuf, "class/block/nvme%dn%d/eui", ctrl_id, ns_id);
|
||||||
|
+ if (rc < 0 && (errno == ENOENT || errno == ENOTDIR)) {
|
||||||
|
+ rc = find_device_file(&euipath, "eui", "class/block/nvme%dn%d", ctrl_id, ns_id);
|
||||||
|
+ if (rc >= 0 && euipath != NULL)
|
||||||
|
+ rc = read_sysfs_file(&filebuf, "%s", euipath);
|
||||||
|
}
|
||||||
|
if (rc >= 0 && filebuf != NULL) {
|
||||||
|
uint8_t eui[8];
|
||||||
|
diff --git a/src/linux.c b/src/linux.c
|
||||||
|
index 73c67cbafd3..30db22d95dd 100644
|
||||||
|
--- a/src/linux.c
|
||||||
|
+++ b/src/linux.c
|
||||||
|
@@ -401,26 +401,32 @@ struct device HIDDEN
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (dev->device[0] != 0) {
|
||||||
|
- rc = sysfs_readlink(&tmpbuf, "block/%s/device/driver", dev->disk_name);
|
||||||
|
+ /*
|
||||||
|
+ * So, on a normal disk, you get something like:
|
||||||
|
+ * /sys/block/sda/device -> ../../0:0:0:0
|
||||||
|
+ * /sys/block/sda/device/driver -> ../../../../../../../bus/scsi/drivers/sd
|
||||||
|
+ *
|
||||||
|
+ * On a directly attached nvme device you get:
|
||||||
|
+ * /sys/block/nvme0n1/device -> ../../nvme0
|
||||||
|
+ * /sys/block/nvme0n1/device/device -> ../../../0000:6e:00.0
|
||||||
|
+ * /sys/block/nvme0n1/device/device/driver -> ../../../../bus/pci/drivers/nvme
|
||||||
|
+ *
|
||||||
|
+ * On a fabric-attached nvme device, you get something like:
|
||||||
|
+ * /sys/block/nvme0n1/device -> ../../nvme0
|
||||||
|
+ * /sys/block/nvme0n1/device/device -> ../../ctl
|
||||||
|
+ * /sys/block/nvme0n1/device/device/device -> ../../../../../0000:6e:00.0
|
||||||
|
+ * /sys/block/nvme0n1/device/device/device/driver -> ../../../../../../bus/pci/drivers/nvme-fabrics
|
||||||
|
+ *
|
||||||
|
+ * ... I think? I don't have one in front of me.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+ char *filepath = NULL;
|
||||||
|
+ rc = find_device_file(&filepath, "driver", "block/%s", dev->disk_name);
|
||||||
|
+ if (rc >= 0) {
|
||||||
|
+ rc = sysfs_readlink(&tmpbuf, "%s", filepath);
|
||||||
|
if (rc < 0 || !tmpbuf) {
|
||||||
|
- if (errno == ENOENT) {
|
||||||
|
- /*
|
||||||
|
- * nvme, for example, will have nvme0n1/device point
|
||||||
|
- * at nvme0, and we need to look for device/driver
|
||||||
|
- * there.
|
||||||
|
- */
|
||||||
|
- rc = sysfs_readlink(&tmpbuf,
|
||||||
|
- "block/%s/device/device/driver",
|
||||||
|
- dev->disk_name);
|
||||||
|
- if (rc >= 0 && tmpbuf)
|
||||||
|
- efi_error_pop();
|
||||||
|
- }
|
||||||
|
- if (rc < 0 || !tmpbuf) {
|
||||||
|
- efi_error("readlink of /sys/block/%s/device/driver failed",
|
||||||
|
- dev->disk_name);
|
||||||
|
- goto err;
|
||||||
|
- }
|
||||||
|
+ efi_error("readlink of /sys/%s failed", filepath);
|
||||||
|
+ goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
linkbuf = pathseg(tmpbuf, -1);
|
||||||
|
@@ -431,7 +437,7 @@ struct device HIDDEN
|
||||||
|
|
||||||
|
dev->driver = strdup(linkbuf);
|
||||||
|
} else {
|
||||||
|
- dev->driver = strdup("");
|
||||||
|
+ dev->driver = strdup("");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dev->driver) {
|
||||||
|
diff --git a/src/linux.h b/src/linux.h
|
||||||
|
index 5ae64ffaacf..ae9835ef7ce 100644
|
||||||
|
--- a/src/linux.h
|
||||||
|
+++ b/src/linux.h
|
||||||
|
@@ -218,6 +218,22 @@ extern ssize_t HIDDEN make_mac_path(uint8_t *buf, ssize_t size,
|
||||||
|
_rc; \
|
||||||
|
})
|
||||||
|
|
||||||
|
+#define sysfs_access(mode, fmt, args...) \
|
||||||
|
+ ({ \
|
||||||
|
+ int rc_; \
|
||||||
|
+ char *pn_; \
|
||||||
|
+ \
|
||||||
|
+ rc_ = asprintfa(&pn_, "/sys/" fmt, ## args); \
|
||||||
|
+ if (rc_ >= 0) { \
|
||||||
|
+ rc_ = access(pn_, mode); \
|
||||||
|
+ if (rc_ < 0) \
|
||||||
|
+ efi_error("could not access %s", pn_); \
|
||||||
|
+ } else { \
|
||||||
|
+ efi_error("could not allocate memory"); \
|
||||||
|
+ } \
|
||||||
|
+ rc_; \
|
||||||
|
+ })
|
||||||
|
+
|
||||||
|
#define sysfs_stat(statbuf, fmt, args...) \
|
||||||
|
({ \
|
||||||
|
int rc_; \
|
||||||
|
@@ -251,6 +267,59 @@ extern ssize_t HIDDEN make_mac_path(uint8_t *buf, ssize_t size,
|
||||||
|
dir_; \
|
||||||
|
})
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Iterate a /sys/block directory looking for device/foo, device/device/foo,
|
||||||
|
+ * etc. I'm not proud of this method.
|
||||||
|
+ */
|
||||||
|
+#define find_device_file(result, name, fmt, args...) \
|
||||||
|
+ ({ \
|
||||||
|
+ int rc_ = 0; \
|
||||||
|
+ debug("searching for %s from in %s", name, dev->disk_name); \
|
||||||
|
+ for (unsigned int try_ = 0; true; try_++) { \
|
||||||
|
+ char slashdev_[sizeof("device") \
|
||||||
|
+ + try_ * strlen("/device")]; \
|
||||||
|
+ \
|
||||||
|
+ char *nul_ = stpcpy(slashdev_, "device"); \
|
||||||
|
+ for (unsigned int i_ = 0; i_ < try_; i_++) \
|
||||||
|
+ nul_ = stpcpy(nul_, "/device"); \
|
||||||
|
+ \
|
||||||
|
+ debug("trying /sys/" fmt "/%s/%s", \
|
||||||
|
+ ## args, slashdev_, name); \
|
||||||
|
+ \
|
||||||
|
+ rc_ = sysfs_access(F_OK, fmt "/%s", ## args, slashdev_);\
|
||||||
|
+ if (rc_ < 0) { \
|
||||||
|
+ if (errno == ENOENT) { \
|
||||||
|
+ efi_error_pop(); \
|
||||||
|
+ break; \
|
||||||
|
+ } \
|
||||||
|
+ efi_error("cannot access /sys/"fmt"/%s: %m", \
|
||||||
|
+ ## args, slashdev_); \
|
||||||
|
+ goto find_device_link_err_; \
|
||||||
|
+ } \
|
||||||
|
+ \
|
||||||
|
+ rc_ = sysfs_access(F_OK, fmt "/%s/%s", \
|
||||||
|
+ ## args, slashdev_, name); \
|
||||||
|
+ if (rc_ < 0) { \
|
||||||
|
+ if (errno == ENOENT) { \
|
||||||
|
+ efi_error_pop(); \
|
||||||
|
+ break; \
|
||||||
|
+ } \
|
||||||
|
+ efi_error("cannot access /sys/"fmt"/%s/%s: %m", \
|
||||||
|
+ ## args, slashdev_, name); \
|
||||||
|
+ goto find_device_link_err_; \
|
||||||
|
+ } \
|
||||||
|
+ \
|
||||||
|
+ rc_ = asprintfa(result, fmt "/%s/%s", \
|
||||||
|
+ ## args, slashdev_, name); \
|
||||||
|
+ if (rc_ < 0) { \
|
||||||
|
+ efi_error("cannot allocate memory: %m"); \
|
||||||
|
+ goto find_device_link_err_; \
|
||||||
|
+ } \
|
||||||
|
+ } \
|
||||||
|
+find_device_link_err_: \
|
||||||
|
+ rc_; \
|
||||||
|
+ })
|
||||||
|
+
|
||||||
|
#define DEV_PROVIDES_ROOT 1
|
||||||
|
#define DEV_PROVIDES_HD 2
|
||||||
|
#define DEV_ABBREV_ONLY 4
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,334 @@
|
|||||||
|
From ad1d30fc5e20b933b6ad59d35c13e0193cd68a2d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Wed, 2 Oct 2019 17:04:12 -0400
|
||||||
|
Subject: [PATCH 57/63] Handle
|
||||||
|
/sys/devices/virtual/{nvme-fabrics,nvme-subsystem} devices
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/linux-nvme.c | 59 ++++++++++++++++++++++-----
|
||||||
|
src/linux-virtual-root.c | 88 ++++++++++++++++++++++++++++++++++++++++
|
||||||
|
src/linux.c | 43 +++++++++++++++++---
|
||||||
|
src/linux.h | 4 +-
|
||||||
|
4 files changed, 176 insertions(+), 18 deletions(-)
|
||||||
|
create mode 100644 src/linux-virtual-root.c
|
||||||
|
|
||||||
|
diff --git a/src/linux-nvme.c b/src/linux-nvme.c
|
||||||
|
index 455c4c7ba9b..7ca2fa3c283 100644
|
||||||
|
--- a/src/linux-nvme.c
|
||||||
|
+++ b/src/linux-nvme.c
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
/*
|
||||||
|
* libefiboot - library for the manipulation of EFI boot variables
|
||||||
|
- * Copyright 2012-2018 Red Hat, Inc.
|
||||||
|
+ * Copyright 2012-2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License as
|
||||||
|
@@ -15,7 +15,6 @@
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
- *
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "fix_coverity.h"
|
||||||
|
@@ -24,6 +23,7 @@
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
+#include <sys/param.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "efiboot.h"
|
||||||
|
@@ -34,6 +34,12 @@
|
||||||
|
* /sys/dev/block/$major:$minor looks like:
|
||||||
|
* 259:0 -> ../../devices/pci0000:00/0000:00:1d.0/0000:05:00.0/nvme/nvme0/nvme0n1
|
||||||
|
* 259:1 -> ../../devices/pci0000:00/0000:00:1d.0/0000:05:00.0/nvme/nvme0/nvme0n1/nvme0n1p1
|
||||||
|
+ * or:
|
||||||
|
+ * 259:0 ->../../devices/virtual/nvme-fabrics/ctl/nvme0/nvme0n1
|
||||||
|
+ * 259:1 ->../../devices/virtual/nvme-fabrics/ctl/nvme0/nvme0n1/nvme0n1p1
|
||||||
|
+ * or:
|
||||||
|
+ * 259:5 -> ../../devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
|
||||||
|
+ * 259:6 -> ../../devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1/nvme0n1p1
|
||||||
|
*
|
||||||
|
* /sys/dev/block/259:0/device looks like:
|
||||||
|
* device -> ../../nvme0
|
||||||
|
@@ -53,17 +59,44 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
int rc;
|
||||||
|
int32_t tosser0, tosser1, tosser2, ctrl_id, ns_id, partition;
|
||||||
|
uint8_t *filebuf = NULL;
|
||||||
|
+ int pos0 = -1, pos1 = -1, pos2 = -1;
|
||||||
|
ssize_t sz = 0;
|
||||||
|
- int pos0 = 0, pos1 = 0;
|
||||||
|
+ struct subdir {
|
||||||
|
+ const char * const name;
|
||||||
|
+ const char * const fmt;
|
||||||
|
+ int *pos0, *pos1;
|
||||||
|
+ } subdirs[] = {
|
||||||
|
+ {"nvme-subsysN/", "%nnvme-subsys%d/%n", &pos0, &pos2},
|
||||||
|
+ {"ctl/", "%nctl/%n%n", &pos0, &pos1},
|
||||||
|
+ {"nvme/", "%nnvme/%n%n", &pos0, &pos1},
|
||||||
|
+ {NULL, }
|
||||||
|
+ };
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
- debug("searching for nvme/nvme0/nvme0n1 or nvme/nvme0/nvme0n1/nvme0n1p1");
|
||||||
|
- rc = sscanf(current, "nvme/nvme%d/nvme%dn%d%n/nvme%dn%dp%d%n",
|
||||||
|
- &tosser0, &ctrl_id, &ns_id, &pos0,
|
||||||
|
- &tosser1, &tosser2, &partition, &pos1);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
- dbgmk(" ", pos0, pos1);
|
||||||
|
+ /*
|
||||||
|
+ * in this case, *any* of these is okay.
|
||||||
|
+ */
|
||||||
|
+ for (int i = 0; subdirs[i].name; i++) {
|
||||||
|
+ debug("searching for %s", subdirs[i].name);
|
||||||
|
+ pos0 = tosser0 = pos1 = -1;
|
||||||
|
+ rc = sscanf(current, subdirs[i].fmt, &pos0, &pos1, &pos2);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc,
|
||||||
|
+ *subdirs[i].pos0, *subdirs[i].pos1);
|
||||||
|
+ dbgmk(" ", *subdirs[i].pos0, *subdirs[i].pos1);
|
||||||
|
+ if (*subdirs[i].pos0 >= 0 && *subdirs[i].pos1 >= *subdirs[i].pos0) {
|
||||||
|
+ sz += *subdirs[i].pos1;
|
||||||
|
+ current += *subdirs[i].pos1;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ debug("searching for nvme0/nvme0n1 or nvme0/nvme0n1/nvme0n1p1");
|
||||||
|
+ rc = sscanf(current, "%nnvme%d/nvme%dn%d%n/nvme%dn%dp%d%n",
|
||||||
|
+ &pos0, &tosser0, &ctrl_id, &ns_id, &pos1,
|
||||||
|
+ &tosser1, &tosser2, &partition, &pos2);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d pos2:%d\n", current, rc, pos0, pos1, pos2);
|
||||||
|
+ dbgmk(" ", pos0, MAX(pos1,pos2));
|
||||||
|
/*
|
||||||
|
* If it isn't of that form, it's not one of our nvme devices.
|
||||||
|
*/
|
||||||
|
@@ -79,14 +112,15 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
if (dev->part == -1)
|
||||||
|
dev->part = partition;
|
||||||
|
|
||||||
|
- pos0 = pos1;
|
||||||
|
+ pos1 = pos2;
|
||||||
|
}
|
||||||
|
|
||||||
|
- sz += pos0;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* now fish the eui out of sysfs is there is one...
|
||||||
|
*/
|
||||||
|
+ debug("looking for the eui");
|
||||||
|
char *euipath = NULL;
|
||||||
|
rc = read_sysfs_file(&filebuf, "class/block/nvme%dn%d/eui", ctrl_id, ns_id);
|
||||||
|
if (rc < 0 && (errno == ENOENT || errno == ENOTDIR)) {
|
||||||
|
@@ -109,6 +143,9 @@ parse_nvme(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
+ debug("eui is %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
|
||||||
|
+ eui[0], eui[1], eui[2], eui[3],
|
||||||
|
+ eui[4], eui[5], eui[6], eui[7]);
|
||||||
|
dev->nvme_info.has_eui = 1;
|
||||||
|
memcpy(dev->nvme_info.eui, eui, sizeof(eui));
|
||||||
|
}
|
||||||
|
diff --git a/src/linux-virtual-root.c b/src/linux-virtual-root.c
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000000..b2d36b4095f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/linux-virtual-root.c
|
||||||
|
@@ -0,0 +1,88 @@
|
||||||
|
+/*
|
||||||
|
+ * libefiboot - library for the manipulation of EFI boot variables
|
||||||
|
+ * Copyright 2012-2019 Red Hat, Inc.
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public License as
|
||||||
|
+ * published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
+ * License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public
|
||||||
|
+ * License along with this library; if not, see
|
||||||
|
+ * <http://www.gnu.org/licenses/>.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "fix_coverity.h"
|
||||||
|
+
|
||||||
|
+#include <errno.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
+#include <inttypes.h>
|
||||||
|
+#include <stdint.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+
|
||||||
|
+#include "efiboot.h"
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Support virtually rooted devices (fibre+nvme, etc.)
|
||||||
|
+ *
|
||||||
|
+ * /sys/dev/block/$major:$minor looks like:
|
||||||
|
+ * 259:0 ->../../devices/virtual/nvme-fabrics/ctl/nvme0/nvme0n1
|
||||||
|
+ * 259:1 ->../../devices/virtual/nvme-fabrics/ctl/nvme0/nvme0n1/nvme0n1p1
|
||||||
|
+ * or:
|
||||||
|
+ * 259:5 -> ../../devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
|
||||||
|
+ * 259:6 -> ../../devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1/nvme0n1p1
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+static ssize_t
|
||||||
|
+parse_virtual_root(struct device *dev UNUSED, const char *current, const char *root UNUSED)
|
||||||
|
+{
|
||||||
|
+ int rc;
|
||||||
|
+ ssize_t sz;
|
||||||
|
+ int pos0 = 0, pos1 = 0;
|
||||||
|
+ struct subdir {
|
||||||
|
+ const char * const name;
|
||||||
|
+ const char * const fmt;
|
||||||
|
+ } subdirs[] = {
|
||||||
|
+ {"../../devices/virtual", "%n../../devices/virtual/%n"},
|
||||||
|
+ {"nvme-subsystem/", "%nnvme-subsystem/%n"},
|
||||||
|
+ {"nvme-fabrics/ctl/", "%nnvme-fabrics/ctl/%n"},
|
||||||
|
+ {NULL, NULL}
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ debug("entry");
|
||||||
|
+
|
||||||
|
+ for (int i = 0; subdirs[i].name; i++) {
|
||||||
|
+ debug("searching for %s", subdirs[i].name);
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
+ rc = sscanf(current, subdirs[i].fmt, &pos0, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
+ if (rc == 1) {
|
||||||
|
+ sz += pos1;
|
||||||
|
+ current += pos1;
|
||||||
|
+ if (i > 0)
|
||||||
|
+ goto found;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ sz = 0;
|
||||||
|
+found:
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, sz);
|
||||||
|
+ return sz;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static enum interface_type virtual_root_iftypes[] = { virtual_root, unknown };
|
||||||
|
+
|
||||||
|
+struct dev_probe HIDDEN virtual_root_parser = {
|
||||||
|
+ .name = "virtual_root",
|
||||||
|
+ .iftypes = virtual_root_iftypes,
|
||||||
|
+ .flags = DEV_ABBREV_ONLY|DEV_PROVIDES_ROOT,
|
||||||
|
+ .parse = parse_virtual_root,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+// vim:fenc=utf-8:tw=75:noet
|
||||||
|
diff --git a/src/linux.c b/src/linux.c
|
||||||
|
index 30db22d95dd..7dd8d4cd858 100644
|
||||||
|
--- a/src/linux.c
|
||||||
|
+++ b/src/linux.c
|
||||||
|
@@ -170,16 +170,17 @@ int HIDDEN
|
||||||
|
set_disk_and_part_name(struct device *dev)
|
||||||
|
{
|
||||||
|
int rc = -1;
|
||||||
|
-
|
||||||
|
- /*
|
||||||
|
- * results are like such:
|
||||||
|
- * maj:min -> ../../devices/pci$PCI_STUFF/$BLOCKDEV_STUFF/block/$DISK/$PART
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
char *ultimate = pathseg(dev->link, -1);
|
||||||
|
char *penultimate = pathseg(dev->link, -2);
|
||||||
|
char *approximate = pathseg(dev->link, -3);
|
||||||
|
char *proximate = pathseg(dev->link, -4);
|
||||||
|
+ char *psl5 = pathseg(dev->link, -5);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * devlinks look something like:
|
||||||
|
+ * maj:min -> ../../devices/pci$PCI_STUFF/$BLOCKDEV_STUFF/block/$DISK/$PART
|
||||||
|
+ */
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
debug("dev->disk_name:%p dev->part_name:%p", dev->disk_name, dev->part_name);
|
||||||
|
@@ -188,6 +189,7 @@ set_disk_and_part_name(struct device *dev)
|
||||||
|
debug("penultimate:'%s'", penultimate ? : "");
|
||||||
|
debug("approximate:'%s'", approximate ? : "");
|
||||||
|
debug("proximate:'%s'", proximate ? : "");
|
||||||
|
+ debug("psl5:'%s'", psl5 ? : "");
|
||||||
|
|
||||||
|
if (ultimate && penultimate &&
|
||||||
|
((proximate && !strcmp(proximate, "nvme")) ||
|
||||||
|
@@ -232,6 +234,34 @@ set_disk_and_part_name(struct device *dev)
|
||||||
|
set_disk_name(dev, "%s", ultimate);
|
||||||
|
debug("disk:%s", ultimate);
|
||||||
|
rc = 0;
|
||||||
|
+ } else if ((proximate && ultimate && !strcmp(proximate, "nvme-fabrics")) ||
|
||||||
|
+ (approximate && ultimate && !strcmp(approximate, "nvme-subsystem"))) {
|
||||||
|
+ /*
|
||||||
|
+ * 259:0 ->../../devices/virtual/nvme-fabrics/ctl/nvme0/nvme0n1
|
||||||
|
+ * ^ proximate ^ ultimate
|
||||||
|
+ * or
|
||||||
|
+ * 259:5 -> ../../devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1
|
||||||
|
+ * ^ approximate ^ penultimate
|
||||||
|
+ * ultimate ^
|
||||||
|
+ */
|
||||||
|
+ set_disk_name(dev, "%s", ultimate);
|
||||||
|
+ debug("disk:%s", ultimate);
|
||||||
|
+ rc = 0;
|
||||||
|
+ } else if ((psl5 && penultimate && ultimate && !strcmp(psl5, "nvme-fabrics")) ||
|
||||||
|
+ (proximate && penultimate && ultimate && !strcmp(proximate, "nvme-subsystem"))) {
|
||||||
|
+ /*
|
||||||
|
+ * 259:1 -> ../../devices/virtual/nvme-fabrics/ctl/nvme0/nvme0n1/nvme0n1p1
|
||||||
|
+ * ^psl5 ^ penultimate
|
||||||
|
+ * ultimate ^
|
||||||
|
+ * or
|
||||||
|
+ * 259:6 -> ../../devices/virtual/nvme-subsystem/nvme-subsys0/nvme0n1/nvme0n1p1
|
||||||
|
+ * ^ proximate ^ penultimate
|
||||||
|
+ * ultimate ^
|
||||||
|
+ */
|
||||||
|
+ set_disk_name(dev, "%s", penultimate);
|
||||||
|
+ set_part_name(dev, "%s", ultimate);
|
||||||
|
+ debug("disk:%s part:%s", penultimate, ultimate);
|
||||||
|
+ rc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc < 0)
|
||||||
|
@@ -248,6 +278,7 @@ static struct dev_probe *dev_probes[] = {
|
||||||
|
&acpi_root_parser,
|
||||||
|
&pci_root_parser,
|
||||||
|
&soc_root_parser,
|
||||||
|
+ &virtual_root_parser,
|
||||||
|
&pci_parser,
|
||||||
|
&virtblk_parser,
|
||||||
|
&sas_parser,
|
||||||
|
diff --git a/src/linux.h b/src/linux.h
|
||||||
|
index ae9835ef7ce..6bfc5869254 100644
|
||||||
|
--- a/src/linux.h
|
||||||
|
+++ b/src/linux.h
|
||||||
|
@@ -99,7 +99,8 @@ struct emmc_info {
|
||||||
|
|
||||||
|
enum interface_type {
|
||||||
|
unknown,
|
||||||
|
- isa, acpi_root, pci_root, soc_root, pci, network,
|
||||||
|
+ isa, acpi_root, pci_root, soc_root, virtual_root,
|
||||||
|
+ pci, network,
|
||||||
|
ata, atapi, scsi, sata, sas,
|
||||||
|
usb, i1394, fibre, i2o,
|
||||||
|
md, virtblk,
|
||||||
|
@@ -346,6 +347,7 @@ extern struct dev_probe pmem_parser;
|
||||||
|
extern struct dev_probe pci_root_parser;
|
||||||
|
extern struct dev_probe acpi_root_parser;
|
||||||
|
extern struct dev_probe soc_root_parser;
|
||||||
|
+extern struct dev_probe virtual_root_parser;
|
||||||
|
extern struct dev_probe pci_parser;
|
||||||
|
extern struct dev_probe sas_parser;
|
||||||
|
extern struct dev_probe sata_parser;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,778 @@
|
|||||||
|
From fa9336914ef43d1a1dbc3384c8051362eea12cd7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 15 Oct 2019 16:53:27 -0400
|
||||||
|
Subject: [PATCH 58/63] sysfs parsers: make all the /sys/block link parsers
|
||||||
|
work the same way
|
||||||
|
|
||||||
|
Apparently I wrote some of these one way and some the other, and the one
|
||||||
|
special case where everything was "current+sz" instead of some form of
|
||||||
|
"current += pos; sz += pos; ...; return sz;".
|
||||||
|
|
||||||
|
Make them all the same, where possible.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/linux-acpi-root.c | 65 +++++-----
|
||||||
|
src/linux-pci-root.c | 9 +-
|
||||||
|
src/linux-pci.c | 21 ++--
|
||||||
|
src/linux-sata.c | 56 +++++----
|
||||||
|
src/linux-scsi.c | 248 ++++++++++++++++++++-------------------
|
||||||
|
src/linux-soc-root.c | 19 +--
|
||||||
|
src/linux-virtblk.c | 15 ++-
|
||||||
|
src/linux-virtual-root.c | 2 +-
|
||||||
|
8 files changed, 227 insertions(+), 208 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/linux-acpi-root.c b/src/linux-acpi-root.c
|
||||||
|
index 57a648981b3..6bfc1ad9a2b 100644
|
||||||
|
--- a/src/linux-acpi-root.c
|
||||||
|
+++ b/src/linux-acpi-root.c
|
||||||
|
@@ -44,14 +44,13 @@ static ssize_t
|
||||||
|
parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos = -1;
|
||||||
|
+ int pos0 = -1, pos1 = -1, pos2 = -1;
|
||||||
|
+ ssize_t sz = 0;
|
||||||
|
uint16_t pad0;
|
||||||
|
uint8_t pad1;
|
||||||
|
char *acpi_header = NULL;
|
||||||
|
char *colon;
|
||||||
|
|
||||||
|
- const char *devpart = current;
|
||||||
|
-
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -61,23 +60,26 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
* This is annoying because "/%04ms%h:%hhx/" won't bind from the right
|
||||||
|
* side in sscanf.
|
||||||
|
*/
|
||||||
|
- rc = sscanf(devpart, "../../devices/platform/%n", &pos);
|
||||||
|
- debug("current:'%s' rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
- if (rc != 0 || pos < 1)
|
||||||
|
+ rc = sscanf(current, "../../devices/%nplatform/%n", &pos0, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
+ if (rc != 0 || pos0 == -1 || pos1 == -1)
|
||||||
|
return 0;
|
||||||
|
- devpart += pos;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
+ debug("searching for an ACPI string like A0000:00 or ACPI0000:00");
|
||||||
|
+ pos0 = 0;
|
||||||
|
/*
|
||||||
|
* If it's too short to be A0000:00, it's not an ACPI string
|
||||||
|
*/
|
||||||
|
- if (strlen(devpart) < 8)
|
||||||
|
+ if (strlen(current) < 8)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- colon = strchr(devpart, ':');
|
||||||
|
+ colon = strchr(current, ':');
|
||||||
|
if (!colon)
|
||||||
|
return 0;
|
||||||
|
- pos = colon - devpart;
|
||||||
|
+ pos1 = colon - current;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If colon doesn't point at something between one of these:
|
||||||
|
@@ -85,40 +87,44 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
* ^ 5 ^ 8
|
||||||
|
* Then it's not an ACPI string.
|
||||||
|
*/
|
||||||
|
- if (pos < 5 || pos > 8)
|
||||||
|
+ if (pos1 < 5 || pos1 > 8)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- dev->acpi_root.acpi_hid_str = strndup(devpart, pos + 1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
+
|
||||||
|
+ dev->acpi_root.acpi_hid_str = strndup(current, pos1 + 1);
|
||||||
|
if (!dev->acpi_root.acpi_hid_str) {
|
||||||
|
efi_error("Could not allocate memory");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- dev->acpi_root.acpi_hid_str[pos] = 0;
|
||||||
|
+ dev->acpi_root.acpi_hid_str[pos1] = 0;
|
||||||
|
debug("acpi_hid_str:'%s'", dev->acpi_root.acpi_hid_str);
|
||||||
|
|
||||||
|
- pos -= 4;
|
||||||
|
- debug("current:'%s' rc:%d pos:%d", devpart, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
- acpi_header = strndupa(devpart, pos);
|
||||||
|
+ pos2 = pos1 - 4;
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d", current, rc, pos0, pos2);
|
||||||
|
+ dbgmk(" ", pos0, pos2);
|
||||||
|
+ acpi_header = strndupa(current, pos2);
|
||||||
|
if (!acpi_header)
|
||||||
|
return 0;
|
||||||
|
- acpi_header[pos] = 0;
|
||||||
|
- debug("current:'%s' acpi_header:'%s'", devpart, acpi_header);
|
||||||
|
- devpart += pos;
|
||||||
|
+ acpi_header[pos2] = 0;
|
||||||
|
+ debug("current:'%s' acpi_header:'%s'", current, acpi_header);
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we can't find these numbers, it's not an ACPI string
|
||||||
|
*/
|
||||||
|
- rc = sscanf(devpart, "%hx:%hhx/%n", &pad0, &pad1, &pos);
|
||||||
|
+ rc = sscanf(current, "%n%hx:%hhx/%n", &pos0, &pad0, &pad1, &pos1);
|
||||||
|
if (rc != 2) {
|
||||||
|
- efi_error("Could not parse ACPI path \"%s\"", devpart);
|
||||||
|
+ efi_error("Could not parse ACPI path \"%s\"", current);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
- debug("current:'%s' parsed:%04hx:%02hhx pos:%d rc:%d",
|
||||||
|
- devpart, pad0, pad1, pos, rc);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
-
|
||||||
|
- devpart += pos;
|
||||||
|
+ debug("current:'%s' parsed:%04hx:%02hhx rc:%d pos0:%d pos1:%d",
|
||||||
|
+ current, pad0, pad1, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
rc = parse_acpi_hid_uid(dev, "devices/platform/%s%04hX:%02hhX",
|
||||||
|
acpi_header, pad0, pad1);
|
||||||
|
@@ -139,8 +145,7 @@ parse_acpi_root(struct device *dev, const char *current, const char *root UNUSED
|
||||||
|
dev->acpi_root.acpi_uid_str,
|
||||||
|
dev->acpi_root.acpi_cid_str);
|
||||||
|
|
||||||
|
- size_t sz = devpart - current;
|
||||||
|
- debug("current:'%s' sz:%zd", devpart, sz);
|
||||||
|
+ debug("current:'%s' sz:%zd", current, sz);
|
||||||
|
return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/linux-pci-root.c b/src/linux-pci-root.c
|
||||||
|
index c7e279118f5..8f7cfe293bf 100644
|
||||||
|
--- a/src/linux-pci-root.c
|
||||||
|
+++ b/src/linux-pci-root.c
|
||||||
|
@@ -47,7 +47,6 @@ parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
int pos0 = -1, pos1 = -1;
|
||||||
|
uint16_t root_domain;
|
||||||
|
uint8_t root_bus;
|
||||||
|
- const char *devpart = current;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
@@ -56,8 +55,8 @@ parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
* pci0000:00/
|
||||||
|
* ^d ^p
|
||||||
|
*/
|
||||||
|
- rc = sscanf(devpart, "%n../../devices/pci%hx:%hhx/%n", &pos0, &root_domain, &root_bus, &pos1);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d pos1:%d", devpart, rc, pos0, pos1);
|
||||||
|
+ rc = sscanf(current, "%n../../devices/pci%hx:%hhx/%n", &pos0, &root_domain, &root_bus, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d", current, rc, pos0, pos1);
|
||||||
|
dbgmk(" ", pos0, pos1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -65,7 +64,7 @@ parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
*/
|
||||||
|
if (rc != 2)
|
||||||
|
return 0;
|
||||||
|
- devpart += pos1;
|
||||||
|
+ current += pos1;
|
||||||
|
|
||||||
|
dev->pci_root.pci_domain = root_domain;
|
||||||
|
dev->pci_root.pci_bus = root_bus;
|
||||||
|
@@ -76,7 +75,7 @@ parse_pci_root(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
- debug("current:'%s' sz:%d\n", devpart, pos1);
|
||||||
|
+ debug("current:'%s' sz:%d\n", current, pos1);
|
||||||
|
return pos1;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/linux-pci.c b/src/linux-pci.c
|
||||||
|
index a3a0dc28afd..ca6f693cd8a 100644
|
||||||
|
--- a/src/linux-pci.c
|
||||||
|
+++ b/src/linux-pci.c
|
||||||
|
@@ -46,8 +46,7 @@ static ssize_t
|
||||||
|
parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos0 = -1, pos1 = -1;
|
||||||
|
- const char *devpart = current;
|
||||||
|
+ ssize_t sz = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
@@ -55,22 +54,24 @@ parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
* 0000:00:01.0/0000:01:00.0/
|
||||||
|
* ^d ^b ^d ^f (of the last one in the series)
|
||||||
|
*/
|
||||||
|
- while (*devpart) {
|
||||||
|
+ while (*current) {
|
||||||
|
uint16_t domain;
|
||||||
|
uint8_t bus, device, function;
|
||||||
|
struct pci_dev_info *pci_dev;
|
||||||
|
unsigned int i = dev->n_pci_devs;
|
||||||
|
struct stat statbuf;
|
||||||
|
+ int pos0 = -1, pos1 = -1;
|
||||||
|
|
||||||
|
pos0 = pos1 = -1;
|
||||||
|
debug("searching for 0000:00:00.0/");
|
||||||
|
- rc = sscanf(devpart, "%n%hx:%hhx:%hhx.%hhx/%n",
|
||||||
|
+ rc = sscanf(current, "%n%hx:%hhx:%hhx.%hhx/%n",
|
||||||
|
&pos0, &domain, &bus, &device, &function, &pos1);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d pos1:%d", devpart, rc, pos0, pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d", current, rc, pos0, pos1);
|
||||||
|
dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc != 4)
|
||||||
|
break;
|
||||||
|
- devpart += pos1;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
debug("found pci domain %04hx:%02hhx:%02hhx.%02hhx",
|
||||||
|
domain, bus, device, function);
|
||||||
|
@@ -87,13 +88,13 @@ parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
dev->pci_dev[i].pci_bus = bus;
|
||||||
|
dev->pci_dev[i].pci_device = device;
|
||||||
|
dev->pci_dev[i].pci_function = function;
|
||||||
|
- char *tmp = strndup(root, devpart-root+1);
|
||||||
|
+ char *tmp = strndup(root, current-root+1);
|
||||||
|
char *linkbuf = NULL;
|
||||||
|
if (!tmp) {
|
||||||
|
efi_error("could not allocate memory");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- tmp[devpart - root] = '\0';
|
||||||
|
+ tmp[current - root] = '\0';
|
||||||
|
rc = sysfs_stat(&statbuf, "class/block/%s/driver", tmp);
|
||||||
|
if (rc < 0 && errno == ENOENT) {
|
||||||
|
debug("No driver link for /sys/class/block/%s", tmp);
|
||||||
|
@@ -114,8 +115,8 @@ parse_pci(struct device *dev, const char *current, const char *root)
|
||||||
|
dev->n_pci_devs += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- debug("current:'%s' sz:%zd\n", devpart, devpart - current);
|
||||||
|
- return devpart - current;
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, sz);
|
||||||
|
+ return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
diff --git a/src/linux-sata.c b/src/linux-sata.c
|
||||||
|
index 4f4e983568e..b49cf99dcb7 100644
|
||||||
|
--- a/src/linux-sata.c
|
||||||
|
+++ b/src/linux-sata.c
|
||||||
|
@@ -138,15 +138,15 @@ sysfs_sata_get_port_info(uint32_t print_id, struct device *dev)
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
-parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
+parse_sata(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
- const char *current = devlink;
|
||||||
|
uint32_t print_id;
|
||||||
|
uint32_t scsi_bus, tosser0;
|
||||||
|
uint32_t scsi_device, tosser1;
|
||||||
|
uint32_t scsi_target, tosser2;
|
||||||
|
uint64_t scsi_lun, tosser3;
|
||||||
|
- int pos = 0;
|
||||||
|
+ int pos0 = -1, pos1 = -1;
|
||||||
|
+ size_t sz = 0;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
@@ -160,9 +160,9 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
* ^dev ^host x y z
|
||||||
|
*/
|
||||||
|
debug("searching for ata1/");
|
||||||
|
- rc = sscanf(current, "ata%"PRIu32"/%n", &print_id, &pos);
|
||||||
|
- debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
+ rc = sscanf(current, "%nata%"PRIu32"/%n", &pos0, &print_id, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
/*
|
||||||
|
* If we don't find this one, it isn't an ata device, so return 0 not
|
||||||
|
* error. Later errors mean it is an ata device, but we can't parse
|
||||||
|
@@ -170,36 +170,40 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
*/
|
||||||
|
if (rc != 1)
|
||||||
|
return 0;
|
||||||
|
- current += pos;
|
||||||
|
- pos = 0;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
|
||||||
|
debug("searching for host0/");
|
||||||
|
- rc = sscanf(current, "host%"PRIu32"/%n", &scsi_bus, &pos);
|
||||||
|
- debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
+ rc = sscanf(current, "%nhost%"PRIu32"/%n", &pos0, &scsi_bus, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc != 1)
|
||||||
|
return -1;
|
||||||
|
- current += pos;
|
||||||
|
- pos = 0;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
|
||||||
|
debug("searching for target0:0:0:0/");
|
||||||
|
- rc = sscanf(current, "target%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
- &scsi_device, &scsi_target, &scsi_lun, &pos);
|
||||||
|
- debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
+ rc = sscanf(current, "%ntarget%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
+ &pos0, &scsi_device, &scsi_target, &scsi_lun, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc != 3)
|
||||||
|
return -1;
|
||||||
|
- current += pos;
|
||||||
|
- pos = 0;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
|
||||||
|
debug("searching for 0:0:0:0/");
|
||||||
|
- rc = sscanf(current, "%"PRIu32":%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
- &tosser0, &tosser1, &tosser2, &tosser3, &pos);
|
||||||
|
- debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
+ rc = sscanf(current, "%n%"PRIu32":%"PRIu32":%"PRIu32":%"PRIu64"/%n",
|
||||||
|
+ &pos0, &tosser0, &tosser1, &tosser2, &tosser3, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc != 4)
|
||||||
|
return -1;
|
||||||
|
- current += pos;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
rc = sysfs_sata_get_port_info(print_id, dev);
|
||||||
|
if (rc < 0)
|
||||||
|
@@ -213,8 +217,8 @@ parse_sata(struct device *dev, const char *devlink, const char *root UNUSED)
|
||||||
|
if (dev->interface_type == unknown)
|
||||||
|
dev->interface_type = sata;
|
||||||
|
|
||||||
|
- debug("current:'%s' sz:%zd\n", current, current - devlink);
|
||||||
|
- return current - devlink;
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, sz);
|
||||||
|
+ return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t
|
||||||
|
diff --git a/src/linux-scsi.c b/src/linux-scsi.c
|
||||||
|
index 6b92908d6bc..73db53b3ed6 100644
|
||||||
|
--- a/src/linux-scsi.c
|
||||||
|
+++ b/src/linux-scsi.c
|
||||||
|
@@ -24,6 +24,7 @@
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
+#include <sys/param.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "efiboot.h"
|
||||||
|
@@ -44,7 +45,7 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
ssize_t sz = 0;
|
||||||
|
- int pos0 = 0, pos1 = 0;
|
||||||
|
+ int pos0 = -1, pos1 = -1, pos2 = -1;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
/*
|
||||||
|
@@ -99,14 +100,14 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
* or host4/port-4:0:0
|
||||||
|
*/
|
||||||
|
debug("searching for host4/");
|
||||||
|
- rc = sscanf(current, "host%d/%n", scsi_host, &pos0);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
- dbgmk(" ", pos0);
|
||||||
|
+ rc = sscanf(current, "%nhost%d/%n", scsi_host, &pos0, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc != 1)
|
||||||
|
return -1;
|
||||||
|
- current += pos0;
|
||||||
|
- sz += pos0;
|
||||||
|
- pos0 = 0;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We might have this next:
|
||||||
|
@@ -117,96 +118,100 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
* port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
|
||||||
|
*/
|
||||||
|
debug("searching for port-4:0 or port-4:0:0");
|
||||||
|
- rc = sscanf(current, "port-%d:%d%n:%d%n", &tosser0,
|
||||||
|
- &tosser1, &pos0, &tosser2, &pos1);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
- dbgmk(" ", pos0, pos1);
|
||||||
|
- if (rc == 2 || rc == 3) {
|
||||||
|
- current += pos0;
|
||||||
|
- sz += pos0;
|
||||||
|
- pos0 = 0;
|
||||||
|
- if (local_port_id && rc == 2)
|
||||||
|
- *local_port_id = tosser1;
|
||||||
|
- if (remote_port_id && rc == 3)
|
||||||
|
- *remote_port_id = tosser2;
|
||||||
|
-
|
||||||
|
- if (current[0] == '/') {
|
||||||
|
- current += 1;
|
||||||
|
- sz += 1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /*
|
||||||
|
- * We might have this next:
|
||||||
|
- * expander-2:0/port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
|
||||||
|
- * ^ port id
|
||||||
|
- * ^ scsi target id
|
||||||
|
- * ^ host number
|
||||||
|
- * ^ host number
|
||||||
|
- * We don't actually care about either number in expander-.../,
|
||||||
|
- * because they're replicated in all the other places. We just need
|
||||||
|
- * to get past it.
|
||||||
|
- */
|
||||||
|
- debug("searching for expander-4:0/");
|
||||||
|
- rc = sscanf(current, "expander-%d:%d/%n", &tosser0, &tosser1, &pos0);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
- dbgmk(" ", pos0);
|
||||||
|
- if (rc == 2) {
|
||||||
|
- if (!remote_target_id) {
|
||||||
|
- efi_error("Device is PHY is a remote target, but remote_target_id is NULL");
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
- *remote_target_id = tosser1;
|
||||||
|
- current += pos0;
|
||||||
|
- sz += pos0;
|
||||||
|
- pos0 = 0;
|
||||||
|
-
|
||||||
|
- /*
|
||||||
|
- * if we have that, we should have a 3-part port next
|
||||||
|
- */
|
||||||
|
- debug("searching for port-2:0:2/");
|
||||||
|
- rc = sscanf(current, "port-%d:%d:%d/%n", &tosser0, &tosser1, &tosser2, &pos0);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
- dbgmk(" ", pos0);
|
||||||
|
- if (rc != 3) {
|
||||||
|
- efi_error("Couldn't parse port expander port string");
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
- current += pos0;
|
||||||
|
- sz += pos0;
|
||||||
|
- }
|
||||||
|
- pos0 = 0;
|
||||||
|
-
|
||||||
|
- /* next:
|
||||||
|
- * /end_device-4:0
|
||||||
|
- * or /end_device-4:0:0
|
||||||
|
- * awesomely these are the exact same fields that go into port-blah,
|
||||||
|
- * but we don't care for now about any of them anyway.
|
||||||
|
- */
|
||||||
|
- debug("searching for end_device-4:0/ or end_device-4:0:0/");
|
||||||
|
- rc = sscanf(current, "end_device-%d:%d%n", &tosser0, &tosser1, &pos0);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
- if (rc != 2)
|
||||||
|
- return -1;
|
||||||
|
+ rc = sscanf(current, "%nport-%d:%d%n:%d%n",
|
||||||
|
+ &pos0, &tosser0, &tosser1, &pos1, &tosser2, &pos2);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d pos2:%d\n", current, rc, pos0, pos1, pos2);
|
||||||
|
+ dbgmk(" ", pos0, MAX(pos1, pos2));
|
||||||
|
+ if (rc == 3) {
|
||||||
|
+ if (remote_port_id)
|
||||||
|
+ *remote_port_id = tosser2;
|
||||||
|
+ pos1 = pos2;
|
||||||
|
+ } else if (rc == 2) {
|
||||||
|
+ if (local_port_id)
|
||||||
|
+ *local_port_id = tosser1;
|
||||||
|
+ } else if (rc != 0) {
|
||||||
|
+ return -1;
|
||||||
|
+ } else {
|
||||||
|
+ pos1 = 0;
|
||||||
|
+ }
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
- pos1 = 0;
|
||||||
|
- rc = sscanf(current + pos0, ":%d%n", &tosser2, &pos1);
|
||||||
|
- if (rc != 0 && rc != 1)
|
||||||
|
- return -1;
|
||||||
|
- dbgmk(" ", pos0, pos0+pos1);
|
||||||
|
- if (remote_port_id && rc == 1)
|
||||||
|
- *remote_port_id = tosser2;
|
||||||
|
- if (local_port_id && rc == 0)
|
||||||
|
- *local_port_id = tosser1;
|
||||||
|
- current += pos0 + pos1;
|
||||||
|
- sz += pos0 + pos1;
|
||||||
|
- pos0 = pos1 = 0;
|
||||||
|
+ if (current[0] == '/') {
|
||||||
|
+ current += 1;
|
||||||
|
+ sz += 1;
|
||||||
|
+ }
|
||||||
|
+ pos0 = pos1 = pos2 = -1;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * We might have this next:
|
||||||
|
+ * expander-2:0/port-2:0:2/end_device-2:0:2/target2:0:0/2:0:0:0/block/sda/sda1
|
||||||
|
+ * ^ port id
|
||||||
|
+ * ^ scsi target id
|
||||||
|
+ * ^ host number
|
||||||
|
+ * ^ host number
|
||||||
|
+ * We don't actually care about either number in expander-.../,
|
||||||
|
+ * because they're replicated in all the other places. We just need
|
||||||
|
+ * to get past it.
|
||||||
|
+ */
|
||||||
|
+ debug("searching for expander-4:0/");
|
||||||
|
+ rc = sscanf(current, "%nexpander-%d:%d/%n", &pos0, &tosser0, &tosser1, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
+ if (rc == 2) {
|
||||||
|
+ if (!remote_target_id) {
|
||||||
|
+ efi_error("Device is PHY is a remote target, but remote_target_id is NULL");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ *remote_target_id = tosser1;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * if we have that, we should have a 3-part port next
|
||||||
|
+ */
|
||||||
|
+ debug("searching for port-2:0:2/");
|
||||||
|
+ rc = sscanf(current, "%nport-%d:%d:%d/%n", &pos0, &tosser0, &tosser1, &tosser2, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
+ if (rc != 3) {
|
||||||
|
+ efi_error("Couldn't parse port expander port string");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
+ }
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
+
|
||||||
|
+ /* next:
|
||||||
|
+ * /end_device-4:0
|
||||||
|
+ * or /end_device-4:0:0
|
||||||
|
+ * awesomely these are the exact same fields that go into port-blah,
|
||||||
|
+ * but we don't care for now about any of them anyway.
|
||||||
|
+ */
|
||||||
|
+ debug("searching for end_device-4:0/ or end_device-4:0:0/");
|
||||||
|
+ rc = sscanf(current, "%nend_device-%d:%d%n:%d%n",
|
||||||
|
+ &pos0, &tosser0, &tosser1, &pos1, &tosser2, &pos2);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
+ dbgmk(" ", pos0, MAX(pos1, pos2));
|
||||||
|
+ if (rc == 3) {
|
||||||
|
+ if (remote_port_id)
|
||||||
|
+ *remote_port_id = tosser2;
|
||||||
|
+ pos1 = pos2;
|
||||||
|
+ } else if (rc == 2) {
|
||||||
|
+ if (local_port_id)
|
||||||
|
+ *local_port_id = tosser1;
|
||||||
|
+ } else {
|
||||||
|
+ pos1 = 0;
|
||||||
|
+ }
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
+ pos0 = pos1 = pos2 = -1;
|
||||||
|
|
||||||
|
- if (current[0] == '/') {
|
||||||
|
- current += sz;
|
||||||
|
- sz += 1;
|
||||||
|
- }
|
||||||
|
- } else if (rc != 0) {
|
||||||
|
- return -1;
|
||||||
|
+ if (current[0] == '/') {
|
||||||
|
+ current += sz;
|
||||||
|
+ sz += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now:
|
||||||
|
@@ -214,28 +219,28 @@ parse_scsi_link(const char *current, uint32_t *scsi_host,
|
||||||
|
*/
|
||||||
|
uint64_t tosser3;
|
||||||
|
debug("searching for target4:0:0/");
|
||||||
|
- rc = sscanf(current, "target%d:%d:%"PRIu64"/%n", &tosser0, &tosser1,
|
||||||
|
- &tosser3, &pos0);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
- dbgmk(" ", pos0);
|
||||||
|
+ rc = sscanf(current, "%ntarget%d:%d:%"PRIu64"/%n",
|
||||||
|
+ &pos0, &tosser0, &tosser1, &tosser3, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc != 3)
|
||||||
|
return -1;
|
||||||
|
- current += pos0;
|
||||||
|
- sz += pos0;
|
||||||
|
- pos0 = 0;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
|
||||||
|
/* now:
|
||||||
|
* %d:%d:%d:%llu/
|
||||||
|
*/
|
||||||
|
debug("searching for 4:0:0:0/");
|
||||||
|
- rc = sscanf(current, "%d:%d:%d:%"PRIu64"/%n",
|
||||||
|
- scsi_bus, scsi_device, scsi_target, scsi_lun, &pos0);
|
||||||
|
- debug("current:'%s' rc:%d pos0:%d\n", current, rc, pos0);
|
||||||
|
- dbgmk(" ", pos0);
|
||||||
|
+ rc = sscanf(current, "%n%d:%d:%d:%"PRIu64"/%n",
|
||||||
|
+ &pos0, scsi_bus, scsi_device, scsi_target, scsi_lun, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc != 4)
|
||||||
|
return -1;
|
||||||
|
- current += pos0;
|
||||||
|
- sz += pos0;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
debug("current:'%s' sz:%zd\n", current, sz);
|
||||||
|
return sz;
|
||||||
|
@@ -246,31 +251,32 @@ parse_scsi(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
uint32_t scsi_host, scsi_bus, scsi_device, scsi_target;
|
||||||
|
uint64_t scsi_lun;
|
||||||
|
- ssize_t sz;
|
||||||
|
- int pos;
|
||||||
|
+ ssize_t sz = 0;
|
||||||
|
+ int pos0, pos1;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
- debug("searching for ../../../0:0:0:0");
|
||||||
|
- rc = sscanf(dev->device, "../../../%d:%d:%d:%"PRIu64"%n",
|
||||||
|
+ debug("searching device for ../../../0:0:0:0");
|
||||||
|
+ pos0 = pos1 = -1;
|
||||||
|
+ rc = sscanf(dev->device, "../../../%n%d:%d:%d:%"PRIu64"%n",
|
||||||
|
+ &pos0,
|
||||||
|
&dev->scsi_info.scsi_bus,
|
||||||
|
&dev->scsi_info.scsi_device,
|
||||||
|
&dev->scsi_info.scsi_target,
|
||||||
|
&dev->scsi_info.scsi_lun,
|
||||||
|
- &pos);
|
||||||
|
- debug("current:'%s' rc:%d pos:%d\n", dev->device, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
+ &pos1);
|
||||||
|
+ debug("device:'%s' rc:%d pos0:%d pos1:%d\n", dev->device, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc != 4)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
- sz = parse_scsi_link(current, &scsi_host,
|
||||||
|
- &scsi_bus, &scsi_device,
|
||||||
|
- &scsi_target, &scsi_lun,
|
||||||
|
- NULL, NULL, NULL);
|
||||||
|
- if (sz < 0)
|
||||||
|
+ pos0 = parse_scsi_link(current, &scsi_host, &scsi_bus, &scsi_device,
|
||||||
|
+ &scsi_target, &scsi_lun, NULL, NULL, NULL);
|
||||||
|
+ if (pos0 < 0)
|
||||||
|
return 0;
|
||||||
|
- current += sz;
|
||||||
|
+ current += pos0;
|
||||||
|
+ sz += pos0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SCSI disks can have up to 16 partitions, or 4 bits worth
|
||||||
|
diff --git a/src/linux-soc-root.c b/src/linux-soc-root.c
|
||||||
|
index 9c9e9573dcd..bad37c9f874 100644
|
||||||
|
--- a/src/linux-soc-root.c
|
||||||
|
+++ b/src/linux-soc-root.c
|
||||||
|
@@ -41,20 +41,21 @@ static ssize_t
|
||||||
|
parse_soc_root(struct device *dev UNUSED, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- int pos = 0;
|
||||||
|
- const char *devpart = current;
|
||||||
|
+ int pos0 = -1, pos1 = -1;
|
||||||
|
+ ssize_t sz = 0;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
- rc = sscanf(devpart, "../../devices/platform/soc/%*[^/]/%n", &pos);
|
||||||
|
- if (rc != 0)
|
||||||
|
+ rc = sscanf(current, "../../devices/%nplatform/soc/%*[^/]/%n", &pos0, &pos1);
|
||||||
|
+ if (rc != 0 || pos0 == -1 || pos1 == -1)
|
||||||
|
return 0;
|
||||||
|
- debug("current:'%s' rc:%d pos:%d", current, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
- devpart += pos;
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
- debug("current:'%s' sz:%d\n", devpart, pos);
|
||||||
|
- return pos;
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, sz);
|
||||||
|
+ return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum interface_type soc_root_iftypes[] = { soc_root, unknown };
|
||||||
|
diff --git a/src/linux-virtblk.c b/src/linux-virtblk.c
|
||||||
|
index df14673dac8..a3366c9c677 100644
|
||||||
|
--- a/src/linux-virtblk.c
|
||||||
|
+++ b/src/linux-virtblk.c
|
||||||
|
@@ -48,15 +48,16 @@ static ssize_t
|
||||||
|
parse_virtblk(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
uint32_t tosser;
|
||||||
|
- int pos = -1;
|
||||||
|
+ int pos0 = -1, pos1 = -1;
|
||||||
|
+ ssize_t sz = 0;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
debug("entry");
|
||||||
|
|
||||||
|
debug("searching for virtio0/");
|
||||||
|
- rc = sscanf(current, "virtio%x/%n", &tosser, &pos);
|
||||||
|
- debug("current:'%s' rc:%d pos:%d\n", current, rc, pos);
|
||||||
|
- dbgmk(" ", pos);
|
||||||
|
+ rc = sscanf(current, "%nvirtio%x/%n", &pos0, &tosser, &pos1);
|
||||||
|
+ debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
/*
|
||||||
|
* If we couldn't find virtioX/ then it isn't a virtio device.
|
||||||
|
*/
|
||||||
|
@@ -64,9 +65,11 @@ parse_virtblk(struct device *dev, const char *current, const char *root UNUSED)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
dev->interface_type = virtblk;
|
||||||
|
+ current += pos1;
|
||||||
|
+ sz += pos1;
|
||||||
|
|
||||||
|
- debug("current:'%s' sz:%d\n", current, pos);
|
||||||
|
- return pos;
|
||||||
|
+ debug("current:'%s' sz:%zd\n", current, sz);
|
||||||
|
+ return sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum interface_type virtblk_iftypes[] = { virtblk, unknown };
|
||||||
|
diff --git a/src/linux-virtual-root.c b/src/linux-virtual-root.c
|
||||||
|
index b2d36b4095f..75fbbfc1de6 100644
|
||||||
|
--- a/src/linux-virtual-root.c
|
||||||
|
+++ b/src/linux-virtual-root.c
|
||||||
|
@@ -61,7 +61,7 @@ parse_virtual_root(struct device *dev UNUSED, const char *current, const char *r
|
||||||
|
pos0 = pos1 = -1;
|
||||||
|
rc = sscanf(current, subdirs[i].fmt, &pos0, &pos1);
|
||||||
|
debug("current:'%s' rc:%d pos0:%d pos1:%d\n", current, rc, pos0, pos1);
|
||||||
|
- dbgmk(" ", pos0, pos1);
|
||||||
|
+ dbgmk(" ", pos0, pos1);
|
||||||
|
if (rc == 1) {
|
||||||
|
sz += pos1;
|
||||||
|
current += pos1;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,72 @@
|
|||||||
|
From effecb5ce0baf2fae011dd61e45852cd2fb1ec19 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Tue, 15 Oct 2019 16:58:19 -0400
|
||||||
|
Subject: [PATCH 59/63] Put some EFI device paths into the debug log
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/linux.c | 41 +++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 41 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/linux.c b/src/linux.c
|
||||||
|
index 7dd8d4cd858..9d8480a94a9 100644
|
||||||
|
--- a/src/linux.c
|
||||||
|
+++ b/src/linux.c
|
||||||
|
@@ -336,6 +336,44 @@ device_free(struct device *dev)
|
||||||
|
free(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+print_dev_dp_node(struct device *dev, struct dev_probe *probe)
|
||||||
|
+{
|
||||||
|
+ ssize_t dpsz;
|
||||||
|
+ uint8_t *dp;
|
||||||
|
+ ssize_t bufsz;
|
||||||
|
+ uint8_t *buf;
|
||||||
|
+
|
||||||
|
+ dpsz = probe->create(dev, NULL, 0, 0);
|
||||||
|
+ if (dpsz <= 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ dp = alloca(dpsz + 4);
|
||||||
|
+ if (!dp)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ dpsz = probe->create(dev, dp, dpsz, 0);
|
||||||
|
+ if (dpsz <= 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ efidp_make_end_entire(dp + dpsz, 4);
|
||||||
|
+ bufsz = efidp_format_device_path(NULL, 0,
|
||||||
|
+ (const_efidp)dp, dpsz + 4);
|
||||||
|
+ if (bufsz <= 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ buf = alloca(bufsz);
|
||||||
|
+ if (!buf)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ bufsz = efidp_format_device_path(buf, bufsz,
|
||||||
|
+ (const_efidp)dp, dpsz + 4);
|
||||||
|
+ if (bufsz <= 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ debug("Device path node is %s", buf);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
struct device HIDDEN
|
||||||
|
*device_get(int fd, int partition)
|
||||||
|
{
|
||||||
|
@@ -512,6 +550,9 @@ struct device HIDDEN
|
||||||
|
probe->flags & DEV_ABBREV_ONLY)
|
||||||
|
needs_root = false;
|
||||||
|
|
||||||
|
+ if (probe->create)
|
||||||
|
+ print_dev_dp_node(dev, probe);
|
||||||
|
+
|
||||||
|
dev->probes[n++] = dev_probes[i];
|
||||||
|
current += pos;
|
||||||
|
if (current[0] == '\0')
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
99
SOURCES/0060-Update-abixml.patch
Normal file
99
SOURCES/0060-Update-abixml.patch
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
From 5c6adc21cd219d5868507ae00c8c95c6542dac42 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 13 Jan 2020 09:51:56 -0500
|
||||||
|
Subject: [PATCH 60/63] Update abixml
|
||||||
|
|
||||||
|
---
|
||||||
|
src/libefiboot.abixml | 10 +++++-----
|
||||||
|
src/libefivar.abixml | 10 +++++-----
|
||||||
|
2 files changed, 10 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/libefiboot.abixml b/src/libefiboot.abixml
|
||||||
|
index ffdae048021..4b673d5c3e9 100644
|
||||||
|
--- a/src/libefiboot.abixml
|
||||||
|
+++ b/src/libefiboot.abixml
|
||||||
|
@@ -1577,13 +1577,13 @@
|
||||||
|
<function-decl name='__builtin_memcpy' mangled-name='memcpy' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-168'/>
|
||||||
|
</function-decl>
|
||||||
|
- <function-decl name='free' mangled-name='free' filepath='/usr/include/stdlib.h' line='563' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='free' mangled-name='free' filepath='/usr/include/stdlib.h' line='565' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-168'/>
|
||||||
|
</function-decl>
|
||||||
|
- <function-decl name='calloc' mangled-name='calloc' filepath='/usr/include/stdlib.h' line='541' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='calloc' mangled-name='calloc' filepath='/usr/include/stdlib.h' line='542' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-168'/>
|
||||||
|
</function-decl>
|
||||||
|
- <function-decl name='realloc' mangled-name='realloc' filepath='/usr/include/stdlib.h' line='549' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='realloc' mangled-name='realloc' filepath='/usr/include/stdlib.h' line='550' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-168'/>
|
||||||
|
</function-decl>
|
||||||
|
<function-decl name='read' mangled-name='read' filepath='/usr/include/unistd.h' line='360' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
@@ -1685,7 +1685,7 @@
|
||||||
|
<function-decl name='efi_str_to_guid' mangled-name='efi_str_to_guid' filepath='src/include/efivar/efivar.h' line='112' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-168'/>
|
||||||
|
</function-decl>
|
||||||
|
- <function-decl name='getenv' mangled-name='getenv' filepath='/usr/include/stdlib.h' line='631' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='getenv' mangled-name='getenv' filepath='/usr/include/stdlib.h' line='634' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-168'/>
|
||||||
|
</function-decl>
|
||||||
|
<function-decl name='efidp_make_sas' mangled-name='efidp_make_sas' filepath='src/include/efivar/efivar-dp.h' line='579' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
@@ -1709,7 +1709,7 @@
|
||||||
|
<function-decl name='strerror' mangled-name='strerror' filepath='/usr/include/string.h' line='396' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-168'/>
|
||||||
|
</function-decl>
|
||||||
|
- <function-decl name='posix_memalign' mangled-name='posix_memalign' filepath='/usr/include/stdlib.h' line='577' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='posix_memalign' mangled-name='posix_memalign' filepath='/usr/include/stdlib.h' line='580' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-168'/>
|
||||||
|
</function-decl>
|
||||||
|
<function-decl name='lseek' mangled-name='lseek' filepath='/usr/include/unistd.h' line='334' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
diff --git a/src/libefivar.abixml b/src/libefivar.abixml
|
||||||
|
index 4aadf5079a7..094f43d7b27 100644
|
||||||
|
--- a/src/libefivar.abixml
|
||||||
|
+++ b/src/libefivar.abixml
|
||||||
|
@@ -639,7 +639,7 @@
|
||||||
|
<var-decl name='default_ops' type-id='type-id-71' visibility='default' filepath='src/lib.c' line='38' column='1'/>
|
||||||
|
<var-decl name='vars_ops' type-id='type-id-71' visibility='default' filepath='src/lib.h' line='50' column='1'/>
|
||||||
|
<var-decl name='efivarfs_ops' type-id='type-id-71' visibility='default' filepath='src/lib.h' line='51' column='1'/>
|
||||||
|
- <function-decl name='getenv' mangled-name='getenv' filepath='/usr/include/stdlib.h' line='631' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='getenv' mangled-name='getenv' filepath='/usr/include/stdlib.h' line='634' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-35'/>
|
||||||
|
</function-decl>
|
||||||
|
<function-decl name='asprintf' mangled-name='asprintf' filepath='/usr/include/stdio.h' line='372' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
@@ -648,7 +648,7 @@
|
||||||
|
<function-decl name='chmod' mangled-name='chmod' filepath='/usr/include/sys/stat.h' line='280' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-35'/>
|
||||||
|
</function-decl>
|
||||||
|
- <function-decl name='free' mangled-name='free' filepath='/usr/include/stdlib.h' line='563' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='free' mangled-name='free' filepath='/usr/include/stdlib.h' line='565' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-35'/>
|
||||||
|
</function-decl>
|
||||||
|
<function-decl name='umask' mangled-name='umask' filepath='/usr/include/sys/stat.h' line='308' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
@@ -678,7 +678,7 @@
|
||||||
|
<function-decl name='malloc' mangled-name='malloc' filepath='/usr/include/stdlib.h' line='539' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-35'/>
|
||||||
|
</function-decl>
|
||||||
|
- <function-decl name='calloc' mangled-name='calloc' filepath='/usr/include/stdlib.h' line='541' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='calloc' mangled-name='calloc' filepath='/usr/include/stdlib.h' line='542' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-35'/>
|
||||||
|
</function-decl>
|
||||||
|
<function-decl name='printf' mangled-name='printf' filepath='/usr/include/stdio.h' line='332' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
@@ -693,13 +693,13 @@
|
||||||
|
<function-decl name='__builtin_puts' mangled-name='puts' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-35'/>
|
||||||
|
</function-decl>
|
||||||
|
- <function-decl name='exit' mangled-name='exit' filepath='/usr/include/stdlib.h' line='614' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='exit' mangled-name='exit' filepath='/usr/include/stdlib.h' line='617' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-35'/>
|
||||||
|
</function-decl>
|
||||||
|
<function-decl name='vasprintf' mangled-name='vasprintf' filepath='/usr/include/stdio.h' line='366' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-35'/>
|
||||||
|
</function-decl>
|
||||||
|
- <function-decl name='realloc' mangled-name='realloc' filepath='/usr/include/stdlib.h' line='549' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
+ <function-decl name='realloc' mangled-name='realloc' filepath='/usr/include/stdlib.h' line='550' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
<return type-id='type-id-35'/>
|
||||||
|
</function-decl>
|
||||||
|
<function-decl name='strdup' mangled-name='strdup' filepath='/usr/include/string.h' line='166' column='1' visibility='default' binding='global' size-in-bits='64'>
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
43
SOURCES/0062-Don-t-use-march-native-on-ia64.patch
Normal file
43
SOURCES/0062-Don-t-use-march-native-on-ia64.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From ec3079ee6252808ff6961a165306cb1ae427d04f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 13 Jan 2020 15:58:47 -0500
|
||||||
|
Subject: [PATCH 62/63] Don't use -march=native on ia64.
|
||||||
|
|
||||||
|
I don't understand why this architecture hasn't been fully pushed into
|
||||||
|
the sea*, but somehow there are bug reports anyway. In this case,
|
||||||
|
because the gcc port is inadequately maintained.
|
||||||
|
|
||||||
|
(* don't pollute the planet this way, destroy the device responsibly.)
|
||||||
|
|
||||||
|
Resolves github issue #144
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/include/defaults.mk | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
|
||||||
|
index af6a41a9824..8a784d00be3 100644
|
||||||
|
--- a/src/include/defaults.mk
|
||||||
|
+++ b/src/include/defaults.mk
|
||||||
|
@@ -56,10 +56,16 @@ override _CCLDFLAGS := $(CCLDFLAGS)
|
||||||
|
override CCLDFLAGS = $(CFLAGS) -L. $(_CCLDFLAGS) \
|
||||||
|
$(call add-prefix,-Wl,$(LDFLAGS)) \
|
||||||
|
$(call pkg-config-ccldflags)
|
||||||
|
+HOST_ARCH=$(shell uname -m)
|
||||||
|
+ifneq ($(HOST_ARCH),ia64)
|
||||||
|
+ HOST_MARCH=-march=native
|
||||||
|
+else
|
||||||
|
+ HOST_MARCH=
|
||||||
|
+endif
|
||||||
|
HOST_CPPFLAGS ?= $(CPPFLAGS)
|
||||||
|
override _HOST_CPPFLAGS := $(HOST_CPPFLAGS)
|
||||||
|
override HOST_CPPFLAGS = $(_HOST_CPPFLAGS) \
|
||||||
|
- -DEFIVAR_BUILD_ENVIRONMENT -march=native
|
||||||
|
+ -DEFIVAR_BUILD_ENVIRONMENT $(HOST_MARCH)
|
||||||
|
HOST_CFLAGS ?= $(CFLAGS)
|
||||||
|
override _HOST_CFLAGS := $(HOST_CFLAGS)
|
||||||
|
override HOST_CFLAGS = $(_HOST_CFLAGS)
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,56 @@
|
|||||||
|
From 1b35f9a4b396f21139ab64de0510aa829548682d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 13 Jan 2020 16:27:42 -0500
|
||||||
|
Subject: [PATCH 63/63] Work around autoconf existing in the world.
|
||||||
|
|
||||||
|
Long long ago, autoconf added a variable called to pass linker flags to
|
||||||
|
the compiler. For some misguided reason, they prefixed it with LD (the
|
||||||
|
linker) instead of "CC" (the compiler). Now people unquestioningly
|
||||||
|
complain if you use that name a more reasonable way, so we're stuck with
|
||||||
|
names that are counter-descriptive. You just can't win, the well is too
|
||||||
|
full of poison.
|
||||||
|
|
||||||
|
Resolves github issue #142.
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/include/defaults.mk | 16 ++++++++--------
|
||||||
|
1 file changed, 8 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
|
||||||
|
index 8a784d00be3..781587b4215 100644
|
||||||
|
--- a/src/include/defaults.mk
|
||||||
|
+++ b/src/include/defaults.mk
|
||||||
|
@@ -40,21 +40,21 @@ override CFLAGS = $(_CFLAGS) \
|
||||||
|
-fvisibility=hidden \
|
||||||
|
$(call family,CFLAGS) \
|
||||||
|
$(call pkg-config-cflags)
|
||||||
|
-LDFLAGS_CLANG ?= --fatal-warnings -pie -z relro
|
||||||
|
+LDFLAGS_CLANG ?= -Wl,--fatal-warnings,-pie,-z,relro
|
||||||
|
LDFLAGS ?=
|
||||||
|
override _LDFLAGS := $(LDFLAGS)
|
||||||
|
override LDFLAGS = $(_LDFLAGS) \
|
||||||
|
- --add-needed \
|
||||||
|
- --build-id \
|
||||||
|
- --no-allow-shlib-undefined \
|
||||||
|
- --no-undefined-version \
|
||||||
|
- -z now \
|
||||||
|
- -z muldefs \
|
||||||
|
+ -Wl,--add-needed \
|
||||||
|
+ -Wl,--build-id \
|
||||||
|
+ -Wl,--no-allow-shlib-undefined \
|
||||||
|
+ -Wl,--no-undefined-version \
|
||||||
|
+ -Wl,-z,now \
|
||||||
|
+ -Wl,-z,muldefs \
|
||||||
|
$(call family,LDFLAGS)
|
||||||
|
CCLDFLAGS ?=
|
||||||
|
override _CCLDFLAGS := $(CCLDFLAGS)
|
||||||
|
override CCLDFLAGS = $(CFLAGS) -L. $(_CCLDFLAGS) \
|
||||||
|
- $(call add-prefix,-Wl,$(LDFLAGS)) \
|
||||||
|
+ $(LDFLAGS) \
|
||||||
|
$(call pkg-config-ccldflags)
|
||||||
|
HOST_ARCH=$(shell uname -m)
|
||||||
|
ifneq ($(HOST_ARCH),ia64)
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
37
SOURCES/0064-Fix-efivar-w-and-efivar-a.patch
Normal file
37
SOURCES/0064-Fix-efivar-w-and-efivar-a.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From fa29161221937243dd7c3a11908aa020aa5e990c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Jones <pjones@redhat.com>
|
||||||
|
Date: Mon, 13 Jan 2020 16:40:32 -0500
|
||||||
|
Subject: [PATCH] Fix "efivar -w" and "efivar -a"
|
||||||
|
|
||||||
|
When adding --export, I broke -w and -a by accidentally using the wrong
|
||||||
|
variable to get the data from. Woops.
|
||||||
|
|
||||||
|
Resolves github issue #143
|
||||||
|
|
||||||
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||||
|
---
|
||||||
|
src/efivar.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/efivar.c b/src/efivar.c
|
||||||
|
index 8b1da8888f6..edfd4af7e01 100644
|
||||||
|
--- a/src/efivar.c
|
||||||
|
+++ b/src/efivar.c
|
||||||
|
@@ -614,12 +614,12 @@ int main(int argc, char *argv[])
|
||||||
|
show_variable(guid_name, SHOW_DECIMAL);
|
||||||
|
break;
|
||||||
|
case ACTION_APPEND | ACTION_PRINT:
|
||||||
|
- prepare_data(infile, &data, &data_size);
|
||||||
|
+ prepare_data(datafile, &data, &data_size);
|
||||||
|
edit_variable(guid_name, data, data_size, attributes,
|
||||||
|
EDIT_APPEND);
|
||||||
|
break;
|
||||||
|
case ACTION_WRITE | ACTION_PRINT:
|
||||||
|
- prepare_data(infile, &data, &data_size);
|
||||||
|
+ prepare_data(datafile, &data, &data_size);
|
||||||
|
edit_variable(guid_name, data, data_size, attributes,
|
||||||
|
EDIT_WRITE);
|
||||||
|
break;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
39
SOURCES/0065-Fix-variable-sz-uninitialized-error.patch
Normal file
39
SOURCES/0065-Fix-variable-sz-uninitialized-error.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
From 9dc04c2fd88b6e0e0fe411885041925d52f71af3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
Date: Wed, 22 Jan 2020 12:16:12 +0800
|
||||||
|
Subject: [PATCH] Fix variable 'sz' uninitialized error
|
||||||
|
|
||||||
|
To fix the error:
|
||||||
|
|
||||||
|
external/efivar/src/linux-virtual-root.c:66:4: error: variable 'sz' is uninitialized when used here [-Werror,-Wuninitialized]
|
||||||
|
sz += pos1;
|
||||||
|
^~
|
||||||
|
external/efivar/src/linux-virtual-root.c:45:12: note: initialize the variable 'sz' to silence this warning
|
||||||
|
ssize_t sz;
|
||||||
|
^
|
||||||
|
= 0
|
||||||
|
1 error generated.
|
||||||
|
|
||||||
|
Fixes: c41da0bd ("Handle /sys/devices/virtual/{nvme-fabrics,nvme-subsystem} devices")
|
||||||
|
|
||||||
|
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
---
|
||||||
|
src/linux-virtual-root.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/linux-virtual-root.c b/src/linux-virtual-root.c
|
||||||
|
index 75fbbfc1de6..2d39c28ebb6 100644
|
||||||
|
--- a/src/linux-virtual-root.c
|
||||||
|
+++ b/src/linux-virtual-root.c
|
||||||
|
@@ -42,7 +42,7 @@ static ssize_t
|
||||||
|
parse_virtual_root(struct device *dev UNUSED, const char *current, const char *root UNUSED)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
- ssize_t sz;
|
||||||
|
+ ssize_t sz = 0;
|
||||||
|
int pos0 = 0, pos1 = 0;
|
||||||
|
struct subdir {
|
||||||
|
const char * const name;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -1,23 +1,81 @@
|
|||||||
Name: efivar
|
Name: efivar
|
||||||
Version: 38
|
Version: 37
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
Summary: Tools to manage UEFI variables
|
Summary: Tools to manage UEFI variables
|
||||||
License: LGPLv2
|
License: LGPL-2.1
|
||||||
URL: https://github.com/rhboot/efivar
|
URL: https://github.com/rhboot/efivar
|
||||||
Requires: %{name}-libs = %{version}-%{release}
|
Requires: %{name}-libs = %{version}-%{release}
|
||||||
ExclusiveArch: %{efi}
|
ExclusiveArch: %{ix86} x86_64 aarch64 %{arm}
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: popt-devel git glibc-static libabigail
|
||||||
BuildRequires: efi-srpm-macros git glibc-static libabigail
|
|
||||||
BuildRequires: make
|
|
||||||
BuildRequires: git
|
|
||||||
# please don't fix this to reflect github's incomprehensible url that goes
|
# please don't fix this to reflect github's incomprehensible url that goes
|
||||||
# to a different tarball.
|
# to a different tarball.
|
||||||
Source0: https://github.com/rhboot/efivar/releases/download/%{version}/efivar-%{version}.tar.bz2
|
Source0: https://github.com/rhboot/efivar/archive/efivar-%{version}.tar.bz2
|
||||||
Source1: efivar.patches
|
Patch0001: 0001-util.h-add-unlikely-and-likely-macros.patch
|
||||||
|
Patch0002: 0002-dp.h-make-format_guid-handle-misaligned-guid-pointer.patch
|
||||||
# include patches
|
Patch0003: 0003-linux-pci-root-remove-an-unused-assignment.patch
|
||||||
%include %{SOURCE1}
|
Patch0004: 0004-Fix-all-the-places-Werror-address-of-packed-member-c.patch
|
||||||
|
Patch0005: 0005-Get-rid-of-the-arrows-in-our-debug-messages.patch
|
||||||
|
Patch0006: 0006-Define-strdupa-if-it-is-not-defined.patch
|
||||||
|
Patch0007: 0007-Android-inital-porting-of-libefivar.patch
|
||||||
|
Patch0008: 0008-Remove-an-unused-function.patch
|
||||||
|
Patch0009: 0009-Fix-another-error-of-Werror-address-of-packed-member.patch
|
||||||
|
Patch0010: 0010-ucs2.h-remove-unused-variable.patch
|
||||||
|
Patch0011: 0011-ucs2.h-fix-logic-that-checks-for-UCS-2-string-termin.patch
|
||||||
|
Patch0012: 0012-dp-message-fix-efidp_ipv4_addr-fields-assignment.patch
|
||||||
|
Patch0013: 0013-Always-refer-to-MBR-and-GPT-fixed-values-as-magic-no.patch
|
||||||
|
Patch0014: 0014-Add-more-hexdump-logging-functions.patch
|
||||||
|
Patch0015: 0015-Add-efi_error_pop-and-pop-some-errors-sometimes.patch
|
||||||
|
Patch0016: 0016-Always-log-to-a-memfd-regardless-of-loglevel.patch
|
||||||
|
Patch0017: 0017-Always-initialize-any-variable-we-use-with-sscanf-s-.patch
|
||||||
|
Patch0018: 0018-Add-efi_get_libefivar_version-and-efi_get_libefiboot.patch
|
||||||
|
Patch0019: 0019-Fix-dbglog_seek-to-update-the-offset.patch
|
||||||
|
Patch0020: 0020-Update-efivar-37-.abixml-for-new-libabigail-version.patch
|
||||||
|
Patch0021: 0021-Fix-up-efi_guid_cmp-s-alignment-problem-a-different-.patch
|
||||||
|
Patch0022: 0022-Fix-dbglog_write-to-always-return-the-status-of-writ.patch
|
||||||
|
Patch0023: 0023-Do-a-better-job-of-making-sure-DLIBEFIVAR_VERSION-ha.patch
|
||||||
|
Patch0024: 0024-efi_stash_loglevel_-efi_set_loglevel.patch
|
||||||
|
Patch0025: 0025-guids-add-grub-guid-for-grubenv.patch
|
||||||
|
Patch0026: 0026-gcc.specs-add-grecord-gcc-switches.patch
|
||||||
|
Patch0027: 0027-Makefile-don-t-echo-our-deps-submake-invocation.patch
|
||||||
|
Patch0028: 0028-Make-Add-some-more-stuff-to-the-toplevel-clean.patch
|
||||||
|
Patch0029: 0029-Make-scan-build-rules-slightly-more-intuitive.patch
|
||||||
|
Patch0030: 0030-Local-header-whitespace-cleanup.patch
|
||||||
|
Patch0031: 0031-Exported-header-whitespace-cleanup.patch
|
||||||
|
Patch0032: 0032-Main-code-whitespace-cleanup.patch
|
||||||
|
Patch0033: 0033-efivar-rework-usage.patch
|
||||||
|
Patch0034: 0034-Try-to-deal-with-some-signof-char-signof-uint8_t-mad.patch
|
||||||
|
Patch0035: 0035-ucs2-document-things-a-little-better.patch
|
||||||
|
Patch0036: 0036-util.h-implement-add-mul-sub-for-more-integer-types.patch
|
||||||
|
Patch0037: 0037-Implement-efivar-export-foo.var.patch
|
||||||
|
Patch0038: 0038-Add-some-test-cases-for-efivar-export-import.patch
|
||||||
|
Patch0039: 0039-Fix-a-case-clang-analyzer-found-where-we-may-try-to-.patch
|
||||||
|
Patch0040: 0040-Make-sure-makeguids-helper-is-compiled-for-the-host-.patch
|
||||||
|
Patch0041: 0041-Makefile-sort-wildcard-output-for-reproducibility.patch
|
||||||
|
Patch0042: 0042-guids.txt-correct-sentinal-typo.patch
|
||||||
|
Patch0043: 0043-update-manpage-for-efivar-such-that-it-reflects-the-.patch
|
||||||
|
Patch0044: 0044-Fix-some-32-bit-size_t-format-specifier-errors.patch
|
||||||
|
Patch0045: 0045-Make-the-top-level-makefile-not-parallelize.patch
|
||||||
|
Patch0046: 0046-guids-add-auto_created_boot_option.patch
|
||||||
|
Patch0047: 0047-Move-our-infrastructure-makefiles-out-of-the-topdir.patch
|
||||||
|
Patch0048: 0048-Make-CC_FOR_BUILD-and-CCLD_FOR_BUILD-override-HOSTCC.patch
|
||||||
|
Patch0049: 0049-Rework-some-makefile-bits-to-make-overriding-some-op.patch
|
||||||
|
Patch0050: 0050-Make-add-Wno-missing-field-initializers.patch
|
||||||
|
Patch0051: 0051-debug-don-t-write-newlines-to-memfd.patch
|
||||||
|
Patch0052: 0052-sysfs-parsing-add-some-more-debugging-output.patch
|
||||||
|
Patch0053: 0053-gitignore-ignore-.strace.patch
|
||||||
|
Patch0054: 0054-Improve-consistency-of-debug-prints.patch
|
||||||
|
Patch0055: 0055-Fix-the-error-path-in-set_disk_and_part_name.patch
|
||||||
|
Patch0056: 0056-Try-even-harder-to-find-disk-device-symlinks-in-sysf.patch
|
||||||
|
Patch0057: 0057-Handle-sys-devices-virtual-nvme-fabrics-nvme-subsyst.patch
|
||||||
|
Patch0058: 0058-sysfs-parsers-make-all-the-sys-block-link-parsers-wo.patch
|
||||||
|
Patch0059: 0059-Put-some-EFI-device-paths-into-the-debug-log.patch
|
||||||
|
Patch0060: 0060-Update-abixml.patch
|
||||||
|
Patch0061: 0061-Update-abixml-files-and-work-around-some-inconsequen.patch
|
||||||
|
Patch0062: 0062-Don-t-use-march-native-on-ia64.patch
|
||||||
|
Patch0063: 0063-Work-around-autoconf-existing-in-the-world.patch
|
||||||
|
Patch0064: 0064-Fix-efivar-w-and-efivar-a.patch
|
||||||
|
Patch0065: 0065-Fix-variable-sz-uninitialized-error.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
efivar provides a simple command line interface to the UEFI variable facility.
|
efivar provides a simple command line interface to the UEFI variable facility.
|
||||||
@ -47,34 +105,25 @@ git config --unset user.email
|
|||||||
git config --unset user.name
|
git config --unset user.name
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# This package implements symbol versioning with toplevel ASM statments which is
|
make libdir=%{_libdir} bindir=%{_bindir} CFLAGS="$RPM_OPT_FLAGS -flto" LDFLAGS="$RPM_LD_FLAGS -flto"
|
||||||
# incompatible with LTO. Disable LTO
|
|
||||||
%define _lto_cflags %{nil}
|
|
||||||
|
|
||||||
# mandoc isn't packaged in RHEL, so do... this.
|
|
||||||
for f in efisecdb.1; do
|
|
||||||
cp docs/"$f".mdoc docs/"$f"
|
|
||||||
done
|
|
||||||
|
|
||||||
make LIBDIR=%{_libdir} BINDIR=%{_bindir} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%makeinstall CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
|
%makeinstall
|
||||||
install -m 0644 src/abignore %{buildroot}%{_includedir}/efivar/.abignore
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
%ifarch x86_64
|
%ifarch x86_64
|
||||||
make abicheck CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
|
#make abicheck
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%ldconfig_scriptlets libs
|
%post libs -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%postun libs -p /sbin/ldconfig
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%{!?_licensedir:%global license %%doc}
|
%{!?_licensedir:%global license %%doc}
|
||||||
%license COPYING
|
%license COPYING
|
||||||
%doc README.md
|
%doc README.md
|
||||||
%{_bindir}/efivar
|
%{_bindir}/efivar
|
||||||
%{_bindir}/efisecdb
|
|
||||||
%exclude %{_bindir}/efivar-static
|
%exclude %{_bindir}/efivar-static
|
||||||
%{_mandir}/man1/*
|
%{_mandir}/man1/*
|
||||||
|
|
||||||
@ -88,89 +137,25 @@ make abicheck CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
|
|||||||
%{_libdir}/*.so.*
|
%{_libdir}/*.so.*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Jan 11 2023 Robbie Harwood <rharwood@redhat.com> - 38-3
|
* Tue Jul 14 2020 Javier Martinez Canillas <javierm@redhat.com> - 37-4
|
||||||
- Fix inheritance of buildflags
|
- Fix efivar "-w" and "-a" options that broke due the rebase
|
||||||
- Resolves: #2144520
|
Related: rhbz#1755645
|
||||||
|
|
||||||
* Wed Feb 02 2022 Robbie Harwood <rharwood@redhat.com> - 38-2
|
* Tue Jul 14 2020 Javier Martinez Canillas <javierm@redhat.com> - 37-3
|
||||||
- Bump to re-run tests; no code changes
|
- Fix uninitialized variable found by covscan
|
||||||
- Resolves: #2024374
|
Related: rhbz#1755645
|
||||||
|
|
||||||
* Tue Feb 01 2022 Robbie Harwood <rharwood@redhat.com> - 38-1
|
* Mon Jul 13 2020 Javier Martinez Canillas <javierm@redhat.com> - 37-2
|
||||||
- New upstream release (38)
|
|
||||||
- Resolves: #2024374
|
|
||||||
|
|
||||||
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org>
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
|
||||||
|
|
||||||
* Thu Jun 17 2021 Javier Martinez Canillas <javierm@redhat.com> - 37-16
|
|
||||||
- Enable Intel Control-flow Enforcement Technology (CET)
|
|
||||||
Resolves: rhbz#1808811
|
|
||||||
|
|
||||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org>
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
|
||||||
|
|
||||||
* Tue Oct 27 2020 Petr Pisar <ppisar@redhat.com> - 37-14
|
|
||||||
- Fix XML ABI dumps that were generated with a faulty GCC and missed the
|
|
||||||
variadic arguments when building without LTO (bug #1863475)
|
|
||||||
|
|
||||||
* Thu Aug 06 2020 Jeff Law <law@redhat.com>
|
|
||||||
- Remove explicit LTO bits from flags
|
|
||||||
|
|
||||||
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org>
|
|
||||||
- Second attempt - Rebuilt for
|
|
||||||
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
|
||||||
|
|
||||||
* Mon Jul 27 2020 Jeff Law <law@redhat.com> - 37-11
|
|
||||||
- Disable LTO
|
|
||||||
|
|
||||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org>
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
|
||||||
|
|
||||||
* Mon Jul 13 2020 Javier Martinez Canillas <javierm@redhat.com> - 37-9
|
|
||||||
- Change License field to LGPL-2.1 to prevent rpminspect test to fail
|
- Change License field to LGPL-2.1 to prevent rpminspect test to fail
|
||||||
|
Related: rhbz#1755645
|
||||||
|
|
||||||
* Wed Apr 22 2020 Hans de Goede <hdegoede@redhat.com> - 37-8
|
* Thu Jul 02 2020 Javier Martinez Canillas <javierm@redhat.com> - 37-1
|
||||||
- Add a patch to fix eMMC sysfs path parsing
|
- Update to efivar 37 and some changes to support NVMe over FC
|
||||||
Resolves: rhbz#1826864
|
Resolves: rhbz#1755645
|
||||||
|
|
||||||
* Mon Feb 24 2020 Peter Jones <pjones@redhat.com> - 37-7
|
* Tue Oct 02 2018 Peter Jones <pjones@redhat.com> - 36-1
|
||||||
- Package our abignore file to try to shut taskotron up some.
|
- Update to efivar 36 (and some change)
|
||||||
|
Resolves: rhbz#1635019
|
||||||
* Mon Feb 24 2020 Peter Jones <pjones@redhat.com> - 37-6
|
|
||||||
- Pull in a bunch of patches from upstream.
|
|
||||||
|
|
||||||
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 37-5
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
|
||||||
|
|
||||||
* Tue Nov 12 2019 Peter Jones <pjones@redhat.com> - 37-4
|
|
||||||
- Update for some compiler warning fixes.
|
|
||||||
Resolves: rhbz#1735168
|
|
||||||
|
|
||||||
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 37-3
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
|
||||||
|
|
||||||
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 37-2
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
|
||||||
|
|
||||||
* Wed Dec 05 2018 Peter Jones <pjones@redhat.com> - 37-1
|
|
||||||
- Update to efivar 37:
|
|
||||||
- Minor coverity fixes
|
|
||||||
- Improve ACPI device path formatting
|
|
||||||
- Add support for SOC devices that use FDT as their PCI root node
|
|
||||||
- Make devices we can't parse the "device" sysfs link for use DEV_ABBREV_ONLY
|
|
||||||
- Handle SCSI port numbers better
|
|
||||||
- Don't require an EUI for NVMe
|
|
||||||
- Fix the accidental requirement on ACPI UID nodes existing
|
|
||||||
- Add support for EMMC devices
|
|
||||||
- Add support for PCI root nodes without a device link in sysfs
|
|
||||||
- Add support for partitioned MD devices
|
|
||||||
- Fix partition number detection when the number isn't provided
|
|
||||||
- Add support for ACPI Generic Container and Embedded Controller root nodes
|
|
||||||
- Add limited support for SAS/SATA port expanders
|
|
||||||
|
|
||||||
* Mon Sep 17 2018 Peter Jones <pjones@redhat.com> - 36-1
|
|
||||||
- Update to efivar 36
|
|
||||||
- Add NVDIMM support
|
- Add NVDIMM support
|
||||||
- Re-written linux interface parser to handle how devices are
|
- Re-written linux interface parser to handle how devices are
|
||||||
partitioned better, and for cleaner code, with one file per device
|
partitioned better, and for cleaner code, with one file per device
|
||||||
@ -181,15 +166,12 @@ make abicheck CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
|
|||||||
- Better handling of immutable bits in sysfs
|
- Better handling of immutable bits in sysfs
|
||||||
- LIBEFIVAR_OPS=help
|
- LIBEFIVAR_OPS=help
|
||||||
- lots of code cleanups.
|
- lots of code cleanups.
|
||||||
|
- Add emmc device support
|
||||||
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 35-4
|
- Add SAS port expander support
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
- Support for ACPI root nodes that are less common
|
||||||
|
(i.e. ACPI Generic Container and Embedded Controller PNP nodes)
|
||||||
* Fri May 04 2018 Peter Jones <pjones@redhat.com> - 35-3
|
- Make abbreviated device paths if we can't parse a device's info
|
||||||
- Rebuild for new efi-rpm-macros, now that it has settled down a bit.
|
- Don't require NVME to have an EUI
|
||||||
|
|
||||||
* Tue May 01 2018 Peter Jones <pjones@redhat.com> - 35-2
|
|
||||||
- Use efi-rpm-macros instead of defining efi-related macros ourselves
|
|
||||||
|
|
||||||
* Mon Apr 09 2018 Peter Jones <pjones@redhat.com> - 35-1
|
* Mon Apr 09 2018 Peter Jones <pjones@redhat.com> - 35-1
|
||||||
- Update to efivar 35
|
- Update to efivar 35
|
@ -1,6 +0,0 @@
|
|||||||
--- !Policy
|
|
||||||
product_versions:
|
|
||||||
- rhel-9
|
|
||||||
decision_context: osci_compose_gate
|
|
||||||
rules:
|
|
||||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.revdeps.integration}
|
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
inspections:
|
|
||||||
# Not a Java package
|
|
||||||
javabytecode: off
|
|
||||||
|
|
||||||
# These just flag when things change "too much"
|
|
||||||
changedfiles: off
|
|
||||||
filesize: off
|
|
||||||
patches: off
|
|
||||||
upstream: off
|
|
Loading…
Reference in New Issue
Block a user