aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2015-10-13 14:45:51 +0100
committerRon Yorston <rmy@pobox.com>2015-10-13 14:45:51 +0100
commit8e509f11bceeec419abc718300bef7422d1fee4c (patch)
treefdfbc752ad94102e3613a5d7254f14a93eaf7f56 /util-linux
parent420f5edfe7676fe6e7cddbbf15c04649d096e422 (diff)
parent4d0c1ea4784c9844f8468d97ca5c26d3c70f9921 (diff)
downloadbusybox-w32-8e509f11bceeec419abc718300bef7422d1fee4c.tar.gz
busybox-w32-8e509f11bceeec419abc718300bef7422d1fee4c.tar.bz2
busybox-w32-8e509f11bceeec419abc718300bef7422d1fee4c.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/dmesg.c8
-rw-r--r--util-linux/fdformat.c4
-rw-r--r--util-linux/fdisk.c94
-rw-r--r--util-linux/fdisk_gpt.c4
-rw-r--r--util-linux/fsck_minix.c16
-rw-r--r--util-linux/getopt.c2
-rw-r--r--util-linux/ipcrm.c2
-rw-r--r--util-linux/mdev.c2
-rw-r--r--util-linux/mkfs_minix.c10
-rw-r--r--util-linux/switch_root.c2
-rw-r--r--util-linux/uevent.c6
-rw-r--r--util-linux/umount.c16
12 files changed, 88 insertions, 78 deletions
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 81ba1c9d1..e543446c1 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -16,6 +16,7 @@
16//usage: "\n -c Clear ring buffer after printing" 16//usage: "\n -c Clear ring buffer after printing"
17//usage: "\n -n LEVEL Set console logging level" 17//usage: "\n -n LEVEL Set console logging level"
18//usage: "\n -s SIZE Buffer size" 18//usage: "\n -s SIZE Buffer size"
19//usage: "\n -r Print raw message buffer"
19 20
20#include <sys/klog.h> 21#include <sys/klog.h>
21#include "libbb.h" 22#include "libbb.h"
@@ -29,11 +30,12 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
29 enum { 30 enum {
30 OPT_c = 1 << 0, 31 OPT_c = 1 << 0,
31 OPT_s = 1 << 1, 32 OPT_s = 1 << 1,
32 OPT_n = 1 << 2 33 OPT_n = 1 << 2,
34 OPT_r = 1 << 3
33 }; 35 };
34 36
35 opt_complementary = "s+:n+"; /* numeric */ 37 opt_complementary = "s+:n+"; /* numeric */
36 opts = getopt32(argv, "cs:n:", &len, &level); 38 opts = getopt32(argv, "cs:n:r", &len, &level);
37 if (opts & OPT_n) { 39 if (opts & OPT_n) {
38 if (klogctl(8, NULL, (long) level)) 40 if (klogctl(8, NULL, (long) level))
39 bb_perror_msg_and_die("klogctl"); 41 bb_perror_msg_and_die("klogctl");
@@ -55,7 +57,7 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
55 return EXIT_SUCCESS; 57 return EXIT_SUCCESS;
56 58
57 59
58 if (ENABLE_FEATURE_DMESG_PRETTY) { 60 if (ENABLE_FEATURE_DMESG_PRETTY && !(opts & OPT_r)) {
59 int last = '\n'; 61 int last = '\n';
60 int in = 0; 62 int in = 0;
61 63
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index 6f49cec8f..6ef6445e6 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -93,7 +93,7 @@ int fdformat_main(int argc UNUSED_PARAM, char **argv)
93 } 93 }
94 94
95 xioctl(fd, FDFMTEND, NULL); 95 xioctl(fd, FDFMTEND, NULL);
96 printf("done\n"); 96 puts("Done");
97 97
98 /* VERIFY */ 98 /* VERIFY */
99 if (verify) { 99 if (verify) {
@@ -126,7 +126,7 @@ int fdformat_main(int argc UNUSED_PARAM, char **argv)
126 126
127 if (ENABLE_FEATURE_CLEAN_UP) free(data); 127 if (ENABLE_FEATURE_CLEAN_UP) free(data);
128 128
129 printf("done\n"); 129 puts("Done");
130 } 130 }
131 131
132 if (ENABLE_FEATURE_CLEAN_UP) close(fd); 132 if (ENABLE_FEATURE_CLEAN_UP) close(fd);
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;
diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c
index 5786d5f7d..715e227ca 100644
--- a/util-linux/fdisk_gpt.c
+++ b/util-linux/fdisk_gpt.c
@@ -106,7 +106,7 @@ gpt_list_table(int xtra UNUSED_PARAM)
106 (unsigned long long)SWAP_LE64(gpt_hdr->first_usable_lba), 106 (unsigned long long)SWAP_LE64(gpt_hdr->first_usable_lba),
107 (unsigned long long)SWAP_LE64(gpt_hdr->last_usable_lba)); 107 (unsigned long long)SWAP_LE64(gpt_hdr->last_usable_lba));
108 108
109 printf("Number Start (sector) End (sector) Size Code Name\n"); 109 puts("Number Start (sector) End (sector) Size Code Name");
110 for (i = 0; i < n_parts; i++) { 110 for (i = 0; i < n_parts; i++) {
111 gpt_partition *p = gpt_part(i); 111 gpt_partition *p = gpt_part(i);
112 if (p->lba_start) { 112 if (p->lba_start) {
@@ -119,7 +119,7 @@ gpt_list_table(int xtra UNUSED_PARAM)
119 numstr6, 119 numstr6,
120 0x0700 /* FIXME */); 120 0x0700 /* FIXME */);
121 gpt_print_wide(p->name, 18); 121 gpt_print_wide(p->name, 18);
122 printf("\n"); 122 bb_putchar('\n');
123 } 123 }
124 } 124 }
125} 125}
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 33767a1af..d2f3524b4 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -371,9 +371,9 @@ static int ask(const char *string, int def)
371 } 371 }
372 } 372 }
373 if (def) 373 if (def)
374 printf("y\n"); 374 puts("y");
375 else { 375 else {
376 printf("n\n"); 376 puts("n");
377 errors_uncorrected = 1; 377 errors_uncorrected = 1;
378 } 378 }
379 return def; 379 return def;
@@ -405,7 +405,7 @@ static void check_mount(void)
405 if (isatty(0) && isatty(1)) 405 if (isatty(0) && isatty(1))
406 cont = ask("Do you really want to continue", 0); 406 cont = ask("Do you really want to continue", 0);
407 if (!cont) { 407 if (!cont) {
408 printf("Check aborted\n"); 408 puts("Check aborted");
409 exit(EXIT_SUCCESS); 409 exit(EXIT_SUCCESS);
410 } 410 }
411 } 411 }
@@ -470,8 +470,8 @@ static void write_block(unsigned nr, void *addr)
470 if (!nr) 470 if (!nr)
471 return; 471 return;
472 if (nr < FIRSTZONE || nr >= ZONES) { 472 if (nr < FIRSTZONE || nr >= ZONES) {
473 printf("Internal error: trying to write bad block\n" 473 puts("Internal error: trying to write bad block\n"
474 "Write request ignored\n"); 474 "Write request ignored");
475 errors_uncorrected = 1; 475 errors_uncorrected = 1;
476 return; 476 return;
477 } 477 }
@@ -659,7 +659,7 @@ static void read_tables(void)
659 if (INODE_BUFFER_SIZE != read(dev_fd, inode_buffer, INODE_BUFFER_SIZE)) 659 if (INODE_BUFFER_SIZE != read(dev_fd, inode_buffer, INODE_BUFFER_SIZE))
660 die("can't read inodes"); 660 die("can't read inodes");
661 if (NORM_FIRSTZONE != FIRSTZONE) { 661 if (NORM_FIRSTZONE != FIRSTZONE) {
662 printf("warning: firstzone!=norm_firstzone\n"); 662 puts("warning: firstzone!=norm_firstzone");
663 errors_uncorrected = 1; 663 errors_uncorrected = 1;
664 } 664 }
665 get_dirsize(); 665 get_dirsize();
@@ -713,7 +713,7 @@ static void get_inode_common(unsigned nr, uint16_t i_mode)
713 } else 713 } else
714 links++; 714 links++;
715 if (!++inode_count[nr]) { 715 if (!++inode_count[nr]) {
716 printf("Warning: inode count too big\n"); 716 puts("Warning: inode count too big");
717 inode_count[nr]--; 717 inode_count[nr]--;
718 errors_uncorrected = 1; 718 errors_uncorrected = 1;
719 } 719 }
@@ -1299,7 +1299,7 @@ int fsck_minix_main(int argc UNUSED_PARAM, char **argv)
1299 } 1299 }
1300 if (changed) { 1300 if (changed) {
1301 write_tables(); 1301 write_tables();
1302 printf("FILE SYSTEM HAS BEEN CHANGED\n"); 1302 puts("FILE SYSTEM HAS BEEN CHANGED");
1303 sync(); 1303 sync();
1304 } else if (OPT_repair) 1304 } else if (OPT_repair)
1305 write_superblock(); 1305 write_superblock();
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 58df1c823..b9dadf13c 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -378,7 +378,7 @@ int getopt_main(int argc, char **argv)
378 if (compatible) { 378 if (compatible) {
379 /* For some reason, the original getopt gave no error 379 /* For some reason, the original getopt gave no error
380 * when there were no arguments. */ 380 * when there were no arguments. */
381 printf(" --\n"); 381 puts(" --");
382 return 0; 382 return 0;
383 } 383 }
384 bb_error_msg_and_die("missing optstring argument"); 384 bb_error_msg_and_die("missing optstring argument");
diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c
index 888f70ef8..38d81af50 100644
--- a/util-linux/ipcrm.c
+++ b/util-linux/ipcrm.c
@@ -119,7 +119,7 @@ int ipcrm_main(int argc, char **argv)
119 119
120 if (remove_ids(what, &argv[2])) 120 if (remove_ids(what, &argv[2]))
121 fflush_stdout_and_exit(EXIT_FAILURE); 121 fflush_stdout_and_exit(EXIT_FAILURE);
122 printf("resource(s) deleted\n"); 122 puts("resource(s) deleted");
123 return 0; 123 return 0;
124 } 124 }
125 } 125 }
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 662e8ab38..51781d597 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -406,7 +406,7 @@ static void parse_next_rule(void)
406 } 406 }
407 407
408 /* 3rd field: mode - device permissions */ 408 /* 3rd field: mode - device permissions */
409 bb_parse_mode(tokens[2], &G.cur_rule.mode); 409 G.cur_rule.mode = bb_parse_mode(tokens[2], G.cur_rule.mode);
410 410
411 /* 4th field (opt): ">|=alias" or "!" to not create the node */ 411 /* 4th field (opt): ">|=alias" or "!" to not create the node */
412 val = tokens[3]; 412 val = tokens[3];
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index d65a5161c..88d797584 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -576,11 +576,11 @@ static void setup_tables(void)
576 for (i = MINIX_ROOT_INO; i <= SB_INODES; i++) 576 for (i = MINIX_ROOT_INO; i <= SB_INODES; i++)
577 unmark_inode(i); 577 unmark_inode(i);
578 G.inode_buffer = xzalloc(INODE_BUFFER_SIZE); 578 G.inode_buffer = xzalloc(INODE_BUFFER_SIZE);
579 printf("%ld inodes\n", (long)SB_INODES); 579 printf("%lu inodes\n", (unsigned long)SB_INODES);
580 printf("%ld blocks\n", (long)SB_ZONES); 580 printf("%lu blocks\n", (unsigned long)SB_ZONES);
581 printf("Firstdatazone=%ld (%ld)\n", (long)SB_FIRSTZONE, (long)norm_firstzone); 581 printf("Firstdatazone=%lu (%lu)\n", (unsigned long)SB_FIRSTZONE, (unsigned long)norm_firstzone);
582 printf("Zonesize=%d\n", BLOCK_SIZE << SB_ZONE_SIZE); 582 printf("Zonesize=%u\n", BLOCK_SIZE << SB_ZONE_SIZE);
583 printf("Maxsize=%ld\n", (long)SB_MAXSIZE); 583 printf("Maxsize=%lu\n", (unsigned long)SB_MAXSIZE);
584} 584}
585 585
586int mkfs_minix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 586int mkfs_minix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index a301b365b..7960b672c 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -206,7 +206,7 @@ because they're what all paths your process uses would be relative to.
206 206
207That's why the careful sequencing above: we cd into the new mount point before 207That's why the careful sequencing above: we cd into the new mount point before
208we do the mount --move. Moving the mount point would otherwise make it 208we do the mount --move. Moving the mount point would otherwise make it
209totally inaccessible to is because cd-ing to the old path wouldn't give it to 209totally inaccessible to us because cd-ing to the old path wouldn't give it to
210us anymore, and cd "/" just gives us the cached dentry from when the process 210us anymore, and cd "/" just gives us the cached dentry from when the process
211was created (in this case the old initramfs one). But the "." symlink gives 211was created (in this case the old initramfs one). But the "." symlink gives
212us the dentry of the filesystem we just moved, so we can then "chroot ." to 212us the dentry of the filesystem we just moved, so we can then "chroot ." to
diff --git a/util-linux/uevent.c b/util-linux/uevent.c
index fb98b4845..514a9e934 100644
--- a/util-linux/uevent.c
+++ b/util-linux/uevent.c
@@ -37,7 +37,7 @@ enum {
37#ifndef SO_RCVBUFFORCE 37#ifndef SO_RCVBUFFORCE
38#define SO_RCVBUFFORCE 33 38#define SO_RCVBUFFORCE 33
39#endif 39#endif
40static const int RCVBUF = 2 * 1024 * 1024; 40enum { RCVBUF = 2 * 1024 * 1024 };
41 41
42int uevent_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 42int uevent_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
43int uevent_main(int argc UNUSED_PARAM, char **argv) 43int uevent_main(int argc UNUSED_PARAM, char **argv)
@@ -63,8 +63,8 @@ int uevent_main(int argc UNUSED_PARAM, char **argv)
63 // find /sys -name uevent -exec sh -c 'echo add >"{}"' ';' 63 // find /sys -name uevent -exec sh -c 'echo add >"{}"' ';'
64 // 64 //
65 // SO_RCVBUFFORCE (root only) can go above net.core.rmem_max sysctl 65 // SO_RCVBUFFORCE (root only) can go above net.core.rmem_max sysctl
66 setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &RCVBUF, sizeof(RCVBUF)); 66 setsockopt_SOL_SOCKET_int(fd, SO_RCVBUF, RCVBUF);
67 setsockopt(fd, SOL_SOCKET, SO_RCVBUFFORCE, &RCVBUF, sizeof(RCVBUF)); 67 setsockopt_SOL_SOCKET_int(fd, SO_RCVBUFFORCE, RCVBUF);
68 if (0) { 68 if (0) {
69 int z; 69 int z;
70 socklen_t zl = sizeof(z); 70 socklen_t zl = sizeof(z);
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 4c2e8821e..00910977d 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -81,8 +81,9 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
81 argv += optind; 81 argv += optind;
82 82
83 // MNT_FORCE and MNT_DETACH (from linux/fs.h) must match 83 // MNT_FORCE and MNT_DETACH (from linux/fs.h) must match
84 // OPT_FORCE and OPT_LAZY, otherwise this trick won't work: 84 // OPT_FORCE and OPT_LAZY.
85 doForce = MAX((opt & OPT_FORCE), (opt & OPT_LAZY)); 85 BUILD_BUG_ON(OPT_FORCE != MNT_FORCE || OPT_LAZY != MNT_DETACH);
86 doForce = opt & (OPT_FORCE|OPT_LAZY);
86 87
87 /* Get a list of mount points from mtab. We read them all in now mostly 88 /* Get a list of mount points from mtab. We read them all in now mostly
88 * for umount -a (so we don't have to worry about the list changing while 89 * for umount -a (so we don't have to worry about the list changing while
@@ -147,11 +148,18 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
147 // umount the directory even if we were given the block device. 148 // umount the directory even if we were given the block device.
148 if (m) zapit = m->dir; 149 if (m) zapit = m->dir;
149 150
151// umount from util-linux 2.22.2 does not do this:
152// umount -f uses umount2(MNT_FORCE) immediately,
153// not trying umount() first.
154// (Strangely, umount -fl ignores -f: it is equivalent to umount -l.
155// We do pass both flags in this case)
156#if 0
150 // Let's ask the thing nicely to unmount. 157 // Let's ask the thing nicely to unmount.
151 curstat = umount(zapit); 158 curstat = umount(zapit);
152 159
153 // Force the unmount, if necessary. 160 // Unmount with force and/or lazy flags, if necessary.
154 if (curstat && doForce) 161 if (curstat && doForce)
162#endif
155 curstat = umount2(zapit, doForce); 163 curstat = umount2(zapit, doForce);
156 164
157 // If still can't umount, maybe remount read-only? 165 // If still can't umount, maybe remount read-only?
@@ -168,7 +176,7 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
168 bb_error_msg(msg, m->device); 176 bb_error_msg(msg, m->device);
169 } else { 177 } else {
170 status = EXIT_FAILURE; 178 status = EXIT_FAILURE;
171 bb_perror_msg("can't %sumount %s", (doForce ? "forcibly " : ""), zapit); 179 bb_perror_msg("can't unmount %s", zapit);
172 } 180 }
173 } else { 181 } else {
174 // De-allocate the loop device. This ioctl should be ignored on 182 // De-allocate the loop device. This ioctl should be ignored on