OSDN Git Service

android-x86/external-efivar.git
12 months agoAndroid: inital porting of libefivar oreo-x86 android-x86-8.1-r1 android-x86-8.1-r2 android-x86-8.1-r3
Chih-Wei Huang [Thu, 10 Jan 2019 08:48:30 +0000 (16:48 +0800)]
Android: inital porting of libefivar

The static library is linked by efibootmgr.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
12 months agoDefine strdupa if it is not defined
Chih-Wei Huang [Thu, 10 Jan 2019 08:44:38 +0000 (16:44 +0800)]
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>
12 months agolinux-pci-root: remove an unused assignment
Peter Jones [Mon, 7 Jan 2019 16:32:41 +0000 (11:32 -0500)]
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>
12 months agodp.h: make format_guid() handle misaligned guid pointers safely.
Peter Jones [Mon, 7 Jan 2019 15:30:59 +0000 (10:30 -0500)]
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>
12 months agoutil.h: add unlikely() and likely() macros
Peter Jones [Mon, 7 Jan 2019 15:30:23 +0000 (10:30 -0500)]
util.h: add unlikely() and likely() macros

Signed-off-by: Peter Jones <pjones@redhat.com>
13 months agoBump version to 37
Peter Jones [Wed, 5 Dec 2018 16:17:42 +0000 (11:17 -0500)]
Bump version to 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

Signed-off-by: Peter Jones <pjones@redhat.com>
13 months agoWorkaround libabigail weirness.
Peter Jones [Wed, 5 Dec 2018 16:16:28 +0000 (11:16 -0500)]
Workaround libabigail weirness.

As per usual, two runs of libabigail produce two different results :/

This removes the extra set of arguments it generated from
efidp_make_file() in efivar-36, because abicheck is complaining about
them going away, even though they're duplicates *and* other functions
have the same problem in the .abixml file.

I really wish this worked better.

Signed-off-by: Peter Jones <pjones@redhat.com>
13 months agoUpdate abixml for newer libabigail
Peter Jones [Wed, 5 Dec 2018 15:47:42 +0000 (10:47 -0500)]
Update abixml for newer libabigail

This is the xml files for the "36" tag, updated with libabigail-1.4-2.fc29.x86_64

Signed-off-by: Peter Jones <pjones@redhat.com>
15 months agosas: handle port expanders at all.
Peter Jones [Mon, 1 Oct 2018 18:35:01 +0000 (14:35 -0400)]
sas: handle port expanders at all.

Signed-off-by: Peter Jones <pjones@redhat.com>
15 months agopci-root: actually create the device path node.
Peter Jones [Mon, 1 Oct 2018 18:33:20 +0000 (14:33 -0400)]
pci-root: actually create the device path node.

Signed-off-by: Peter Jones <pjones@redhat.com>
15 months agoSupport decoding ACPI Generic Container and Embedded Controller dp nodes
Peter Jones [Mon, 1 Oct 2018 18:31:06 +0000 (14:31 -0400)]
Support decoding ACPI Generic Container and Embedded Controller dp nodes

Signed-off-by: Peter Jones <pjones@redhat.com>
15 months agodp-acpi: fix HID vs HID_EX formatting bug.
Peter Jones [Mon, 1 Oct 2018 18:27:04 +0000 (14:27 -0400)]
dp-acpi: fix HID vs HID_EX formatting bug.

Signed-off-by: Peter Jones <pjones@redhat.com>
16 months agoFix partition number detection when it's not provided.
Peter Jones [Tue, 18 Sep 2018 18:57:13 +0000 (14:57 -0400)]
Fix partition number detection when it's not provided.

We need to actually get the partition number from the child device when
we're called without it.

Resolves: rhbz#1616305

Signed-off-by: Peter Jones <pjones@redhat.com>
16 months agoHandle partition name parsing and formatting for partitioned md.
Peter Jones [Mon, 17 Sep 2018 20:52:57 +0000 (16:52 -0400)]
Handle partition name parsing and formatting for partitioned md.

Signed-off-by: Peter Jones <pjones@redhat.com>
16 months agoDeal with devices that don't have a ->device link in sysfs
Peter Jones [Mon, 17 Sep 2018 20:13:24 +0000 (16:13 -0400)]
Deal with devices that don't have a ->device link in sysfs

