diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-08-09 22:49:15 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-08-09 22:49:15 +0200 |
commit | b347df91317ca05910e930c94fdba30baf9e2de8 (patch) | |
tree | d7d035a1708ed90f2103bbe9c8e92d52ff4a1d2f /util-linux | |
parent | a6367f9faec0f8736f6ff92fbda5c19d4cbc384e (diff) | |
download | busybox-w32-b347df91317ca05910e930c94fdba30baf9e2de8.tar.gz busybox-w32-b347df91317ca05910e930c94fdba30baf9e2de8.tar.bz2 busybox-w32-b347df91317ca05910e930c94fdba30baf9e2de8.zip |
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/fdisk.c | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 976558693..c0be15a3a 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
@@ -201,6 +201,7 @@ enum action { OPEN_MAIN, TRY_ONLY, CREATE_EMPTY_DOS, CREATE_EMPTY_SUN }; | |||
201 | static void update_units(void); | 201 | static void update_units(void); |
202 | #if ENABLE_FEATURE_FDISK_WRITABLE | 202 | #if ENABLE_FEATURE_FDISK_WRITABLE |
203 | static void change_units(void); | 203 | static void change_units(void); |
204 | static void reread_partition_table(int leave); | ||
204 | static void delete_partition(int i); | 205 | static void delete_partition(int i); |
205 | static unsigned get_partition(int warn, unsigned max); | 206 | static unsigned get_partition(int warn, unsigned max); |
206 | static void list_types(const char *const *sys); | 207 | static void list_types(const char *const *sys); |
@@ -2542,6 +2543,35 @@ new_partition(void) | |||
2542 | } | 2543 | } |
2543 | 2544 | ||
2544 | static void | 2545 | static void |
2546 | reread_partition_table(int leave) | ||
2547 | { | ||
2548 | int i; | ||
2549 | |||
2550 | printf("Calling ioctl() to re-read partition table\n"); | ||
2551 | sync(); | ||
2552 | /* Users with slow external USB disks on a 320MHz ARM system (year 2011) | ||
2553 | * report that sleep is needed, otherwise BLKRRPART may fail with -EIO: | ||
2554 | */ | ||
2555 | sleep(1); | ||
2556 | i = ioctl_or_perror(dev_fd, BLKRRPART, NULL, | ||
2557 | "WARNING: rereading partition table " | ||
2558 | "failed, kernel still uses old table"); | ||
2559 | #if 0 | ||
2560 | if (dos_changed) | ||
2561 | printf( | ||
2562 | "\nWARNING: If you have created or modified any DOS 6.x\n" | ||
2563 | "partitions, please see the fdisk manual page for additional\n" | ||
2564 | "information\n"); | ||
2565 | #endif | ||
2566 | |||
2567 | if (leave) { | ||
2568 | if (ENABLE_FEATURE_CLEAN_UP) | ||
2569 | close_dev_fd(); | ||
2570 | exit(i != 0); | ||
2571 | } | ||
2572 | } | ||
2573 | |||
2574 | static void | ||
2545 | write_table(void) | 2575 | write_table(void) |
2546 | { | 2576 | { |
2547 | int i; | 2577 | int i; |
@@ -2571,30 +2601,8 @@ write_table(void) | |||
2571 | } | 2601 | } |
2572 | } | 2602 | } |
2573 | 2603 | ||
2574 | printf( | 2604 | printf("The partition table has been altered.\n"); |
2575 | "The partition table has been altered.\n" | 2605 | reread_partition_table(1); |
2576 | "Calling ioctl(BLKRRPART) to re-read partition table.\n" | ||
2577 | ); | ||
2578 | |||
2579 | sync(); | ||
2580 | /* Users with slow external USB disks on a 320MHz ARM system (year 2011) | ||
2581 | * report that sleep is needed, otherwise BLKRRPART may fail with -EIO: | ||
2582 | */ | ||
2583 | sleep(1); | ||
2584 | i = ioctl_or_perror(dev_fd, BLKRRPART, NULL, | ||
2585 | "WARNING: rereading partition table " | ||
2586 | "failed, kernel still uses old table"); | ||
2587 | #if 0 | ||
2588 | if (dos_changed) | ||
2589 | printf( | ||
2590 | "\nWARNING: If you have created or modified any DOS 6.x\n" | ||
2591 | "partitions, please see the fdisk manual page for additional\n" | ||
2592 | "information\n"); | ||
2593 | #endif | ||
2594 | |||
2595 | if (ENABLE_FEATURE_CLEAN_UP) | ||
2596 | close_dev_fd(); | ||
2597 | exit(i != 0); | ||
2598 | } | 2606 | } |
2599 | #endif /* FEATURE_FDISK_WRITABLE */ | 2607 | #endif /* FEATURE_FDISK_WRITABLE */ |
2600 | 2608 | ||