Copy from home:puzel:branches:Base:System/parted via accept of submit request 36773 revision 8. Request was accepted with message: OBS-URL: https://build.opensuse.org/request/show/36773 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=19
71 lines
1.8 KiB
Diff
71 lines
1.8 KiB
Diff
Index: parted-1.9.0/libparted/arch/linux.c
|
|
===================================================================
|
|
--- parted-1.9.0.orig/libparted/arch/linux.c 2009-10-07 14:14:58.000000000 +0200
|
|
+++ parted-1.9.0/libparted/arch/linux.c 2009-10-07 14:22:58.000000000 +0200
|
|
@@ -30,6 +30,7 @@
|
|
#include <stdio.h>
|
|
#include <syscall.h>
|
|
#include <unistd.h>
|
|
+#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <dirent.h>
|
|
#include <sys/ioctl.h>
|
|
@@ -2551,29 +2552,41 @@ err:
|
|
static int
|
|
_dm_reread_part_table (PedDisk* disk)
|
|
{
|
|
- int largest_partnum = ped_disk_get_last_partition_num (disk);
|
|
- if (largest_partnum <= 0)
|
|
- return 1;
|
|
-
|
|
- int rc = 1;
|
|
- int last = PED_MIN (largest_partnum, 16);
|
|
- int i;
|
|
+ int dev_minor;
|
|
+ int dev_major;
|
|
+ struct stat dev_stat;
|
|
+ char name_buf[40];
|
|
+ FILE* f;
|
|
|
|
sync();
|
|
if (!_dm_remove_parts(disk->dev))
|
|
- rc = 0;
|
|
+ return 0;
|
|
|
|
- for (i = 1; i <= last; i++) {
|
|
- PedPartition* part;
|
|
+ /* Issue uevent for the device */
|
|
+ if (!_device_stat (disk->dev, &dev_stat))
|
|
+ return 0;
|
|
|
|
- part = ped_disk_get_partition (disk, i);
|
|
- if (!part)
|
|
- continue;
|
|
+ dev_major = major (dev_stat.st_rdev);
|
|
+ dev_minor = minor (dev_stat.st_rdev);
|
|
|
|
- if (!_dm_add_partition (disk, part))
|
|
- rc = 0;
|
|
+ snprintf (name_buf, sizeof (name_buf),
|
|
+ "/sys/dev/block/%d:%d/uevent", dev_major, dev_minor);
|
|
+
|
|
+ if ((f = fopen (name_buf, "w")) == NULL)
|
|
+ return 0;
|
|
+
|
|
+ if (fputs ("change", f) == EOF)
|
|
+ return 0;
|
|
+
|
|
+ fclose(f);
|
|
+
|
|
+ /* Wait for udev to finish */
|
|
+ if (system ("/sbin/udevadm settle --timeout=20") != 0) {
|
|
+ /* udevadm settle failed - let's sleep for a while */
|
|
+ sleep (2);
|
|
}
|
|
- return rc;
|
|
+
|
|
+ return 1;
|
|
}
|
|
#endif
|
|
|