Signed-off-by: Peter Jones <pjones@redhat.com>
16 months agoFix dev->probes intialization test
Peter Jones [Mon, 17 Sep 2018 20:12:25 +0000 (16:12 -0400)]
Fix dev->probes intialization test

Signed-off-by: Peter Jones <pjones@redhat.com>
16 months agoFix another buggy fake acpi pci root driver
Peter Jones [Mon, 10 Sep 2018 19:00:03 +0000 (15:00 -0400)]
Fix another buggy fake acpi pci root driver

In this case, the platform driver that creates the PCI(e) root device
doesn't fill in its driver link, so we can't look up what driver is in
use - but since it's the root, it *really* doesn't matter.  And in
general, we only really care if it's the last node in our path, because
that'll be the controller for the boot device anyway.

Signed-off-by: Peter Jones <pjones@redhat.com>
17 months agolinux-emmc: update for internal API breakage.
Peter Jones [Fri, 3 Aug 2018 14:02:02 +0000 (10:02 -0400)]
linux-emmc: update for internal API breakage.

Alek wrote his code before I made debug() imply LOG_DEBUG, so we need to
change that here as well.

Signed-off-by: Peter Jones <pjones@redhat.com>
17 months agoUpdate abidw for newer tools.
Peter Jones [Fri, 8 Jun 2018 19:14:27 +0000 (15:14 -0400)]
Update abidw for newer tools.

Signed-off-by: Peter Jones <pjones@redhat.com>
17 months agoabignore: work around an abidw bug
Peter Jones [Fri, 3 Aug 2018 13:56:01 +0000 (09:56 -0400)]
abignore: work around an abidw bug

Some versions of abignore mistakenly treat brackets as section headers,
thus ignoring the rest of the stanza after them.  It's fixed upstream,
but I don't have the newer version yet.  Moving the braces to be after
the change-kind and other things works around the issue.

Signed-off-by: Peter Jones <pjones@redhat.com>
17 months agoemmc_parser: add emmc_parser
Alek Du [Fri, 27 Jul 2018 13:31:01 +0000 (21:31 +0800)]
emmc_parser: add emmc_parser

Signed-off-by: Alek Du <alek.du@intel.com>
17 months agomakeguids: initialize memory
Bernhard M. Wiedemann [Tue, 24 Jul 2018 07:34:21 +0000 (09:34 +0200)]
makeguids: initialize memory

so that we do not write uninitialized memory into guids.bin and names.bin
which made the resulting libefivar.so.1.36 unreproducible.
See https://reproducible-builds.org/ for why this matters.

18 months agoDon't require NVME to have an EUI
Peter Jones [Mon, 16 Jul 2018 19:40:22 +0000 (15:40 -0400)]
Don't require NVME to have an EUI

Resolves: rhbz#1593784

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoCoverity still doesn't believe in error codes...
Peter Jones [Thu, 21 Jun 2018 20:18:32 +0000 (16:18 -0400)]
Coverity still doesn't believe in error codes...

So also test fbuf here.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoefiboot: parse_scsi_link(): fix the offset searching for the port
Peter Jones [Thu, 21 Jun 2018 18:23:40 +0000 (14:23 -0400)]
efiboot: parse_scsi_link(): fix the offset searching for the port

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoefiboot: fix a bad error check
Peter Jones [Thu, 21 Jun 2018 17:55:45 +0000 (13:55 -0400)]
efiboot: fix a bad error check

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoefiboot: don't error on unknown type with DEV_ABBREV_ONLY
Peter Jones [Thu, 21 Jun 2018 17:55:32 +0000 (13:55 -0400)]
efiboot: don't error on unknown type with DEV_ABBREV_ONLY

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoefiboot: Make the device node skipping code pass coverity.
Peter Jones [Thu, 21 Jun 2018 17:33:26 +0000 (13:33 -0400)]
efiboot: Make the device node skipping code pass coverity.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMake the debug() code less intrusive
Peter Jones [Thu, 21 Jun 2018 17:32:28 +0000 (13:32 -0400)]
Make the debug() code less intrusive

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoTry even harder to convince coverity that get_file isn't leaking memory...
Peter Jones [Thu, 21 Jun 2018 16:23:20 +0000 (12:23 -0400)]
Try even harder to convince coverity that get_file isn't leaking memory...

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoPacify clang analyzer just a little.
Peter Jones [Thu, 21 Jun 2018 15:13:39 +0000 (11:13 -0400)]
Pacify clang analyzer just a little.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoIf we can't parse part of the device link, skip it and set DEV_ABBREV_ONLY
Peter Jones [Wed, 20 Jun 2018 21:00:24 +0000 (17:00 -0400)]
If we can't parse part of the device link, skip it and set DEV_ABBREV_ONLY

