Use blkid instead of libparted to determine number of partitions.
This CL removes the libparted depedency by using blkid to determine the
number partitions of a device. It also modifies the code to consider the
total number of partitions, not just the number of primary partitions,
when determining if a device has no partitions.
BUG=chromium:343836
TEST=Tested the following cases on Link:
1. Build and run unit tests.
2. Run platform_CrosDisksFilesystem test.
3. Insert a formatted USB drive with no partitions and verify that
the org.chromium.CrosDisks.EnumerateAutoMountableDevices DBus method
reports /dev/sdb (assuming that /dev/sdb is assigned to the inserted
USB).
4. Insert a formatted USB drive with one partition and verify that
the org.chromium.CrosDisks.EnumerateAutoMountableDevices DBus method
reports /dev/sdb1, but not /dev/sdb.
5. Insert a formatted USB drive with multiple partitions and verify
that the org.chromium.CrosDisks.EnumerateAutoMountableDevices DBus
method reports /dev/sdb1, /dev/sdb2, etc, but not /dev/sdb.
Change-Id: I80723eb61b706e50ff102ce4654d970bc5abe072
Reviewed-on: https://chromium-review.googlesource.com/186499
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
4 files changed