if (!isdigit (dm_name[n]))
break;
}
- if (n < 0 || dm_name[n] != 'p')
+ /* if we have a partition, set partition number and parent device */
+ if (n > 0 && dm_name[n] == 'p')
{
- g_printerr ("DM_NAME=`%s' is malformed (expected <name>p<number>)\n", dm_name);
- goto out;
- }
- partition_number = atoi (dm_name + n + 1);
- if (partition_number < 1)
- {
- g_printerr ("Error determining partition number from DM_NAME=`%s'\n", dm_name);
- goto out;
- }
+ partition_number = atoi (dm_name + n + 1);
+ if (partition_number < 1)
+ {
+ g_printerr ("Error determining partition number from DM_NAME=`%s'\n", dm_name);
+ goto out;
+ }
- ret = g_strdup (udev_device_get_devnode (mp_device));
- offset = offset_sectors * 512;
+ ret = g_strdup (udev_device_get_devnode (mp_device));
+ offset = offset_sectors * 512;
- partition_table_syspath = g_strdup (udev_device_get_syspath (mp_device));
+ partition_table_syspath = g_strdup (udev_device_get_syspath (mp_device));
- udev_device_unref (mp_device);
- g_free (targets_params);
+ udev_device_unref (mp_device);
+ g_free (targets_params);
- /* TODO: set alignment_offset */
+ /* TODO: set alignment_offset */
- goto out;
+ goto out;
+ }
}
}
g_free (targets_params);
self.assertEqual(dev_p.Get(I_D, 'DeviceFile'), devname)
self.assertEqual(dev_p.Get(I_D, 'DeviceIsPartition'), False)
- # TODO: hmm, these fail.. bug?
- #self.assertEqual(dev_p.Get(I_D, 'DeviceIsPartitionTable'), True)
- #self.assertEqual(dev_p.Get(I_D, 'PartitionScheme'), 'mbr')
+ self.assertEqual(dev_p.Get(I_D, 'PartitionScheme'), '')
+ self.assertEqual(dev_p.Get(I_D, 'DeviceIsPartitionTable'), True)
+ self.assertEqual(dev_p.Get(I_D, 'PartitionTableScheme'), 'mbr')
# partition 1 properties
p1_obj = dbus.SystemBus().get_object('org.freedesktop.UDisks',