If we can't parse some part of the device symlink, we can't write a full
device path, but we can write an abbreviated HD() or File() path.  So if
we've exausted all possibilities, skip to the next node, set
DEV_ABBREV_ONLY in the device's flags, and try parsing again.  Then when
creator.c checks if that flag conflicts, it'll throw an error if it
does.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMake a linux device root for SOC devices that use FDT.
Peter Jones [Wed, 20 Jun 2018 20:16:35 +0000 (16:16 -0400)]
Make a linux device root for SOC devices that use FDT.

Add parsing for FDT devices in sysfs.  These devices have to use HD() or
File() because we don't have a way to express FDT nodes in a Device
Path.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMake a way to say "-e 3" isn't viable for a kind of device.
Peter Jones [Wed, 20 Jun 2018 20:16:00 +0000 (16:16 -0400)]
Make a way to say "-e 3" isn't viable for a kind of device.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMake a platform ACPI root parser separate from PCI roots.
Peter Jones [Wed, 20 Jun 2018 18:45:14 +0000 (14:45 -0400)]
Make a platform ACPI root parser separate from PCI roots.

Because apparently PNP0A03 and PNP0A0C weren't good enough.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove ACPI ID parsing to a shared location.
Peter Jones [Wed, 20 Jun 2018 18:43:32 +0000 (14:43 -0400)]
Move ACPI ID parsing to a shared location.

This is getting out of PCI because we have some other platforms that do
ACPI root parsing, but don't use the PCI roots.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoGive linux-*'s ->parse() functions the unmodified device link as well
Peter Jones [Wed, 20 Jun 2018 18:37:14 +0000 (14:37 -0400)]
Give linux-*'s ->parse() functions the unmodified device link as well

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoImprove ACPI device path formatting
Peter Jones [Wed, 20 Jun 2018 18:27:11 +0000 (14:27 -0400)]
Improve ACPI device path formatting

This factors a bunch of the duplication out to another function, which
also does a better job of it.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoFix a makeguids building problem with generics.h.
Peter Jones [Wed, 20 Jun 2018 18:12:42 +0000 (14:12 -0400)]
Fix a makeguids building problem with generics.h.

Guard generics.h with EFIVAR_BUILD_ENVIRONMENT to keep it from
interfering with the makeguids build if libefivar.so isn't around
already.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMake path-helpers.c also import fix_coverity.h
Peter Jones [Thu, 14 Jun 2018 16:15:03 +0000 (12:15 -0400)]
Make path-helpers.c also import fix_coverity.h

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMake efidp_make_file() have even more, better input constraints.
Peter Jones [Wed, 13 Jun 2018 13:25:58 +0000 (09:25 -0400)]
Make efidp_make_file() have even more, better input constraints.

This is all in the effort to convince coverity that it doesn't
dereference buf when size==0, which it already doesn't.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoTry to convince covscan that sysfs_read_file() doesn't leak on error.
Peter Jones [Wed, 13 Jun 2018 13:15:17 +0000 (09:15 -0400)]
Try to convince covscan that sysfs_read_file() doesn't leak on error.

Basically, covscan gets confused about some of our return paths and
doesn't  think the error condition correlates with not having allocated
(or having freed) the ram we're using to pass the file data back.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoPromote _make_hd_dn() to make_hd_dn() and get rid of the wrapper.
Peter Jones [Tue, 12 Jun 2018 18:36:20 +0000 (14:36 -0400)]
Promote _make_hd_dn() to make_hd_dn() and get rid of the wrapper.

The wrapper is just hiding what the code's doing, and all the other code
around where we use it does the same thing anyway.  This hopefully
convinces coverity we're not really dereferencing "buf" there unless
it's nonzero.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoefivar: Fix some types in -L behavior to pacify coverity.
Peter Jones [Tue, 12 Jun 2018 18:36:20 +0000 (14:36 -0400)]
efivar: Fix some types in -L behavior to pacify coverity.

