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
tree: caa212889f4b29247625583b8a07a1cfa6dc5dfb
  1. dbus_bindings/
  2. .gitignore
  3. archive_manager.cc
  4. archive_manager.h
  5. archive_manager_unittest.cc
  6. avfsd-seccomp-amd64.policy
  7. avfsd-seccomp-arm.policy
  8. avfsd-seccomp-x86.policy
  9. cros-disks.conf
  10. cros-disks.gyp
  11. cros_disks_server.cc
  12. cros_disks_server.h
  13. daemon.cc
  14. daemon.h
  15. device_ejector.cc
  16. device_ejector.h
  17. device_event.cc
  18. device_event.h
  19. device_event_dispatcher_interface.h
  20. device_event_moderator.cc
  21. device_event_moderator.h
  22. device_event_moderator_unittest.cc
  23. device_event_queue.cc
  24. device_event_queue.h
  25. device_event_queue_unittest.cc
  26. device_event_source_interface.h
  27. disk.cc
  28. disk.h
  29. disk_manager.cc
  30. disk_manager.h
  31. disk_manager_unittest.cc
  32. disk_unittest.cc
  33. disks_testrunner.cc
  34. exfat_mounter.cc
  35. exfat_mounter.h
  36. external_mounter.cc
  37. external_mounter.h
  38. external_mounter_unittest.cc
  39. file_reader.cc
  40. file_reader.h
  41. file_reader_unittest.cc
  42. filesystem.cc
  43. filesystem.h
  44. format_manager.cc
  45. format_manager.h
  46. format_manager_observer_interface.h
  47. format_manager_unittest.cc
  48. fuse_mounter.cc
  49. fuse_mounter.h
  50. glib_process.cc
  51. glib_process.h
  52. glib_process_unittest.cc
  53. inherit-review-settings-ok
  54. LICENSE
  55. main.cc
  56. metrics.cc
  57. metrics.h
  58. metrics_unittest.cc
  59. mount_info.cc
  60. mount_info.h
  61. mount_info_unittest.cc
  62. mount_manager.cc
  63. mount_manager.h
  64. mount_manager_unittest.cc
  65. mount_options.cc
  66. mount_options.h
  67. mount_options_unittest.cc
  68. mounter.cc
  69. mounter.h
  70. mounter_unittest.cc
  71. ntfs_mounter.cc
  72. ntfs_mounter.h
  73. org.chromium.CrosDisks.conf
  74. OWNERS
  75. platform.cc
  76. platform.h
  77. platform_unittest.cc
  78. process.cc
  79. process.h
  80. process_unittest.cc
  81. sandboxed_process.cc
  82. sandboxed_process.h
  83. session_manager_observer_interface.h
  84. session_manager_proxy.cc
  85. session_manager_proxy.h
  86. system_mounter.cc
  87. system_mounter.h
  88. system_mounter_unittest.cc
  89. udev_device.cc
  90. udev_device.h
  91. udev_device_unittest.cc
  92. usb-device-info
  93. usb_device_info.cc
  94. usb_device_info.h
  95. usb_device_info_unittest.cc