{ ".", sizeof (".") - 1 },
{ "..", sizeof ("..") - 1 },
{ "dm-", sizeof ("dm-") - 1 },
- { "md", sizeof ("md") - 1 },
{ "loop", sizeof ("loop") - 1 },
{ "ram", sizeof ("ram") - 1 },
{ 0, 0 },
}
static int
+_has_partitions (const PedDisk* disk)
+{
+ PED_ASSERT(disk != NULL, return 0);
+
+ /* Some devices can't be partitioned. */
+ if (!strcmp (disk->type->name, "loop"))
+ return 0;
+
+ return 1;
+}
+
+static int
linux_partition_is_busy (const PedPartition* part)
{
PedPartition* walk;
PED_ASSERT(disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0,
return 0);
+ if (!_has_partitions (disk))
+ return 0;
+
if (ped_disk_type_check_feature (disk->type,
PED_DISK_TYPE_PARTITION_NAME))
vol_name = ped_partition_get_name (part);
{
struct blkpg_partition linux_part;
+ if (!_has_partitions (disk))
+ return 0;
+
memset (&linux_part, 0, sizeof (linux_part));
linux_part.pno = n;
return _blkpg_part_command (disk->dev, &linux_part,
char* dev_name = NULL;
char* params = NULL;
+ if (!_has_partitions(disk))
+ return 0;
+
dev_name = _device_get_part_path (disk->dev, part->num);
if (!dev_name)
return 0;
static int
linux_disk_commit (PedDisk* disk)
{
+ if (!_has_partitions (disk))
+ return 1;
+
#ifdef ENABLE_DEVICE_MAPPER
if (disk->dev->type == PED_DEVICE_DM)
return _dm_reread_part_table (disk);