aboutsummaryrefslogtreecommitdiff
path: root/util-linux/fdisk.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-10-07 22:42:45 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-10-07 22:42:45 +0200
commitd60752f8c9be5689a249ad518deb38061d4bc45e (patch)
tree06df5c7e22be59561cbbcd22eb63ff95344fe321 /util-linux/fdisk.c
parent8c0708a329618b20089eb9cedbe06522dd25d9be (diff)
downloadbusybox-w32-d60752f8c9be5689a249ad518deb38061d4bc45e.tar.gz
busybox-w32-d60752f8c9be5689a249ad518deb38061d4bc45e.tar.bz2
busybox-w32-d60752f8c9be5689a249ad518deb38061d4bc45e.zip
build system: -fno-builtin-printf
Benefits are: drops reference to out-of-line putchar(), fixes a few cases of failed string merge. function old new delta i2cdump_main 1488 1502 +14 sha256_process_block64 423 433 +10 sendmail_main 1183 1185 +2 list_table 1114 1116 +2 i2cdetect_main 1235 1237 +2 fdisk_main 2852 2854 +2 builtin_type 119 121 +2 unicode_conv_to_printable2 325 324 -1 scan_recursive 380 378 -2 mkfs_minix_main 2687 2684 -3 buffer_fill_and_print 178 169 -9 putchar 152 - -152 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 7/4 up/down: 34/-167) Total: -133 bytes text data bss dec hex filename 937788 932 17676 956396 e97ec busybox_old 937564 932 17676 956172 e970c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/fdisk.c')
-rw-r--r--util-linux/fdisk.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 7fe70fb72..f49ce95a4 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -1102,11 +1102,11 @@ warn_geometry(void)
1102 printf(" sectors"); 1102 printf(" sectors");
1103 if (!g_cylinders) 1103 if (!g_cylinders)
1104 printf(" cylinders"); 1104 printf(" cylinders");
1105 printf(
1106#if ENABLE_FEATURE_FDISK_WRITABLE 1105#if ENABLE_FEATURE_FDISK_WRITABLE
1107 " (settable in the extra functions menu)" 1106 puts(" (settable in the extra functions menu)");
1107#else
1108 bb_putchar('\n');
1108#endif 1109#endif
1109 "\n");
1110 return 1; 1110 return 1;
1111} 1111}
1112 1112
@@ -1150,7 +1150,7 @@ read_extended(int ext)
1150 1150
1151 p = pex->part_table; 1151 p = pex->part_table;
1152 if (!get_start_sect(p)) { 1152 if (!get_start_sect(p)) {
1153 printf("Bad offset in primary extended partition\n"); 1153 puts("Bad offset in primary extended partition");
1154 return; 1154 return;
1155 } 1155 }
1156 1156
@@ -1450,8 +1450,8 @@ static int get_boot(void)
1450 current_label_type = LABEL_OSF; 1450 current_label_type = LABEL_OSF;
1451 return 0; 1451 return 0;
1452 } 1452 }
1453 printf("This disk has both DOS and BSD magic.\n" 1453 puts("This disk has both DOS and BSD magic.\n"
1454 "Give the 'b' command to go to BSD mode.\n"); 1454 "Give the 'b' command to go to BSD mode.");
1455 } 1455 }
1456#endif 1456#endif
1457 1457
@@ -1461,9 +1461,9 @@ static int get_boot(void)
1461#else 1461#else
1462 if (!valid_part_table_flag(MBRbuffer)) { 1462 if (!valid_part_table_flag(MBRbuffer)) {
1463 if (what == OPEN_MAIN) { 1463 if (what == OPEN_MAIN) {
1464 printf("Device contains neither a valid DOS " 1464 puts("Device contains neither a valid DOS "
1465 "partition table, nor Sun, SGI, OSF or GPT " 1465 "partition table, nor Sun, SGI, OSF or GPT "
1466 "disklabel\n"); 1466 "disklabel");
1467#ifdef __sparc__ 1467#ifdef __sparc__
1468 IF_FEATURE_SUN_LABEL(create_sunlabel();) 1468 IF_FEATURE_SUN_LABEL(create_sunlabel();)
1469#else 1469#else
@@ -1596,7 +1596,7 @@ read_int(sector_t low, sector_t dflt, sector_t high, sector_t base, const char *
1596 } 1596 }
1597 if (value >= low && value <= high) 1597 if (value >= low && value <= high)
1598 break; 1598 break;
1599 printf("Value is out of range\n"); 1599 puts("Value is out of range");
1600 } 1600 }
1601 return value; 1601 return value;
1602} 1602}
@@ -1641,7 +1641,7 @@ get_existing_partition(int warn, unsigned max)
1641 printf("Selected partition %u\n", pno+1); 1641 printf("Selected partition %u\n", pno+1);
1642 return pno; 1642 return pno;
1643 } 1643 }
1644 printf("No partition is defined yet!\n"); 1644 puts("No partition is defined yet!");
1645 return -1; 1645 return -1;
1646 1646
1647 not_unique: 1647 not_unique:
@@ -1668,7 +1668,7 @@ get_nonexisting_partition(int warn, unsigned max)
1668 printf("Selected partition %u\n", pno+1); 1668 printf("Selected partition %u\n", pno+1);
1669 return pno; 1669 return pno;
1670 } 1670 }
1671 printf("All primary partitions have been defined already!\n"); 1671 puts("All primary partitions have been defined already!");
1672 return -1; 1672 return -1;
1673 1673
1674 not_unique: 1674 not_unique:
@@ -1703,10 +1703,10 @@ toggle_dos_compatibility_flag(void)
1703 dos_compatible_flag = 1 - dos_compatible_flag; 1703 dos_compatible_flag = 1 - dos_compatible_flag;
1704 if (dos_compatible_flag) { 1704 if (dos_compatible_flag) {
1705 sector_offset = g_sectors; 1705 sector_offset = g_sectors;
1706 printf("DOS Compatibility flag is set\n"); 1706 printf("DOS Compatibility flag is %sset\n", "");
1707 } else { 1707 } else {
1708 sector_offset = 1; 1708 sector_offset = 1;
1709 printf("DOS Compatibility flag is not set\n"); 1709 printf("DOS Compatibility flag is %sset\n", "not ");
1710 } 1710 }
1711} 1711}
1712 1712
@@ -1813,16 +1813,16 @@ change_sysid(void)
1813 sys = read_hex(get_sys_types()); 1813 sys = read_hex(get_sys_types());
1814 1814
1815 if (!sys && !LABEL_IS_SGI && !LABEL_IS_SUN) { 1815 if (!sys && !LABEL_IS_SGI && !LABEL_IS_SUN) {
1816 printf("Type 0 means free space to many systems\n" 1816 puts("Type 0 means free space to many systems\n"
1817 "(but not to Linux). Having partitions of\n" 1817 "(but not to Linux). Having partitions of\n"
1818 "type 0 is probably unwise.\n"); 1818 "type 0 is probably unwise.");
1819 /* break; */ 1819 /* break; */
1820 } 1820 }
1821 1821
1822 if (!LABEL_IS_SUN && !LABEL_IS_SGI) { 1822 if (!LABEL_IS_SUN && !LABEL_IS_SGI) {
1823 if (IS_EXTENDED(sys) != IS_EXTENDED(p->sys_ind)) { 1823 if (IS_EXTENDED(sys) != IS_EXTENDED(p->sys_ind)) {
1824 printf("You cannot change a partition into" 1824 puts("You cannot change a partition into"
1825 " an extended one or vice versa\n"); 1825 " an extended one or vice versa");
1826 break; 1826 break;
1827 } 1827 }
1828 } 1828 }
@@ -1830,10 +1830,10 @@ change_sysid(void)
1830 if (sys < 256) { 1830 if (sys < 256) {
1831#if ENABLE_FEATURE_SUN_LABEL 1831#if ENABLE_FEATURE_SUN_LABEL
1832 if (LABEL_IS_SUN && i == 2 && sys != SUN_WHOLE_DISK) 1832 if (LABEL_IS_SUN && i == 2 && sys != SUN_WHOLE_DISK)
1833 printf("Consider leaving partition 3 " 1833 puts("Consider leaving partition 3 "
1834 "as Whole disk (5),\n" 1834 "as Whole disk (5),\n"
1835 "as SunOS/Solaris expects it and " 1835 "as SunOS/Solaris expects it and "
1836 "even Linux likes it\n\n"); 1836 "even Linux likes it\n");
1837#endif 1837#endif
1838#if ENABLE_FEATURE_SGI_LABEL 1838#if ENABLE_FEATURE_SGI_LABEL
1839 if (LABEL_IS_SGI && 1839 if (LABEL_IS_SGI &&
@@ -1842,10 +1842,10 @@ change_sysid(void)
1842 (i == 8 && sys != 0) 1842 (i == 8 && sys != 0)
1843 ) 1843 )
1844 ) { 1844 ) {
1845 printf("Consider leaving partition 9 " 1845 puts("Consider leaving partition 9 "
1846 "as volume header (0),\nand " 1846 "as volume header (0),\nand "
1847 "partition 11 as entire volume (6)" 1847 "partition 11 as entire volume (6)"
1848 "as IRIX expects it\n\n"); 1848 "as IRIX expects it\n");
1849 } 1849 }
1850#endif 1850#endif
1851 if (sys == origsys) 1851 if (sys == origsys)
@@ -2067,7 +2067,7 @@ fix_partition_table_order(void)
2067 int i,k; 2067 int i,k;
2068 2068
2069 if (!wrong_p_order(NULL)) { 2069 if (!wrong_p_order(NULL)) {
2070 printf("Ordering is already correct\n\n"); 2070 puts("Ordering is already correct\n");
2071 return; 2071 return;
2072 } 2072 }
2073 2073
@@ -2095,7 +2095,7 @@ fix_partition_table_order(void)
2095 if (i) 2095 if (i)
2096 fix_chain_of_logicals(); 2096 fix_chain_of_logicals();
2097 2097
2098 printf("Done.\n"); 2098 puts("Done");
2099} 2099}
2100#endif 2100#endif
2101 2101
@@ -2178,7 +2178,7 @@ list_table(int xtra)
2178 * if this is a sgi, sun or aix labeled disk... */ 2178 * if this is a sgi, sun or aix labeled disk... */
2179 if (LABEL_IS_DOS && wrong_p_order(NULL)) { 2179 if (LABEL_IS_DOS && wrong_p_order(NULL)) {
2180 /* FIXME */ 2180 /* FIXME */
2181 printf("\nPartition table entries are not in disk order\n"); 2181 puts("\nPartition table entries are not in disk order");
2182 } 2182 }
2183} 2183}
2184 2184
@@ -2192,7 +2192,7 @@ x_list_table(int extend)
2192 2192
2193 printf("\nDisk %s: %u heads, %u sectors, %u cylinders\n\n", 2193 printf("\nDisk %s: %u heads, %u sectors, %u cylinders\n\n",
2194 disk_device, g_heads, g_sectors, g_cylinders); 2194 disk_device, g_heads, g_sectors, g_cylinders);
2195 printf("Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n"); 2195 puts("Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID");
2196 for (i = 0; i < g_partitions; i++) { 2196 for (i = 0; i < g_partitions; i++) {
2197 pe = &ptes[i]; 2197 pe = &ptes[i];
2198 p = (extend ? pe->ext_pointer : pe->part_table); 2198 p = (extend ? pe->ext_pointer : pe->part_table);
@@ -2419,7 +2419,7 @@ add_partition(int n, int sys)
2419 limit = first[i] - 1; 2419 limit = first[i] - 1;
2420 } 2420 }
2421 if (start > limit) { 2421 if (start > limit) {
2422 printf("No free sectors available\n"); 2422 puts("No free sectors available");
2423 if (n > 4) 2423 if (n > 4)
2424 g_partitions--; 2424 g_partitions--;
2425 return; 2425 return;
@@ -2490,9 +2490,9 @@ new_partition(void)
2490 return; 2490 return;
2491 } 2491 }
2492 if (LABEL_IS_AIX) { 2492 if (LABEL_IS_AIX) {
2493 printf("Sorry - this fdisk cannot handle AIX disk labels.\n" 2493 puts("Sorry - this fdisk cannot handle AIX disk labels.\n"
2494"If you want to add DOS-type partitions, create a new empty DOS partition\n" 2494"If you want to add DOS-type partitions, create a new empty DOS partition\n"
2495"table first (use 'o'). This will destroy the present disk contents.\n"); 2495"table first (use 'o'). This will destroy the present disk contents.");
2496 return; 2496 return;
2497 } 2497 }
2498 2498
@@ -2500,7 +2500,7 @@ new_partition(void)
2500 free_primary += !ptes[i].part_table->sys_ind; 2500 free_primary += !ptes[i].part_table->sys_ind;
2501 2501
2502 if (!free_primary && g_partitions >= MAXIMUM_PARTS) { 2502 if (!free_primary && g_partitions >= MAXIMUM_PARTS) {
2503 printf("The maximum number of partitions has been created\n"); 2503 puts("The maximum number of partitions has been created");
2504 return; 2504 return;
2505 } 2505 }
2506 2506
@@ -2508,8 +2508,8 @@ new_partition(void)
2508 if (extended_offset) 2508 if (extended_offset)
2509 add_logical(); 2509 add_logical();
2510 else 2510 else
2511 printf("You must delete some partition and add " 2511 puts("You must delete some partition and add "
2512 "an extended partition first\n"); 2512 "an extended partition first");
2513 } else { 2513 } else {
2514 char c, line[80]; 2514 char c, line[80];
2515 snprintf(line, sizeof(line), 2515 snprintf(line, sizeof(line),
@@ -2547,7 +2547,7 @@ reread_partition_table(int leave)
2547{ 2547{
2548 int i; 2548 int i;
2549 2549
2550 printf("Calling ioctl() to re-read partition table\n"); 2550 puts("Calling ioctl() to re-read partition table");
2551 sync(); 2551 sync();
2552 /* Users with slow external USB disks on a 320MHz ARM system (year 2011) 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: 2553 * report that sleep is needed, otherwise BLKRRPART may fail with -EIO:
@@ -2558,10 +2558,10 @@ reread_partition_table(int leave)
2558 "failed, kernel still uses old table"); 2558 "failed, kernel still uses old table");
2559#if 0 2559#if 0
2560 if (dos_changed) 2560 if (dos_changed)
2561 printf( 2561 puts(
2562 "\nWARNING: If you have created or modified any DOS 6.x\n" 2562 "\nWARNING: If you have created or modified any DOS 6.x\n"
2563 "partitions, please see the fdisk manual page for additional\n" 2563 "partitions, please see the fdisk manual page for additional\n"
2564 "information\n"); 2564 "information");
2565#endif 2565#endif
2566 2566
2567 if (leave) { 2567 if (leave) {
@@ -2589,7 +2589,7 @@ write_table(void)
2589 } 2589 }
2590 } 2590 }
2591 else if (LABEL_IS_SGI) { 2591 else if (LABEL_IS_SGI) {
2592 /* no test on change? the printf below might be mistaken */ 2592 /* no test on change? the "altered" msg below might be mistaken */
2593 sgi_write_table(); 2593 sgi_write_table();
2594 } 2594 }
2595 else if (LABEL_IS_SUN) { 2595 else if (LABEL_IS_SUN) {
@@ -2601,7 +2601,7 @@ write_table(void)
2601 } 2601 }
2602 } 2602 }
2603 2603
2604 printf("The partition table has been altered.\n"); 2604 puts("The partition table has been altered.");
2605 reread_partition_table(1); 2605 reread_partition_table(1);
2606} 2606}
2607#endif /* FEATURE_FDISK_WRITABLE */ 2607#endif /* FEATURE_FDISK_WRITABLE */
@@ -2744,8 +2744,8 @@ xselect(void)
2744 user_sectors = g_sectors = read_int(1, g_sectors, 63, 0, "Number of sectors"); 2744 user_sectors = g_sectors = read_int(1, g_sectors, 63, 0, "Number of sectors");
2745 if (dos_compatible_flag) { 2745 if (dos_compatible_flag) {
2746 sector_offset = g_sectors; 2746 sector_offset = g_sectors;
2747 printf("Warning: setting sector offset for DOS " 2747 puts("Warning: setting sector offset for DOS "
2748 "compatiblity\n"); 2748 "compatiblity");
2749 } 2749 }
2750 update_units(); 2750 update_units();
2751 break; 2751 break;
@@ -3024,7 +3024,7 @@ int fdisk_main(int argc UNUSED_PARAM, char **argv)
3024 sgi_get_bootfile()); 3024 sgi_get_bootfile());
3025 if (read_maybe_empty("Please enter the name of the " 3025 if (read_maybe_empty("Please enter the name of the "
3026 "new boot file: ") == '\n') 3026 "new boot file: ") == '\n')
3027 printf("Boot file unchanged\n"); 3027 puts("Boot file unchanged");
3028 else 3028 else
3029 sgi_set_bootfile(line_ptr); 3029 sgi_set_bootfile(line_ptr);
3030 } 3030 }
@@ -3106,8 +3106,8 @@ int fdisk_main(int argc UNUSED_PARAM, char **argv)
3106#if ENABLE_FEATURE_FDISK_ADVANCED 3106#if ENABLE_FEATURE_FDISK_ADVANCED
3107 case 'x': 3107 case 'x':
3108 if (LABEL_IS_SGI) { 3108 if (LABEL_IS_SGI) {
3109 printf("\n\tSorry, no experts menu for SGI " 3109 puts("\n\tSorry, no experts menu for SGI "
3110 "partition tables available\n\n"); 3110 "partition tables available\n");
3111 } else 3111 } else
3112 xselect(); 3112 xselect();
3113 break; 3113 break;