Coverity doesn't realize that efi_well_known_guids is /actually/ an
array, because we didn't tell it so.  So fix the declaration so we've
told it so.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoPacify some coverity nits.
Peter Jones [Tue, 12 Jun 2018 18:36:20 +0000 (14:36 -0400)]
Pacify some coverity nits.

Coverity has trouble tracking data flow sometimes, and believes that
sysfs_readlink() and read_sysfs_file() will sometimes return >= 0 when
the buffer has not been filled out.  This changes the check to also test
for a NULL pointer, hopefully pacifying it.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove verbosity headers to be public
Peter Jones [Tue, 12 Jun 2018 18:36:20 +0000 (14:36 -0400)]
Move verbosity headers to be public

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove the syntastic file I use out of the repo
Peter Jones [Tue, 12 Jun 2018 18:36:20 +0000 (14:36 -0400)]
Move the syntastic file I use out of the repo

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoBump version to 36
Peter Jones [Fri, 8 Jun 2018 19:14:27 +0000 (15:14 -0400)]
Bump version to 36

- Add NVDIMM support
- Re-written linux interface parser to handle how devices are
  partitioned better, and for cleaner code, with one file per device
  type.
- lots of verbosity updates
- better CI
- analysis with clang's analyzer as well as coverity
- Better handling of immutable bits in sysfs
- LIBEFIVAR_OPS=help
- lots of code cleanups.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMake ccc-analyzer get clang cflags
Peter Jones [Fri, 8 Jun 2018 19:04:45 +0000 (15:04 -0400)]
Make ccc-analyzer get clang cflags

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoFix some errors scan-build found.
Peter Jones [Fri, 8 Jun 2018 18:44:24 +0000 (14:44 -0400)]
Fix some errors scan-build found.

This fixes a couple of failures to check for NULL in string parsing, and
one failure to free a value in an error path.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agonvdimm: Use the namespace guid, not just the device guid
Peter Jones [Fri, 8 Jun 2018 17:44:37 +0000 (13:44 -0400)]
nvdimm: Use the namespace guid, not just the device guid

This makes long-form device paths for nvdimm be:

NVDIMM(pmem-namespace-guid)/NVDIMM(pmem-label-guid)/HD(...)/File(...)

It also conditionally removes our UUID swizzling, because nobody can
figure out what the correct encoding is, and only byteswaps if
LIBEFIBOOT_SWIZZLE_PMEM_UUID is set (to any value) in the environment.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoFix an edge case in finding the sysfs driver link
Peter Jones [Fri, 8 Jun 2018 18:06:28 +0000 (14:06 -0400)]
Fix an edge case in finding the sysfs driver link

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoUse the pci node's driver link to detect ATA in some cases
Peter Jones [Thu, 7 Jun 2018 20:19:22 +0000 (16:19 -0400)]
Use the pci node's driver link to detect ATA in some cases

19 months agoefivarfs: fix some minor immutability bugs
Peter Jones [Thu, 7 Jun 2018 20:18:09 +0000 (16:18 -0400)]
efivarfs: fix some minor immutability bugs

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoExpand tabs on the rest of linux.c
Peter Jones [Thu, 7 Jun 2018 17:47:43 +0000 (13:47 -0400)]
Expand tabs on the rest of linux.c

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoAlways build the .so.1 local symlink
Peter Jones [Thu, 7 Jun 2018 16:45:00 +0000 (12:45 -0400)]
Always build the .so.1 local symlink

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoaudit efi_error() for wrong newlines.
Peter Jones [Thu, 7 Jun 2018 16:43:51 +0000 (12:43 -0400)]
audit efi_error() for wrong newlines.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoUpdate our abixml files for new ABI bits and minor changes.
Peter Jones [Wed, 6 Jun 2018 21:52:53 +0000 (17:52 -0400)]
Update our abixml files for new ABI bits and minor changes.

Currently abidiff notices the following:

abidiff \
--suppr abignore \
--headers-dir2 /home/pjones/devel/github.com/efivar/master/src/include/efivar/ \
libefivar.abixml \
libefivar.so
Functions changes summary: 0 Removed, 1 Changed, 3 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

3 Added functions:

  'function FILE* efi_get_logfile()'    {efi_get_logfile@@LIBEFIVAR_1.36}
  'function int efi_get_verbose()'    {efi_get_verbose@@LIBEFIVAR_1.36}
  'function void efi_set_verbose(int, FILE*)'    {efi_set_verbose@@LIBEFIVAR_1.36}

