HAL feature request: repoll partition table
Paul Betts
paul.betts at gmail.com
Fri Feb 23 10:54:07 PST 2007
One of the things that needs to be thought about (and it should be
pretty easy) is that HAL needs to be able to signal the kernel to repoll
the partitions when it formats stuff. Here's the relevant code from
parted, basically you send an ioctl to the block device.
static int
_kernel_reread_part_table (PedDevice* dev)
{
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
int retry_count = 5;
sync();
while (ioctl (arch_specific->fd, BLKRRPART)) {
retry_count--;
sync();
if (!retry_count) {
ped_exception_throw (
PED_EXCEPTION_WARNING,
PED_EXCEPTION_IGNORE,
_("The kernel was unable to re-read the partition "
"table on %s (%s). This means Linux won't know "
"anything about the modifications you made "
"until you reboot. You should reboot your computer "
"before doing anything with %s."),
dev->path, strerror (errno), dev->path);
return 0;
}
}
return 1;
}
--
Paul Betts <Paul.Betts at Gmail.com>
More information about the hal
mailing list