Fix code to search for MMC device

The findDevice() function is broken currently because it's looking for a
device in sysfs with the name of mmcblk*. The problem is that the boot
partitions are also showing up in sysfs (mmcblk0boot0 and mmcblk0boot1),
and the findDevice() function is getting confused.

Instead of relying on the name of the device to find the MMC device, we
now look at the following entry in sysfs, to make sure we found an MMC
device:

/sys/block/<dev_name>/device/type

The contents of that file should be MMC.

Tested:
Ran eStoraged on a machine to confirm that it created a D-Bus object
with the mmcblk0 device, instead of mmcblk0boot0.
$ busctl tree xyz.openbmc_project.eStoraged
`-/xyz
  `-/xyz/openbmc_project
    `-/xyz/openbmc_project/inventory
      `-/xyz/openbmc_project/inventory/storage
        `-/xyz/openbmc_project/inventory/storage/mmcblk0

Signed-off-by: John Wedig <johnwedig@google.com>
Change-Id: I786934fcdc950b55c62bc7e3784e29d5ba73099f
2 files changed
tree: 40925210ee2b592e298380a379f65f0e03f29a68
  1. include/
  2. service_files/
  3. src/
  4. subprojects/
  5. .clang-format
  6. .clang-tidy
  7. .gitignore
  8. LICENSE
  9. MAINTAINERS
  10. meson.build
  11. meson_options.txt
  12. OWNERS
  13. README.md
README.md

eStoraged

This daemon serves as an abstraction for an encrypted storage device, encapsulating the security functionality and providing a D-Bus interface to manage the encrypted filesystem on the device. Using the D-Bus interface, other software components can interact with eStoraged to do things like create a new encrypted filesystem, wipe its contents, lock/unlock the device, or change the password.