1 function with some indirect sub-type change:

  [C]'function ssize_t efidp_make_acpi_hid_ex(uint8_t*, ssize_t, uint32_t, uint32_t, uint32_t, char*, char*, char*)' at <built-in>:263:1 has some indirect sub-type changes:
    parameter 6 of type 'char*' changed:
      in pointed to type 'char':
        entity changed from 'char' to 'const char'
        type size hasn't changed
    parameter 7 of type 'char*' changed:
      in pointed to type 'char':
        entity changed from 'char' to 'const char'
        type size hasn't changed
    parameter 8 of type 'char*' changed:
      in pointed to type 'char':
        entity changed from 'char' to 'const char'
        type size hasn't changed

The 3 added functions are as they should be.  The
efidp_make_acpi_hid_ex() changes are all from making arguments "const"
that weren't before, and that's fine as well.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoAdd a make target to rebuild our abidw .abixml files
Peter Jones [Wed, 6 Jun 2018 21:37:03 +0000 (17:37 -0400)]
Add a make target to rebuild our abidw .abixml files

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoRebuild efivar-35's abixml files with newer abidw.
Peter Jones [Wed, 6 Jun 2018 21:27:13 +0000 (17:27 -0400)]
Rebuild efivar-35's abixml files with newer abidw.

abidiff is not that good at recognizing its own format changes, so if we
just do the normal abicheck we get a lot of:

  [C]'function ssize_t efidp_make_atapi(uint8_t*, ssize_t, uint16_t, uint16_t, uint16_t)' has some indirect sub-type changes:
    parameter 6 of type 'uint8_t*' was added
    parameter 7 of type 'typedef ssize_t' was added
    parameter 8 of type 'typedef uint16_t' was added
    parameter 9 of type 'typedef uint16_t' was added
    parameter 10 of type 'typedef uint16_t' was added

Which is obviously just plain wrong (efidp_make_atapi()'s arguments have
not changed at all, and it still has only 5 of them.)

So the answer is to re-build efivar-35's .abixml files with newer abidw,
and *then* do abicheck.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agolibefiboot: make everything use "struct device" and kill "struct disk_info"
Peter Jones [Wed, 6 Jun 2018 21:18:31 +0000 (17:18 -0400)]
libefiboot: make everything use "struct device" and kill "struct disk_info"

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agolinux.h: Make some decls HIDDEN as they should be
Peter Jones [Wed, 6 Jun 2018 21:12:58 +0000 (17:12 -0400)]
linux.h: Make some decls HIDDEN as they should be

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoFix decl for get_sector_size()
Peter Jones [Wed, 6 Jun 2018 21:12:16 +0000 (17:12 -0400)]
Fix decl for get_sector_size()

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoConstify efidp_make_acpi_hid_ex() args and make its prototype more readible
Peter Jones [Wed, 6 Jun 2018 21:09:30 +0000 (17:09 -0400)]
Constify efidp_make_acpi_hid_ex() args and make its prototype more readible

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove the PMEM device parser to linux-pmem.c
Peter Jones [Wed, 6 Jun 2018 20:53:37 +0000 (16:53 -0400)]
Move the PMEM device parser to linux-pmem.c

This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoAdd a PCI parser that's independent of the other stuff.
Peter Jones [Wed, 6 Jun 2018 20:51:08 +0000 (16:51 -0400)]
Add a PCI parser that's independent of the other stuff.

This doesn't actually remove the old one, but a later patch will when
it's replacing all that stuff.

This won't actually *work* yet, either, because the infrastructure to
use it (replacing "struct disk_info") won't land for a few more patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove SAS parsing to linux-sas.c
Peter Jones [Wed, 6 Jun 2018 20:47:11 +0000 (16:47 -0400)]
Move SAS parsing to linux-sas.c

This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove SATA parsing to linux-sata.c
Peter Jones [Wed, 6 Jun 2018 20:45:21 +0000 (16:45 -0400)]
Move SATA parsing to linux-sata.c

This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove nvme parsing to linux-nvme.c
Peter Jones [Wed, 6 Jun 2018 20:43:30 +0000 (16:43 -0400)]
Move nvme parsing to linux-nvme.c

This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove virtblk device parsing to linux-virtblk.c
Peter Jones [Wed, 6 Jun 2018 20:41:50 +0000 (16:41 -0400)]
Move virtblk device parsing to linux-virtblk.c

This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove i2o device parsing to linux-i2o.c
Peter Jones [Wed, 6 Jun 2018 20:40:05 +0000 (16:40 -0400)]
Move i2o device parsing to linux-i2o.c

This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove traditional SCSI parsing to linux-scsi.c
Peter Jones [Wed, 6 Jun 2018 20:37:46 +0000 (16:37 -0400)]
Move traditional SCSI parsing to linux-scsi.c

This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove ATA parsing to linux-ata.c
Peter Jones [Wed, 6 Jun 2018 20:32:26 +0000 (16:32 -0400)]
Move ATA parsing to linux-ata.c

This won't actually *work* yet, because the infrastructure to use it
(replacing "struct disk_info") won't land for a few more patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoAdd a (not great) macro to print parser debugging arrows.
Peter Jones [Thu, 7 Jun 2018 17:07:55 +0000 (13:07 -0400)]
Add a (not great) macro to print parser debugging arrows.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoAdd "struct device" in preperation for removing "struct disk_info".
Peter Jones [Wed, 6 Jun 2018 20:15:35 +0000 (16:15 -0400)]
Add "struct device" in preperation for removing "struct disk_info".

Also adds src/linux-*.c to the makefile

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoefi_loadopt_create(): add some debugging
Peter Jones [Wed, 6 Jun 2018 20:55:58 +0000 (16:55 -0400)]
efi_loadopt_create(): add some debugging

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoucs2.h: there's no reason ucs2_to_utf8 shouldn't malloc directly.
Peter Jones [Wed, 30 May 2018 20:59:46 +0000 (16:59 -0400)]
ucs2.h: there's no reason ucs2_to_utf8 shouldn't malloc directly.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agorename the pci_root_info fields to match the struct name
Peter Jones [Tue, 22 May 2018 14:04:52 +0000 (10:04 -0400)]
rename the pci_root_info fields to match the struct name

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMove get_sector_size() to the linux specific code
Peter Jones [Tue, 22 May 2018 13:57:25 +0000 (09:57 -0400)]
Move get_sector_size() to the linux specific code

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agolinux.h: add some more sysfs helpers, and improve their error handling.
Peter Jones [Tue, 22 May 2018 13:55:05 +0000 (09:55 -0400)]
linux.h: add some more sysfs helpers, and improve their error handling.

... this also moves them from util.h

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoMore fixups for CONSTRUCTOR/DESTRUCTOR/HIDDEN/PUBLIC/etc.
Peter Jones [Mon, 21 May 2018 19:53:30 +0000 (15:53 -0400)]
More fixups for CONSTRUCTOR/DESTRUCTOR/HIDDEN/PUBLIC/etc.

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoAdd some helpers for file path mangling
Peter Jones [Mon, 21 May 2018 18:23:52 +0000 (14:23 -0400)]
Add some helpers for file path mangling

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoutil.h: Add error reporting in read_file()
Peter Jones [Mon, 21 May 2018 15:18:00 +0000 (11:18 -0400)]
util.h: Add error reporting in read_file()

Signed-off-by: Peter Jones <pjones@redhat.com>
19 months agoTemporary hack in get_partition_number
Peter Jones [Wed, 6 Jun 2018 20:30:08 +0000 (16:30 -0400)]
Temporary hack in get_partition_number

This code has been wrong for a while, but it's getting removed, so
really don't bother *fixing* it so much as appeasing newer gcc's
noticing that it's uninitialized.

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoMake LIBEFIVAR_OPS=help work
Peter Jones [Mon, 21 May 2018 13:40:01 +0000 (09:40 -0400)]
Make LIBEFIVAR_OPS=help work

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoAdd some more debug facilities.
Peter Jones [Thu, 26 Apr 2018 19:57:48 +0000 (15:57 -0400)]
Add some more debug facilities.

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoAdd hexdumper
Peter Jones [Thu, 26 Apr 2018 19:05:38 +0000 (15:05 -0400)]
Add hexdumper

20 months agoMake all of our Make.* files have vim:ft=make
Peter Jones [Mon, 21 May 2018 14:08:55 +0000 (10:08 -0400)]
Make all of our Make.* files have vim:ft=make

... except Make.version because it's fully automated.

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agofix some dumb stuff in 'make install' targets
Peter Jones [Mon, 21 May 2018 13:53:15 +0000 (09:53 -0400)]
fix some dumb stuff in 'make install' targets

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agogpt.h: minor cleanups (mostly formatting/whitespace)
Peter Jones [Fri, 18 May 2018 17:23:01 +0000 (13:23 -0400)]
gpt.h: minor cleanups (mostly formatting/whitespace)

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoget_partition_info(): fix the return code error path.
Peter Jones [Wed, 18 Apr 2018 21:47:26 +0000 (17:47 -0400)]
get_partition_info(): fix the return code error path.

Half the code thinks >= 0 is success, half the code things <= 0 is
success...

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoclang: ?e64_to_cpu() and cpu_to_?e64(): cast to uint64_t.
Peter Jones [Thu, 17 May 2018 21:57:10 +0000 (17:57 -0400)]
clang: ?e64_to_cpu() and cpu_to_?e64(): cast to uint64_t.

On x86_64, clang makes __builtin_bswap64() return "unsigned long"
instead of "unsigned long long", so using PRIx64 complains all over the
place.  Casting to uint64_t satisfies both compilers.

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoMore aggressively use macros for compiler attributes
Peter Jones [Thu, 17 May 2018 20:37:57 +0000 (16:37 -0400)]
More aggressively use macros for compiler attributes

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoSimplify our include files
Peter Jones [Thu, 17 May 2018 20:31:59 +0000 (16:31 -0400)]
Simplify our include files

Make everything just include src/efivar.h or src/efiboot.h, and let
those sort out the correct things to include.

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoutil.h: whitespace cleanup
Peter Jones [Thu, 19 Apr 2018 14:25:16 +0000 (10:25 -0400)]
util.h: whitespace cleanup

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agogpt: get rid of ad-hoc warning reporting; use efi_error()
Peter Jones [Wed, 18 Apr 2018 21:46:45 +0000 (17:46 -0400)]
gpt: get rid of ad-hoc warning reporting; use efi_error()

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agogpt: don't use the __ versions of cpu_to_le??()/le??_to_cpu()
Peter Jones [Thu, 17 May 2018 20:34:49 +0000 (16:34 -0400)]
gpt: don't use the __ versions of cpu_to_le??()/le??_to_cpu()

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoefivar: fix efi_well_known_guids and efi_well_known_guids_end definitions
Peter Jones [Thu, 17 May 2018 19:10:40 +0000 (15:10 -0400)]
efivar: fix efi_well_known_guids and efi_well_known_guids_end definitions

From github:

build command: make CROSS_COMPILE=aarch64-linux-gnu- prefix=/home/b58867/Desktop/ls1043ardb/efivar/efivar_arm64 static

compilation error:
aarch64-linux-gnu-gcc -O2 -flto -g3 -I/home/b58867/Desktop/ls1043ardb/efivar/src/include/ -specs=/home/b58867/Desktop/ls1043ardb/efivar/gcc.specs -L. -Wl,-z,muldefs -static -o efivar-static efivar.c dp.static.o dp-acpi.static.o dp-hw.static.o dp-media.static.o dp-message.static.o efivarfs.static.o error.static.o export.static.o guid.static.o guids.static.o guid-symbols.static.o lib.static.o vars.static.o -ldl
guid.c:112:24: error: type of ‘efi_well_known_guids_end’ does not match original declaration [-Werror]
extern struct guidname efi_well_known_guids_end
^
efivar.c:490:28: note: previously declared here
extern struct guidname *efi_well_known_guids_end;
^
efivar.c:489:27: error: type of ‘efi_well_known_guids’ does not match original declaration [-Werror]
extern struct guidname efi_well_known_guids[];
^
guid.c:108:24: note: previously declared here
extern struct guidname efi_well_known_guids
^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: aarch64-linux-gnu-gcc returned 1 exit status

Fixes github issue #102

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoFix our pkg-config-ldflags invocation.
Peter Jones [Wed, 18 Apr 2018 21:44:22 +0000 (17:44 -0400)]
Fix our pkg-config-ldflags invocation.

Signed-off-by: Peter Jones <pjones@redhat.com>
20 months agoWe don't use list.h at all; axe it.
Peter Jones [Wed, 9 May 2018 20:14:52 +0000 (16:14 -0400)]
We don't use list.h at all; axe it.

Signed-off-by: Peter Jones <pjones@redhat.com>