Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/util-linux
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (9 years ago)
- Location:
- branches/3.3
- Files:
-
- 10 added
- 73 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/util-linux/Config.src
r3232 r3621 435 435 any need to reading text files, you can leave this disabled. 436 436 437 config MOUNT438 bool "mount"439 default y440 select PLATFORM_LINUX441 help442 All files and filesystems in Unix are arranged into one big directory443 tree. The 'mount' utility is used to graft a filesystem onto a444 particular part of the tree. A filesystem can either live on a block445 device, or it can be accessible over the network, as is the case with446 NFS filesystems. Most people using BusyBox will also want to enable447 the 'mount' utility.448 449 config FEATURE_MOUNT_FAKE450 bool "Support option -f"451 default y452 depends on MOUNT453 help454 Enable support for faking a file system mount.455 456 config FEATURE_MOUNT_VERBOSE457 bool "Support option -v"458 default y459 depends on MOUNT460 help461 Enable multi-level -v[vv...] verbose messages. Useful if you462 debug mount problems and want to see what is exactly passed463 to the kernel.464 465 config FEATURE_MOUNT_HELPERS466 bool "Support mount helpers"467 default n468 depends on MOUNT469 help470 Enable mounting of virtual file systems via external helpers.471 E.g. "mount obexfs#-b00.11.22.33.44.55 /mnt" will in effect call472 "obexfs -b00.11.22.33.44.55 /mnt"473 Also "mount -t sometype [-o opts] fs /mnt" will try474 "sometype [-o opts] fs /mnt" if simple mount syscall fails.475 The idea is to use such virtual filesystems in /etc/fstab.476 477 config FEATURE_MOUNT_LABEL478 bool "Support specifying devices by label or UUID"479 default y480 depends on MOUNT481 select VOLUMEID482 help483 This allows for specifying a device by label or uuid, rather than by484 name. This feature utilizes the same functionality as blkid/findfs.485 This also enables label or uuid support for swapon.486 487 config FEATURE_MOUNT_NFS488 bool "Support mounting NFS file systems on Linux < 2.6.23"489 default n490 depends on MOUNT491 select FEATURE_HAVE_RPC492 select FEATURE_SYSLOG493 help494 Enable mounting of NFS file systems on Linux kernels prior495 to version 2.6.23. Note that in this case mounting of NFS496 over IPv6 will not be possible.497 498 Note that this option links in RPC support from libc,499 which is rather large (~10 kbytes on uclibc).500 501 config FEATURE_MOUNT_CIFS502 bool "Support mounting CIFS/SMB file systems"503 default y504 depends on MOUNT505 help506 Enable support for samba mounts.507 508 config FEATURE_MOUNT_FLAGS509 depends on MOUNT510 bool "Support lots of -o flags in mount"511 default y512 help513 Without this, mount only supports ro/rw/remount. With this, it514 supports nosuid, suid, dev, nodev, exec, noexec, sync, async, atime,515 noatime, diratime, nodiratime, loud, bind, move, shared, slave,516 private, unbindable, rshared, rslave, rprivate, and runbindable.517 518 config FEATURE_MOUNT_FSTAB519 depends on MOUNT520 bool "Support /etc/fstab and -a"521 default y522 help523 Support mount all and looking for files in /etc/fstab.524 525 437 config PIVOT_ROOT 526 438 bool "pivot_root" … … 577 489 This program replays a typescript, using timing information 578 490 given by script -t. 579 580 config SETARCH581 bool "setarch"582 default y583 select PLATFORM_LINUX584 help585 The linux32 utility is used to create a 32bit environment for the586 specified program (usually a shell). It only makes sense to have587 this util on a system that supports both 64bit and 32bit userland588 (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...).589 491 590 492 config SWAPONOFF … … 599 501 space. If you are not using any swap space, you can leave this 600 502 option disabled. 503 504 config FEATURE_SWAPON_DISCARD 505 bool "Support discard option -d" 506 default y 507 depends on SWAPONOFF 508 help 509 Enable support for discarding swap area blocks at swapon and/or as 510 the kernel frees them. This option enables both the -d option on 511 'swapon' and the 'discard' option for swap entries in /etc/fstab. 601 512 602 513 config FEATURE_SWAPON_PRI … … 700 611 your kernel. 701 612 702 config VOLUMEID 703 bool #No description makes it a hidden option 704 default n 705 706 menu "Filesystem/Volume identification" 707 depends on VOLUMEID 708 709 config FEATURE_VOLUMEID_EXT 710 bool "Ext filesystem" 711 default y 712 depends on VOLUMEID 713 help 714 TODO 715 716 config FEATURE_VOLUMEID_BTRFS 717 bool "btrfs filesystem" 718 default y 719 depends on VOLUMEID 720 help 721 TODO 722 723 config FEATURE_VOLUMEID_REISERFS 724 bool "Reiser filesystem" 725 default y 726 depends on VOLUMEID 727 help 728 TODO 729 730 config FEATURE_VOLUMEID_FAT 731 bool "fat filesystem" 732 default y 733 depends on VOLUMEID 734 help 735 TODO 736 737 config FEATURE_VOLUMEID_EXFAT 738 bool "exFAT filesystem" 739 default y 740 depends on VOLUMEID 741 help 742 exFAT (extended FAT) is a proprietary file system designed especially 743 for flash drives. It has many features from NTFS, but with less 744 overhead. exFAT is used on most SDXC cards for consumer electronics. 745 746 config FEATURE_VOLUMEID_HFS 747 bool "hfs filesystem" 748 default y 749 depends on VOLUMEID 750 help 751 TODO 752 753 config FEATURE_VOLUMEID_JFS 754 bool "jfs filesystem" 755 default y 756 depends on VOLUMEID 757 help 758 TODO 759 760 ### config FEATURE_VOLUMEID_UFS 761 ### bool "ufs filesystem" 762 ### default y 763 ### depends on VOLUMEID 764 ### help 765 ### TODO 766 767 config FEATURE_VOLUMEID_XFS 768 bool "xfs filesystem" 769 default y 770 depends on VOLUMEID 771 help 772 TODO 773 774 config FEATURE_VOLUMEID_NILFS 775 bool "nilfs filesystem" 776 default y 777 depends on VOLUMEID 778 help 779 TODO 780 781 config FEATURE_VOLUMEID_NTFS 782 bool "ntfs filesystem" 783 default y 784 depends on VOLUMEID 785 help 786 TODO 787 788 config FEATURE_VOLUMEID_ISO9660 789 bool "iso9660 filesystem" 790 default y 791 depends on VOLUMEID 792 help 793 TODO 794 795 config FEATURE_VOLUMEID_UDF 796 bool "udf filesystem" 797 default y 798 depends on VOLUMEID 799 help 800 TODO 801 802 config FEATURE_VOLUMEID_LUKS 803 bool "luks filesystem" 804 default y 805 depends on VOLUMEID 806 help 807 TODO 808 809 config FEATURE_VOLUMEID_LINUXSWAP 810 bool "linux swap filesystem" 811 default y 812 depends on VOLUMEID 813 help 814 TODO 815 816 ### config FEATURE_VOLUMEID_LVM 817 ### bool "lvm" 818 ### default y 819 ### depends on VOLUMEID 820 ### help 821 ### TODO 822 823 config FEATURE_VOLUMEID_CRAMFS 824 bool "cramfs filesystem" 825 default y 826 depends on VOLUMEID 827 help 828 TODO 829 830 ### config FEATURE_VOLUMEID_HPFS 831 ### bool "hpfs filesystem" 832 ### default y 833 ### depends on VOLUMEID 834 ### help 835 ### TODO 836 837 config FEATURE_VOLUMEID_ROMFS 838 bool "romfs filesystem" 839 default y 840 depends on VOLUMEID 841 help 842 TODO 843 844 config FEATURE_VOLUMEID_SQUASHFS 845 bool "SquashFS filesystem" 846 default y 847 depends on VOLUMEID && FEATURE_BLKID_TYPE 848 help 849 Squashfs is a compressed read-only filesystem for Linux. Squashfs is 850 intended for general read-only filesystem use and in constrained block 851 device/memory systems (e.g. embedded systems) where low overhead is 852 needed. 853 854 config FEATURE_VOLUMEID_SYSV 855 bool "sysv filesystem" 856 default y 857 depends on VOLUMEID 858 help 859 TODO 860 861 ### config FEATURE_VOLUMEID_MINIX 862 ### bool "minix filesystem" 863 ### default y 864 ### depends on VOLUMEID 865 ### help 866 ### TODO 867 868 ### These only detect partition tables - not used (yet?) 869 ### config FEATURE_VOLUMEID_MAC 870 ### bool "mac filesystem" 871 ### default y 872 ### depends on VOLUMEID 873 ### help 874 ### TODO 875 ### 876 ### config FEATURE_VOLUMEID_MSDOS 877 ### bool "msdos filesystem" 878 ### default y 879 ### depends on VOLUMEID 880 ### help 881 ### TODO 882 883 config FEATURE_VOLUMEID_OCFS2 884 bool "ocfs2 filesystem" 885 default y 886 depends on VOLUMEID 887 help 888 TODO 889 890 ### config FEATURE_VOLUMEID_HIGHPOINTRAID 891 ### bool "highpoint raid" 892 ### default y 893 ### depends on VOLUMEID 894 ### help 895 ### TODO 896 897 ### config FEATURE_VOLUMEID_ISWRAID 898 ### bool "intel raid" 899 ### default y 900 ### depends on VOLUMEID 901 ### help 902 ### TODO 903 904 ### config FEATURE_VOLUMEID_LSIRAID 905 ### bool "lsi raid" 906 ### default y 907 ### depends on VOLUMEID 908 ### help 909 ### TODO 910 911 ### config FEATURE_VOLUMEID_VIARAID 912 ### bool "via raid" 913 ### default y 914 ### depends on VOLUMEID 915 ### help 916 ### TODO 917 918 ### config FEATURE_VOLUMEID_SILICONRAID 919 ### bool "silicon raid" 920 ### default y 921 ### depends on VOLUMEID 922 ### help 923 ### TODO 924 925 ### config FEATURE_VOLUMEID_NVIDIARAID 926 ### bool "nvidia raid" 927 ### default y 928 ### depends on VOLUMEID 929 ### help 930 ### TODO 931 932 ### config FEATURE_VOLUMEID_PROMISERAID 933 ### bool "promise raid" 934 ### default y 935 ### depends on VOLUMEID 936 ### help 937 ### TODO 938 939 config FEATURE_VOLUMEID_LINUXRAID 940 bool "linuxraid" 941 default y 942 depends on VOLUMEID 943 help 944 TODO 613 source util-linux/volume_id/Config.in 945 614 946 615 endmenu 947 948 endmenu -
branches/3.3/mindi-busybox/util-linux/Kbuild.src
r3232 r3621 41 41 lib-$(CONFIG_SCRIPT) += script.o 42 42 lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o 43 lib-$(CONFIG_SETARCH) += setarch.o44 43 lib-$(CONFIG_SWAPONOFF) += swaponoff.o 45 44 lib-$(CONFIG_SWITCH_ROOT) += switch_root.o -
branches/3.3/mindi-busybox/util-linux/acpid.c
r3232 r3621 122 122 const char *args[] = { "run-parts", handler, NULL }; 123 123 124 // debug info 125 if (option_mask32 & OPT_d) { 126 bb_error_msg("%s", event); 127 } 124 // log the event 125 bb_error_msg("%s", event); 128 126 129 127 // spawn handler … … 154 152 155 153 if (buf) { 156 if ( strncmp(buf, evt_tab[i].desc, strlen(buf)) == 0) {154 if (is_prefixed_with(evt_tab[i].desc, buf)) { 157 155 action = evt_tab[i].desc; 158 156 break; … … 257 255 * This includes any output from children. 258 256 */ 259 xmove_fd(xopen(opt_logfile, O_WRONLY | O_CREAT | O_ TRUNC), STDOUT_FILENO);257 xmove_fd(xopen(opt_logfile, O_WRONLY | O_CREAT | O_APPEND), STDOUT_FILENO); 260 258 xdup2(STDOUT_FILENO, STDERR_FILENO); 261 259 /* Also, acpid's messages (but not children) will go to syslog too */ -
branches/3.3/mindi-busybox/util-linux/dmesg.c
r3232 r3621 17 17 //usage: "\n -n LEVEL Set console logging level" 18 18 //usage: "\n -s SIZE Buffer size" 19 //usage: "\n -r Print raw message buffer" 19 20 20 21 #include <sys/klog.h> … … 30 31 OPT_c = 1 << 0, 31 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 37 opt_complementary = "s+:n+"; /* numeric */ 36 opts = getopt32(argv, "cs:n: ", &len, &level);38 opts = getopt32(argv, "cs:n:r", &len, &level); 37 39 if (opts & OPT_n) { 38 40 if (klogctl(8, NULL, (long) level)) … … 56 58 57 59 58 if (ENABLE_FEATURE_DMESG_PRETTY ) {60 if (ENABLE_FEATURE_DMESG_PRETTY && !(opts & OPT_r)) { 59 61 int last = '\n'; 60 62 int in = 0; -
branches/3.3/mindi-busybox/util-linux/fbset.c
r3232 r3621 165 165 } g_cmdoptions[] = { 166 166 /*"12345678" + NUL */ 167 //TODO: convert to index_in_strings() 167 168 { "fb" , 1, CMD_FB }, 168 169 { "db" , 1, CMD_DB }, … … 249 250 continue; 250 251 s = p + strlen(mode); 251 //bb_ info_msg("CHECK[%s][%s][%d]", mode, p-1, *s);252 //bb_error_msg("CHECK[%s][%s][%d]", mode, p-1, *s); 252 253 /* exact match? */ 253 254 if (((!*s || isspace(*s)) && '"' != s[-1]) /* end-of-token */ 254 255 || ('"' == *s && '"' == p[-1]) /* ends with " but starts with " too! */ 255 256 ) { 256 //bb_ info_msg("FOUND[%s][%s][%s][%d]", token[1], p, mode, isspace(*s));257 //bb_error_msg("FOUND[%s][%s][%s][%d]", token[1], p, mode, isspace(*s)); 257 258 break; 258 259 } … … 265 266 int i; 266 267 267 //bb_ info_msg("???[%s][%s]", token[0], token[1]);268 //bb_error_msg("???[%s][%s]", token[0], token[1]); 268 269 if (strcmp(token[0], "endmode") == 0) { 269 //bb_ info_msg("OK[%s]", mode);270 //bb_error_msg("OK[%s]", mode); 270 271 return 1; 271 272 } … … 295 296 base->bits_per_pixel = base_bits_per_pixel; 296 297 } 297 //bb_ info_msg("GEO[%s]", p);298 //bb_error_msg("GEO[%s]", p); 298 299 break; 299 300 case 1: … … 322 323 base->vsync_len = base_vsync_len; 323 324 } 324 //bb_ info_msg("TIM[%s]", p);325 //bb_error_msg("TIM[%s]", p); 325 326 break; 326 327 case 2: … … 328 329 static const uint32_t syncs[] = {FB_VMODE_INTERLACED, FB_VMODE_DOUBLE}; 329 330 ss(&base->vmode, syncs[i-2], p, "false"); 330 //bb_ info_msg("VMODE[%s]", p);331 //bb_error_msg("VMODE[%s]", p); 331 332 break; 332 333 } … … 336 337 static const uint32_t syncs[] = {FB_SYNC_VERT_HIGH_ACT, FB_SYNC_HOR_HIGH_ACT, FB_SYNC_COMP_HIGH_ACT}; 337 338 ss(&base->sync, syncs[i-4], p, "low"); 338 //bb_ info_msg("SYNC[%s]", p);339 //bb_error_msg("SYNC[%s]", p); 339 340 break; 340 341 } 341 342 case 7: 342 343 ss(&base->sync, FB_SYNC_EXT, p, "false"); 343 //bb_ info_msg("EXTSYNC[%s]", p);344 //bb_error_msg("EXTSYNC[%s]", p); 344 345 break; 345 346 case 8: { … … 350 351 351 352 sscanf(p, "%d/%d,%d/%d,%d/%d,%d/%d", 352 &red_ offset, &red_length,353 &green_ offset, &green_length,354 &blue_ offset, &blue_length,355 &transp_ offset, &transp_length);353 &red_length, &red_offset, 354 &green_length, &green_offset, 355 &blue_length, &blue_offset, 356 &transp_length, &transp_offset); 356 357 base->red.offset = red_offset; 357 358 base->red.length = red_length; … … 417 418 418 419 const char *fbdev = DEFAULTFBDEV; 419 const char *modefile = DEFAULTFBMODE;420 IF_FEATURE_FBSET_READMODE(const char *modefile = DEFAULTFBMODE;) 420 421 char *thisarg; 421 422 char *mode = mode; /* for compiler */ … … 445 446 break; 446 447 case CMD_DB: 447 modefile = argv[1];448 IF_FEATURE_FBSET_READMODE(modefile = argv[1];) 448 449 break; 449 450 case CMD_ALL: -
branches/3.3/mindi-busybox/util-linux/fdformat.c
r3232 r3621 73 73 xioctl(fd, FDGETPRM, ¶m); 74 74 75 printf("%s-sided, % d tracks, %dsec/track. Total capacity %d kB\n",75 printf("%s-sided, %u tracks, %u sec/track. Total capacity %d kB\n", 76 76 (param.head == 2) ? "Double" : "Single", 77 77 param.track, param.sect, param.size >> 1); … … 94 94 95 95 xioctl(fd, FDFMTEND, NULL); 96 p rintf("done\n");96 puts("Done"); 97 97 98 98 /* VERIFY */ … … 127 127 if (ENABLE_FEATURE_CLEAN_UP) free(data); 128 128 129 p rintf("done\n");129 puts("Done"); 130 130 } 131 131 -
branches/3.3/mindi-busybox/util-linux/fdisk.c
r3232 r3621 1103 1103 if (!g_cylinders) 1104 1104 printf(" cylinders"); 1105 printf(1106 1105 #if ENABLE_FEATURE_FDISK_WRITABLE 1107 " (settable in the extra functions menu)" 1108 #endif 1109 "\n"); 1106 puts(" (settable in the extra functions menu)"); 1107 #else 1108 bb_putchar('\n'); 1109 #endif 1110 1110 return 1; 1111 1111 } … … 1151 1151 p = pex->part_table; 1152 1152 if (!get_start_sect(p)) { 1153 p rintf("Bad offset in primary extended partition\n");1153 puts("Bad offset in primary extended partition"); 1154 1154 return; 1155 1155 } … … 1451 1451 return 0; 1452 1452 } 1453 p rintf("This disk has both DOS and BSD magic.\n"1454 "Give the 'b' command to go to BSD mode.\n");1453 puts("This disk has both DOS and BSD magic.\n" 1454 "Give the 'b' command to go to BSD mode."); 1455 1455 } 1456 1456 #endif … … 1462 1462 if (!valid_part_table_flag(MBRbuffer)) { 1463 1463 if (what == OPEN_MAIN) { 1464 p rintf("Device contains neither a valid DOS "1465 1466 "disklabel\n");1464 puts("Device contains neither a valid DOS " 1465 "partition table, nor Sun, SGI, OSF or GPT " 1466 "disklabel"); 1467 1467 #ifdef __sparc__ 1468 1468 IF_FEATURE_SUN_LABEL(create_sunlabel();) … … 1597 1597 if (value >= low && value <= high) 1598 1598 break; 1599 p rintf("Value is out of range\n");1599 puts("Value is out of range"); 1600 1600 } 1601 1601 return value; … … 1642 1642 return pno; 1643 1643 } 1644 p rintf("No partition is defined yet!\n");1644 puts("No partition is defined yet!"); 1645 1645 return -1; 1646 1646 … … 1669 1669 return pno; 1670 1670 } 1671 p rintf("All primary partitions have been defined already!\n");1671 puts("All primary partitions have been defined already!"); 1672 1672 return -1; 1673 1673 … … 1704 1704 if (dos_compatible_flag) { 1705 1705 sector_offset = g_sectors; 1706 printf("DOS Compatibility flag is set\n");1706 printf("DOS Compatibility flag is %sset\n", ""); 1707 1707 } else { 1708 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 } … … 1814 1814 1815 1815 if (!sys && !LABEL_IS_SGI && !LABEL_IS_SUN) { 1816 p rintf("Type 0 means free space to many systems\n"1817 1818 "type 0 is probably unwise.\n");1816 puts("Type 0 means free space to many systems\n" 1817 "(but not to Linux). Having partitions of\n" 1818 "type 0 is probably unwise."); 1819 1819 /* break; */ 1820 1820 } … … 1822 1822 if (!LABEL_IS_SUN && !LABEL_IS_SGI) { 1823 1823 if (IS_EXTENDED(sys) != IS_EXTENDED(p->sys_ind)) { 1824 p rintf("You cannot change a partition into"1825 " an extended one or vice versa\n");1824 puts("You cannot change a partition into" 1825 " an extended one or vice versa"); 1826 1826 break; 1827 1827 } … … 1831 1831 #if ENABLE_FEATURE_SUN_LABEL 1832 1832 if (LABEL_IS_SUN && i == 2 && sys != SUN_WHOLE_DISK) 1833 p rintf("Consider leaving partition 3 "1834 1835 1836 "even Linux likes it\n\n");1833 puts("Consider leaving partition 3 " 1834 "as Whole disk (5),\n" 1835 "as SunOS/Solaris expects it and " 1836 "even Linux likes it\n"); 1837 1837 #endif 1838 1838 #if ENABLE_FEATURE_SGI_LABEL … … 1843 1843 ) 1844 1844 ) { 1845 p rintf("Consider leaving partition 9 "1846 1847 1848 "as IRIX expects it\n\n");1845 puts("Consider leaving partition 9 " 1846 "as volume header (0),\nand " 1847 "partition 11 as entire volume (6)" 1848 "as IRIX expects it\n"); 1849 1849 } 1850 1850 #endif … … 2068 2068 2069 2069 if (!wrong_p_order(NULL)) { 2070 p rintf("Ordering is already correct\n\n");2070 puts("Ordering is already correct\n"); 2071 2071 return; 2072 2072 } … … 2096 2096 fix_chain_of_logicals(); 2097 2097 2098 p rintf("Done.\n");2098 puts("Done"); 2099 2099 } 2100 2100 #endif … … 2179 2179 if (LABEL_IS_DOS && wrong_p_order(NULL)) { 2180 2180 /* FIXME */ 2181 p rintf("\nPartition table entries are not in disk order\n");2181 puts("\nPartition table entries are not in disk order"); 2182 2182 } 2183 2183 } … … 2193 2193 printf("\nDisk %s: %u heads, %u sectors, %u cylinders\n\n", 2194 2194 disk_device, g_heads, g_sectors, g_cylinders); 2195 p rintf("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 2196 for (i = 0; i < g_partitions; i++) { 2197 2197 pe = &ptes[i]; … … 2420 2420 } 2421 2421 if (start > limit) { 2422 p rintf("No free sectors available\n");2422 puts("No free sectors available"); 2423 2423 if (n > 4) 2424 2424 g_partitions--; … … 2491 2491 } 2492 2492 if (LABEL_IS_AIX) { 2493 p rintf("Sorry - this fdisk cannot handle AIX disk labels.\n"2493 puts("Sorry - this fdisk cannot handle AIX disk labels.\n" 2494 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 2496 return; 2497 2497 } … … 2501 2501 2502 2502 if (!free_primary && g_partitions >= MAXIMUM_PARTS) { 2503 p rintf("The maximum number of partitions has been created\n");2503 puts("The maximum number of partitions has been created"); 2504 2504 return; 2505 2505 } … … 2509 2509 add_logical(); 2510 2510 else 2511 p rintf("You must delete some partition and add "2512 "an extended partition first \n");2511 puts("You must delete some partition and add " 2512 "an extended partition first"); 2513 2513 } else { 2514 2514 char c, line[80]; … … 2548 2548 int i; 2549 2549 2550 p rintf("Calling ioctl() to re-read partition table\n");2550 puts("Calling ioctl() to re-read partition table"); 2551 2551 sync(); 2552 2552 /* Users with slow external USB disks on a 320MHz ARM system (year 2011) … … 2559 2559 #if 0 2560 2560 if (dos_changed) 2561 p rintf(2561 puts( 2562 2562 "\nWARNING: If you have created or modified any DOS 6.x\n" 2563 2563 "partitions, please see the fdisk manual page for additional\n" 2564 "information \n");2564 "information"); 2565 2565 #endif 2566 2566 … … 2590 2590 } 2591 2591 else if (LABEL_IS_SGI) { 2592 /* no test on change? the printfbelow might be mistaken */2592 /* no test on change? the "altered" msg below might be mistaken */ 2593 2593 sgi_write_table(); 2594 2594 } … … 2602 2602 } 2603 2603 2604 p rintf("The partition table has been altered.\n");2604 puts("The partition table has been altered."); 2605 2605 reread_partition_table(1); 2606 2606 } … … 2745 2745 if (dos_compatible_flag) { 2746 2746 sector_offset = g_sectors; 2747 p rintf("Warning: setting sector offset for DOS "2748 "compatiblity \n");2747 puts("Warning: setting sector offset for DOS " 2748 "compatiblity"); 2749 2749 } 2750 2750 update_units(); … … 2782 2782 So try to be careful. This only works since 2.1.73. */ 2783 2783 2784 if ( strncmp("/dev/hd", device, 7))2784 if (!is_prefixed_with(device, "/dev/hd")) 2785 2785 return 0; 2786 2786 … … 2788 2788 procf = fopen_for_read(buf); 2789 2789 if (procf != NULL && fgets(buf, sizeof(buf), procf)) 2790 is_ide = ( !strncmp(buf, "cdrom", 5) ||2791 !strncmp(buf, "tape", 4));2790 is_ide = (is_prefixed_with(buf, "cdrom") || 2791 is_prefixed_with(buf, "tape")); 2792 2792 else 2793 2793 /* Now when this proc file does not exist, skip the … … 3025 3025 if (read_maybe_empty("Please enter the name of the " 3026 3026 "new boot file: ") == '\n') 3027 p rintf("Boot file unchanged\n");3027 puts("Boot file unchanged"); 3028 3028 else 3029 3029 sgi_set_bootfile(line_ptr); … … 3107 3107 case 'x': 3108 3108 if (LABEL_IS_SGI) { 3109 p rintf("\n\tSorry, no experts menu for SGI "3110 "partition tables available\n \n");3109 puts("\n\tSorry, no experts menu for SGI " 3110 "partition tables available\n"); 3111 3111 } else 3112 3112 xselect(); -
branches/3.3/mindi-busybox/util-linux/fdisk_gpt.c
r2725 r3621 94 94 char numstr6[6]; 95 95 96 numstr6[5] = '\0'; 97 98 smart_ulltoa5(total_number_of_sectors, numstr6, " KMGTPEZY"); 96 smart_ulltoa5(total_number_of_sectors * sector_size, numstr6, " KMGTPEZY")[0] = '\0'; 99 97 printf("Disk %s: %llu sectors, %s\n", disk_device, 100 98 (unsigned long long)total_number_of_sectors, … … 109 107 (unsigned long long)SWAP_LE64(gpt_hdr->last_usable_lba)); 110 108 111 p rintf("Number Start (sector) End (sector) Size Code Name\n");109 puts("Number Start (sector) End (sector) Size Code Name"); 112 110 for (i = 0; i < n_parts; i++) { 113 111 gpt_partition *p = gpt_part(i); 114 112 if (p->lba_start) { 115 smart_ulltoa5( 1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start),116 numstr6, " KMGTPEZY") ;113 smart_ulltoa5((1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start)) * sector_size, 114 numstr6, " KMGTPEZY")[0] = '\0'; 117 115 printf("%4u %15llu %15llu %11s %04x ", 118 116 i + 1, … … 122 120 0x0700 /* FIXME */); 123 121 gpt_print_wide(p->name, 18); 124 printf("\n");122 bb_putchar('\n'); 125 123 } 126 124 } -
branches/3.3/mindi-busybox/util-linux/fdisk_osf.c
r3232 r3621 367 367 printf("Reading disklabel of %s at sector %u\n", 368 368 partname(disk_device, t+1, 0), ss + BSD_LABELSECTOR); 369 if (xbsd_readlabel(xbsd_part) == 0) 369 if (xbsd_readlabel(xbsd_part) == 0) { 370 370 if (xbsd_create_disklabel() == 0) 371 371 return; 372 372 break; 373 } 373 374 } 374 375 } … … 855 856 d->d_magic = BSD_DISKMAGIC; 856 857 857 if ( strncmp(disk_device, "/dev/sd", 7) == 0)858 if (is_prefixed_with(disk_device, "/dev/sd")) 858 859 d->d_type = BSD_DTYPE_SCSI; 859 860 else -
branches/3.3/mindi-busybox/util-linux/fdisk_sgi.c
r2725 r3621 441 441 442 442 write_sector(0, sgilabel); 443 if ( !strncmp((char*)sgilabel->directory[0].vol_file_name, "sgilabel", 8)) {443 if (is_prefixed_with((char*)sgilabel->directory[0].vol_file_name, "sgilabel")) { 444 444 /* 445 445 * keep this habit of first writing the "sgilabel". … … 505 505 if ((Index[0] != 10) && verbose) 506 506 printf("IRIX likes when Partition 11 covers the entire disk\n"); 507 if ((sgi_get_start_sector(Index[0]) != 0) && verbose) 507 if ((sgi_get_start_sector(Index[0]) != 0) && verbose) { 508 508 printf("The entire disk partition should start " 509 509 "at block 0,\n" 510 510 "not at diskblock %u\n", 511 511 sgi_get_start_sector(Index[0])); 512 if (SGI_DEBUG) /* I do not understand how some disks fulfil it */ 512 } 513 if (SGI_DEBUG) { /* I do not understand how some disks fulfil it */ 513 514 if ((sgi_get_num_sectors(Index[0]) != lastblock) && verbose) 514 515 printf("The entire disk partition is only %u diskblock large,\n" … … 516 517 sgi_get_num_sectors(Index[0]), lastblock); 517 518 lastblock = sgi_get_num_sectors(Index[0]); 519 } 518 520 } else { 519 521 if (verbose) … … 670 672 671 673 for (n = 8; n < g_partitions; n++) { 672 if (!sgi_get_num_sectors(n)) { 673 /* 674 * 5 cylinders is an arbitrary value I like 675 * IRIX 5.3 stored files in the volume header 676 * (like sash, symmon, fx, ide) with ca. 3200 677 * sectors. 678 */ 679 if (g_heads * g_sectors * 5 < sgi_get_lastblock()) 680 sgi_set_partition(n, 0, g_heads * g_sectors * 5, SGI_VOLHDR); 681 break; 674 if (!sgi_get_num_sectors(n)) { 675 /* 676 * 5 cylinders is an arbitrary value I like 677 * IRIX 5.3 stored files in the volume header 678 * (like sash, symmon, fx, ide) with ca. 3200 679 * sectors. 680 */ 681 if (g_heads * g_sectors * 5 < sgi_get_lastblock()) { 682 sgi_set_partition(n, 0, g_heads * g_sectors * 5, SGI_VOLHDR); 683 break; 684 } 682 685 } 683 686 } -
branches/3.3/mindi-busybox/util-linux/fdisk_sun.c
r2725 r3621 349 349 set_all_unchanged(); 350 350 set_changed(0); 351 check_sun_label(); 351 352 get_boot(CREATE_EMPTY_SUN); 352 353 } … … 498 499 first = read_int(scround(start), scround(stop)+1, 499 500 scround(stop), 0, mesg); 500 if (display_in_cyl_units) 501 if (display_in_cyl_units) { 501 502 first *= units_per_sector; 502 else503 } else { 503 504 /* Starting sector has to be properly aligned */ 504 first = (first + g_heads * g_sectors - 1) / (g_heads * g_sectors); 505 first = (first + g_heads * g_sectors - 1) / 506 (g_heads * g_sectors); 507 first *= g_heads * g_sectors; 508 } 505 509 if (n == 2 && first != 0) 506 510 printf("\ -
branches/3.3/mindi-busybox/util-linux/findfs.c
r3232 r3621 28 28 bb_show_usage(); 29 29 30 if ( strncmp(dev, "/dev/", 5) == 0) {30 if (is_prefixed_with(dev, "/dev/")) { 31 31 /* Just pass any /dev/xxx name right through. 32 32 * This might aid in some scripts being able -
branches/3.3/mindi-busybox/util-linux/flock.c
r3232 r3621 58 58 * we use "+" in order to support "flock -opt FILE PROG -with-opts", 59 59 * we need to remove -c by hand. 60 * TODO: in upstream, -c 'PROG ARGS' means "run sh -c 'PROG ARGS'"61 60 */ 62 61 if (argv[0] … … 67 66 ) { 68 67 argv++; 68 if (argv[1]) 69 bb_error_msg_and_die("-c takes only one argument"); 70 opt |= OPT_c; 69 71 } 70 72 … … 91 93 } 92 94 93 if (argv[0]) 94 return spawn_and_wait(argv); 95 if (argv[0]) { 96 int rc; 97 if (opt & OPT_c) { 98 /* -c 'PROG ARGS' means "run sh -c 'PROG ARGS'" */ 99 argv -= 2; 100 argv[0] = (char*)get_shell_name(); 101 argv[1] = (char*)"-c"; 102 /* argv[2] = "PROG ARGS"; */ 103 /* argv[3] = NULL; */ 104 } 105 rc = spawn_and_wait(argv); 106 if (rc < 0) 107 bb_simple_perror_msg(argv[0]); 108 return rc; 109 } 95 110 96 111 return EXIT_SUCCESS; -
branches/3.3/mindi-busybox/util-linux/fsck_minix.c
r3232 r3621 372 372 } 373 373 if (def) 374 p rintf("y\n");374 puts("y"); 375 375 else { 376 p rintf("n\n");376 puts("n"); 377 377 errors_uncorrected = 1; 378 378 } … … 406 406 cont = ask("Do you really want to continue", 0); 407 407 if (!cont) { 408 p rintf("Check aborted\n");408 puts("Check aborted"); 409 409 exit(EXIT_SUCCESS); 410 410 } … … 471 471 return; 472 472 if (nr < FIRSTZONE || nr >= ZONES) { 473 p rintf("Internal error: trying to write bad block\n"474 "Write request ignored\n");473 puts("Internal error: trying to write bad block\n" 474 "Write request ignored"); 475 475 errors_uncorrected = 1; 476 476 return; … … 660 660 die("can't read inodes"); 661 661 if (NORM_FIRSTZONE != FIRSTZONE) { 662 p rintf("warning: firstzone!=norm_firstzone\n");662 puts("warning: firstzone!=norm_firstzone"); 663 663 errors_uncorrected = 1; 664 664 } … … 687 687 if (!inode_count[nr]) { 688 688 if (!inode_in_use(nr)) { 689 printf("Inode % dis marked as 'unused', but it is used "689 printf("Inode %u is marked as 'unused', but it is used " 690 690 "for file '%s'\n", nr, current_name); 691 691 if (OPT_repair) { … … 714 714 links++; 715 715 if (!++inode_count[nr]) { 716 p rintf("Warning: inode count too big\n");716 puts("Warning: inode count too big"); 717 717 inode_count[nr]--; 718 718 errors_uncorrected = 1; … … 1300 1300 if (changed) { 1301 1301 write_tables(); 1302 p rintf("FILE SYSTEM HAS BEEN CHANGED\n");1302 puts("FILE SYSTEM HAS BEEN CHANGED"); 1303 1303 sync(); 1304 1304 } else if (OPT_repair) -
branches/3.3/mindi-busybox/util-linux/getopt.c
r3232 r3621 36 36 //usage:#define getopt_full_usage "\n\n" 37 37 //usage: IF_LONG_OPTS( 38 //usage: " -a,--alternative Allow long options starting with single -" 39 //usage: "\n -l,--longoptions=LOPT[,...] Long options to be recognized" 40 //usage: "\n -n,--name=PROGNAME The name under which errors are reported" 41 //usage: "\n -o,--options=OPTSTRING Short options to be recognized" 42 //usage: "\n -q,--quiet Disable error reporting by getopt(3)" 38 //usage: IF_FEATURE_GETOPT_LONG( 39 //usage: " -a,--alternative Allow long options starting with single -\n" 40 //usage: " -l,--longoptions=LOPT[,...] Long options to recognize\n" 41 //usage: ) 42 //usage: " -n,--name=PROGNAME The name under which errors are reported" 43 //usage: "\n -o,--options=OPTSTRING Short options to recognize" 44 //usage: "\n -q,--quiet No error messages on unrecognized options" 43 45 //usage: "\n -Q,--quiet-output No normal output" 44 46 //usage: "\n -s,--shell=SHELL Set shell quoting conventions" 45 //usage: "\n -T,--test Test for getopt(1) version"46 //usage: "\n -u,--unquoted Don't quote theoutput"47 //usage: "\n -T,--test Version test (exits with 4)" 48 //usage: "\n -u,--unquoted Don't quote output" 47 49 //usage: ) 48 50 //usage: IF_NOT_LONG_OPTS( 49 //usage: " -a Allow long options starting with single -" 50 //usage: "\n -l LOPT[,...] Long options to be recognized" 51 //usage: "\n -n PROGNAME The name under which errors are reported" 52 //usage: "\n -o OPTSTRING Short options to be recognized" 53 //usage: "\n -q Disable error reporting by getopt(3)" 51 //usage: IF_FEATURE_GETOPT_LONG( 52 //usage: " -a Allow long options starting with single -\n" 53 //usage: " -l LOPT[,...] Long options to recognize\n" 54 //usage: ) 55 //usage: " -n PROGNAME The name under which errors are reported" 56 //usage: "\n -o OPTSTRING Short options to recognize" 57 //usage: "\n -q No error messages on unrecognized options" 54 58 //usage: "\n -Q No normal output" 55 59 //usage: "\n -s SHELL Set shell quoting conventions" 56 //usage: "\n -T Test for getopt(1) version"57 //usage: "\n -u Don't quote theoutput"60 //usage: "\n -T Version test (exits with 4)" 61 //usage: "\n -u Don't quote output" 58 62 //usage: ) 63 //usage: IF_FEATURE_GETOPT_LONG( /* example uses -l, needs FEATURE_GETOPT_LONG */ 59 64 //usage: "\n" 60 65 //usage: "\nExample:" … … 74 79 //usage: "\n esac" 75 80 //usage: "\ndone" 81 //usage: ) 76 82 //usage: 77 83 //usage:#define getopt_example_usage … … 215 221 { 216 222 int exit_code = 0; /* We assume everything will be OK */ 217 int opt;218 #if ENABLE_FEATURE_GETOPT_LONG219 int longindex;220 #endif221 const char *charptr;222 223 223 224 if (quiet_errors) /* No error reporting from getopt(3) */ … … 234 235 235 236 while (1) { 236 opt = 237 #if ENABLE_FEATURE_GETOPT_LONG 238 alternative ? 239 getopt_long_only(argc, argv, optstr, longopts, &longindex) : 240 getopt_long(argc, argv, optstr, longopts, &longindex); 237 #if ENABLE_FEATURE_GETOPT_LONG 238 int longindex; 239 int opt = alternative 240 ? getopt_long_only(argc, argv, optstr, longopts, &longindex) 241 : getopt_long(argc, argv, optstr, longopts, &longindex) 242 ; 241 243 #else 242 244 int opt = getopt(argc, argv, optstr); 243 245 #endif 244 246 if (opt == -1) … … 258 260 printf(" %s", normalize(optarg)); 259 261 else { 262 const char *charptr; 260 263 printf(" -%c", opt); 261 264 charptr = strchr(optstr, opt); 262 if (charptr != NULL&& *++charptr == ':')265 if (charptr && *++charptr == ':') 263 266 printf(" %s", 264 267 normalize(optarg ? optarg : "")); … … 268 271 269 272 if (!quiet_output) { 273 unsigned idx; 270 274 printf(" --"); 271 while (optind < argc) 272 printf(" %s", normalize(argv[optind++])); 275 idx = optind; 276 while (argv[idx]) 277 printf(" %s", normalize(argv[idx++])); 273 278 bb_putchar('\n'); 274 279 } … … 374 379 /* For some reason, the original getopt gave no error 375 380 * when there were no arguments. */ 376 p rintf(" --\n");381 puts(" --"); 377 382 return 0; 378 383 } -
branches/3.3/mindi-busybox/util-linux/hexdump.c
r3232 r3621 67 67 static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:v" IF_FEATURE_HEXDUMP_REVERSE("R"); 68 68 69 static const struct suffix_mult suffixes[] = {70 { "b", 512 },71 { "k", 1024 },72 { "m", 1024*1024 },73 { "", 0 }74 };75 76 69 int hexdump_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 77 70 int hexdump_main(int argc, char **argv) … … 117 110 } /* else */ 118 111 if (ch == 's') { /* compat: -s accepts hex numbers too */ 119 dumper->dump_skip = xstrtoul_range_sfx(optarg, /*base:*/ 0, /*lo:*/ 0, /*hi:*/ LONG_MAX, suffixes); 112 dumper->dump_skip = xstrtoull_range_sfx( 113 optarg, 114 /*base:*/ 0, 115 /*lo:*/ 0, /*hi:*/ OFF_T_MAX, 116 bkm_suffixes 117 ); 120 118 } /* else */ 121 119 if (ch == 'v') { -
branches/3.3/mindi-busybox/util-linux/hwclock.c
r3232 r3621 70 70 #else 71 71 char *cp = ctime(&t); 72 strchrnul(cp, '\n')[0] = '\0';72 chomp(cp); 73 73 #endif 74 74 … … 98 98 struct timezone tz; 99 99 100 tz.tz_minuteswest = timezone/60 - 60*daylight; 100 tz.tz_minuteswest = timezone/60; 101 /* ^^^ used to also subtract 60*daylight, but it's wrong: 102 * daylight!=0 means "this timezone has some DST 103 * during the year", not "DST is in effect now". 104 */ 101 105 tz.tz_dsttime = 0; 102 106 … … 249 253 broken = localtime(&tv.tv_sec); 250 254 tz.tz_minuteswest = timezone / 60; 251 if (broken->tm_isdst )255 if (broken->tm_isdst > 0) 252 256 tz.tz_minuteswest -= 60; 253 257 tz.tz_dsttime = 0; … … 306 310 applet_long_options = hwclock_longopts; 307 311 #endif 312 313 /* Initialize "timezone" (libc global variable) */ 314 tzset(); 315 308 316 opt_complementary = "r--wst:w--rst:s--wrt:t--rsw:l--u:u--l"; 309 317 opt = getopt32(argv, "lurswtf:", &rtcname); -
branches/3.3/mindi-busybox/util-linux/ipcrm.c
r3232 r3621 120 120 if (remove_ids(what, &argv[2])) 121 121 fflush_stdout_and_exit(EXIT_FAILURE); 122 p rintf("resource(s) deleted\n");122 puts("resource(s) deleted"); 123 123 return 0; 124 124 } -
branches/3.3/mindi-busybox/util-linux/ipcs.c
r3232 r3621 167 167 printf("------ Shared Memory %s --------\n", "Status"); 168 168 printf("segments allocated %d\n" 169 "pages allocated %l d\n"170 "pages resident %l d\n"171 "pages swapped %l d\n"172 "Swap performance: %l d attempts\t%ldsuccesses\n",169 "pages allocated %lu\n" 170 "pages resident %lu\n" 171 "pages swapped %lu\n" 172 "Swap performance: %lu attempts\t%lu successes\n", 173 173 shm_info.used_ids, 174 174 shm_info.shm_tot, … … 570 570 bb_perror_msg_and_die("semctl"); 571 571 } 572 printf("%-10 d%-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);572 printf("%-10u %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); 573 573 } 574 574 bb_putchar('\n'); -
branches/3.3/mindi-busybox/util-linux/losetup.c
r3232 r3621 9 9 10 10 //usage:#define losetup_trivial_usage 11 //usage: "[-r] [-o OFS] LOOPDEVFILE - associate loop devices\n"11 //usage: "[-r] [-o OFS] {-f|LOOPDEV} FILE - associate loop devices\n" 12 12 //usage: " losetup -d LOOPDEV - disassociate\n" 13 //usage: " losetup [-f] - show" 13 //usage: " losetup -a - show status\n" 14 //usage: " losetup -f - show next free loop device" 14 15 //usage:#define losetup_full_usage "\n\n" 15 16 //usage: " -o OFS Start OFS bytes into FILE" 16 17 //usage: "\n -r Read-only" 17 //usage: "\n -f Show first free loop device"18 //usage: "\n -f Show/use next free loop device" 18 19 //usage: 19 20 //usage:#define losetup_notes_usage 20 //usage: "No arguments will display all current associations.\n"21 21 //usage: "One argument (losetup /dev/loop1) will display the current association\n" 22 22 //usage: "(if any), or disassociate it (with -d). The display shows the offset\n" … … 28 28 #include "libbb.h" 29 29 30 /* 1048575 is a max possible minor number in Linux circa 2010 */ 31 /* for now use something less extreme */ 32 #define MAX_LOOP_NUM 1023 33 30 34 int losetup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 31 35 int losetup_main(int argc UNUSED_PARAM, char **argv) 32 36 { 33 37 unsigned opt; 34 int n;35 38 char *opt_o; 36 unsigned long long offset = 0;39 char dev[LOOP_NAMESIZE]; 37 40 enum { 38 41 OPT_d = (1 << 0), 39 42 OPT_o = (1 << 1), 40 43 OPT_f = (1 << 2), 41 OPT_r = (1 << 3), /* must be last */ 44 OPT_a = (1 << 3), 45 OPT_r = (1 << 4), /* must be last */ 42 46 }; 43 47 44 /* max 2 args, -d,-o,-f opts are mutually exclusive */ 45 opt_complementary = "?2:d--of:o--df:f--do"; 46 opt = getopt32(argv, "do:fr", &opt_o); 48 opt_complementary = "?2:d--ofar:a--ofr"; 49 opt = getopt32(argv, "do:far", &opt_o); 47 50 argv += optind; 48 51 49 if (opt == OPT_o) 50 offset = xatoull(opt_o); 51 52 if (opt == OPT_d) { 53 /* -d BLOCKDEV */ 54 if (!argv[0] || argv[1]) 55 bb_show_usage(); 56 if (del_loop(argv[0])) 57 bb_simple_perror_msg_and_die(argv[0]); 58 return EXIT_SUCCESS; 59 } 60 61 if (argv[0]) { 52 /* LOOPDEV */ 53 if (!opt && argv[0] && !argv[1]) { 62 54 char *s; 63 55 64 if (opt == OPT_f) /* -f should not have arguments */65 bb_show_usage();66 67 if (argv[1]) {68 /* [-r] [-o OFS] BLOCKDEV FILE */69 if (set_loop(&argv[0], argv[1], offset, (opt / OPT_r)) < 0)70 bb_simple_perror_msg_and_die(argv[0]);71 return EXIT_SUCCESS;72 }73 /* [-r] [-o OFS] BLOCKDEV */74 56 s = query_loop(argv[0]); 75 57 if (!s) … … 81 63 } 82 64 83 /* [-r] [-o OFS|-f] with no params */ 84 n = 0; 85 while (1) { 65 /* -d LOOPDEV */ 66 if (opt == OPT_d && argv[0]) { 67 if (del_loop(argv[0])) 68 bb_simple_perror_msg_and_die(argv[0]); 69 return EXIT_SUCCESS; 70 } 71 72 /* -a */ 73 if (opt == OPT_a) { 74 int n; 75 for (n = 0; n < MAX_LOOP_NUM; n++) { 76 char *s; 77 78 sprintf(dev, LOOP_FORMAT, n); 79 s = query_loop(dev); 80 if (s) { 81 printf("%s: %s\n", dev, s); 82 free(s); 83 } 84 } 85 return EXIT_SUCCESS; 86 } 87 88 /* contains -f */ 89 if (opt & OPT_f) { 86 90 char *s; 87 char dev[LOOP_NAMESIZE];91 int n = 0; 88 92 89 sprintf(dev, LOOP_FORMAT, n); 90 s = query_loop(dev); 91 n++; 92 if (!s) { 93 if (n > 9 && errno && errno != ENXIO) 94 return EXIT_SUCCESS; 95 if (opt == OPT_f) { 96 puts(dev); 97 return EXIT_SUCCESS; 98 } 99 } else { 100 if (opt != OPT_f) 101 printf("%s: %s\n", dev, s); 102 if (ENABLE_FEATURE_CLEAN_UP) 103 free(s); 93 do { 94 if (n > MAX_LOOP_NUM) 95 bb_error_msg_and_die("no free loop devices"); 96 sprintf(dev, LOOP_FORMAT, n++); 97 s = query_loop(dev); 98 free(s); 99 } while (s); 100 /* now: dev is next free "/dev/loopN" */ 101 if ((opt == OPT_f) && !argv[0]) { 102 puts(dev); 103 return EXIT_SUCCESS; 104 104 } 105 105 } 106 return EXIT_SUCCESS; 106 107 /* [-r] [-o OFS] {-f|LOOPDEV} FILE */ 108 if (argv[0] && ((opt & OPT_f) || argv[1])) { 109 unsigned long long offset = 0; 110 char *d = dev; 111 112 if (opt & OPT_o) 113 offset = xatoull(opt_o); 114 if (!(opt & OPT_f)) 115 d = *argv++; 116 117 if (argv[0]) { 118 if (set_loop(&d, argv[0], offset, (opt & OPT_r)) < 0) 119 bb_simple_perror_msg_and_die(argv[0]); 120 return EXIT_SUCCESS; 121 } 122 } 123 124 bb_show_usage(); /* does not return */ 125 /*return EXIT_FAILURE;*/ 107 126 } -
branches/3.3/mindi-busybox/util-linux/mdev.c
r3232 r3621 98 98 99 99 #include "libbb.h" 100 #include "common_bufsiz.h" 100 101 #include "xregex.h" 101 102 … … 284 285 #endif 285 286 struct rule cur_rule; 286 char timestr[sizeof(" 60.123456")];287 char timestr[sizeof("HH:MM:SS.123456")]; 287 288 } FIX_ALIASING; 288 #define G (*(struct globals*) &bb_common_bufsiz1)289 #define G (*(struct globals*)bb_common_bufsiz1) 289 290 #define INIT_G() do { \ 291 setup_common_bufsiz(); \ 290 292 IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.maj = -1;) \ 291 293 IF_NOT_FEATURE_MDEV_CONF(G.cur_rule.mode = 0660;) \ … … 324 326 } 325 327 make_default_cur_rule(); 326 }327 328 /* In later versions, endofname is in libbb */329 #define endofname mdev_endofname330 static331 const char* FAST_FUNC332 endofname(const char *name)333 {334 #define is_name(c) ((c) == '_' || isalpha((unsigned char)(c)))335 #define is_in_name(c) ((c) == '_' || isalnum((unsigned char)(c)))336 if (!is_name(*name))337 return name;338 while (*++name) {339 if (!is_in_name(*name))340 break;341 }342 return name;343 328 } 344 329 … … 418 403 419 404 /* 2nd field: uid:gid - device ownership */ 420 if (get_uidgid(&G.cur_rule.ugid, tokens[1] , /*allow_numeric:*/ 1) == 0) {405 if (get_uidgid(&G.cur_rule.ugid, tokens[1]) == 0) { 421 406 bb_error_msg("unknown user/group '%s' on line %d", tokens[1], G.parser->lineno); 422 407 goto next_rule; … … 424 409 425 410 /* 3rd field: mode - device permissions */ 426 bb_parse_mode(tokens[2], &G.cur_rule.mode);411 G.cur_rule.mode = bb_parse_mode(tokens[2], G.cur_rule.mode); 427 412 428 413 /* 4th field (opt): ">|=alias" or "!" to not create the node */ … … 489 474 parse_next_rule(); 490 475 if (G.rule_vec) { /* mdev -s */ 491 rule = memcpy(xmalloc(sizeof(G.cur_rule)),&G.cur_rule, sizeof(G.cur_rule));476 rule = xmemdup(&G.cur_rule, sizeof(G.cur_rule)); 492 477 G.rule_vec = xrealloc_vector(G.rule_vec, 4, G.rule_idx); 493 478 G.rule_vec[G.rule_idx++] = rule; … … 628 613 */ 629 614 type = S_IFCHR; 630 if (strstr(path, "/block/") || (G.subsystem && strncmp(G.subsystem, "block", 5) == 0))615 if (strstr(path, "/block/") || (G.subsystem && is_prefixed_with(G.subsystem, "block"))) 631 616 type = S_IFBLK; 632 617 … … 941 926 struct timeval tv; 942 927 gettimeofday(&tv, NULL); 943 sprintf(G.timestr, "%u.%06u", (unsigned)tv.tv_sec % 60, (unsigned)tv.tv_usec); 928 sprintf( 929 strftime_HHMMSS(G.timestr, sizeof(G.timestr), &tv.tv_sec), 930 ".%06u", 931 (unsigned)tv.tv_usec 932 ); 944 933 return G.timestr; 945 934 } … … 961 950 */ 962 951 static int 963 wait_for_seqfile( const char *seq)952 wait_for_seqfile(unsigned expected_seq) 964 953 { 965 954 /* We time out after 2 sec */ … … 976 965 for (;;) { 977 966 int seqlen; 978 char seqbuf[sizeof(int)*3 + 2]; 967 char seqbuf[sizeof(long)*3 + 2]; 968 unsigned seqbufnum; 979 969 980 970 if (seq_fd < 0) { … … 982 972 if (seq_fd < 0) 983 973 break; 974 close_on_exec_on(seq_fd); 984 975 } 985 976 seqlen = pread(seq_fd, seqbuf, sizeof(seqbuf) - 1, 0); … … 990 981 } 991 982 seqbuf[seqlen] = '\0'; 992 if (seqbuf[0] == '\n' ) {983 if (seqbuf[0] == '\n' || seqbuf[0] == '\0') { 993 984 /* seed file: write out seq ASAP */ 994 xwrite_str(seq_fd, seq);985 xwrite_str(seq_fd, utoa(expected_seq)); 995 986 xlseek(seq_fd, 0, SEEK_SET); 996 987 dbg2("first seq written"); 997 988 break; 998 989 } 999 if (strcmp(seq, seqbuf) == 0) { 990 seqbufnum = atoll(seqbuf); 991 if (seqbufnum == expected_seq) { 1000 992 /* correct idx */ 1001 993 break; 1002 994 } 995 if (seqbufnum > expected_seq) { 996 /* a later mdev runs already (this was seen by users to happen) */ 997 /* do not overwrite seqfile on exit */ 998 close(seq_fd); 999 seq_fd = -1; 1000 break; 1001 } 1003 1002 if (do_once) { 1004 dbg2("%s waiting for '%s'", curtime(), seqbuf);1003 dbg2("%s mdev.seq='%s', need '%u'", curtime(), seqbuf, expected_seq); 1005 1004 do_once = 0; 1006 1005 } … … 1010 1009 } 1011 1010 if (--timeout == 0) { 1012 dbg1("%s waiting for'%s'", "timed out", seqbuf);1011 dbg1("%s mdev.seq='%s'", "timed out", seqbuf); 1013 1012 break; 1014 1013 } … … 1093 1092 char *env_devpath; 1094 1093 unsigned my_pid; 1094 unsigned seqnum = seqnum; /* for compiler */ 1095 1095 int seq_fd; 1096 1096 smalluint op; … … 1101 1101 * DEVPATH is like "/block/sda" or "/class/input/mice" 1102 1102 */ 1103 env_devname = getenv("DEVNAME"); /* can be NULL */ 1104 G.subsystem = getenv("SUBSYSTEM"); 1103 1105 action = getenv("ACTION"); 1104 op = index_in_strings(keywords, action);1105 env_devname = getenv("DEVNAME"); /* can be NULL */1106 1106 env_devpath = getenv("DEVPATH"); 1107 G.subsystem = getenv("SUBSYSTEM");1108 1107 if (!action || !env_devpath /*|| !G.subsystem*/) 1109 1108 bb_show_usage(); 1110 1109 fw = getenv("FIRMWARE"); 1111 1110 seq = getenv("SEQNUM"); 1111 op = index_in_strings(keywords, action); 1112 1112 1113 1113 my_pid = getpid(); 1114 1114 open_mdev_log(seq, my_pid); 1115 1115 1116 seq_fd = seq ? wait_for_seqfile(seq) : -1; 1116 seq_fd = -1; 1117 if (seq) { 1118 seqnum = atoll(seq); 1119 seq_fd = wait_for_seqfile(seqnum); 1120 } 1117 1121 1118 1122 dbg1("%s " … … 1142 1146 dbg1("%s exiting", curtime()); 1143 1147 if (seq_fd >= 0) { 1144 xwrite_str(seq_fd, utoa( xatou(seq)+ 1));1148 xwrite_str(seq_fd, utoa(seqnum + 1)); 1145 1149 signal_mdevs(my_pid); 1146 1150 } -
branches/3.3/mindi-busybox/util-linux/minix.h
r2725 r3621 62 62 MINIX_BAD_INO = 2, 63 63 64 #undef MINIX1_SUPER_MAGIC 64 65 MINIX1_SUPER_MAGIC = 0x137F, /* original minix fs */ 66 #undef MINIX1_SUPER_MAGIC2 65 67 MINIX1_SUPER_MAGIC2 = 0x138F, /* minix fs, 30 char names */ 68 /* bionic has this define */ 69 #undef MINIX2_SUPER_MAGIC 66 70 MINIX2_SUPER_MAGIC = 0x2468, /* minix V2 fs */ 71 #undef MINIX2_SUPER_MAGIC2 67 72 MINIX2_SUPER_MAGIC2 = 0x2478, /* minix V2 fs, 30 char names */ 68 73 MINIX_VALID_FS = 0x0001, /* clean fs */ -
branches/3.3/mindi-busybox/util-linux/mkfs_ext2.c
r3232 r3621 117 117 uint32_t i; 118 118 119 //bb_ info_msg("ALLOC: [%u][%u][%u]: [%u-%u]:=[%x],[%x]", blocksize, start, end, start/8, blocksize - end/8 - 1, (1 << (start & 7)) - 1, (uint8_t)(0xFF00 >> (end & 7)));119 //bb_error_msg("ALLOC: [%u][%u][%u]: [%u-%u]:=[%x],[%x]", blocksize, start, end, start/8, blocksize - end/8 - 1, (1 << (start & 7)) - 1, (uint8_t)(0xFF00 >> (end & 7))); 120 120 memset(bitmap, 0, blocksize); 121 121 i = start / 8; … … 152 152 static void PUT(uint64_t off, void *buf, uint32_t size) 153 153 { 154 // bb_info_msg("PUT[%llu]:[%u]", off, size);154 //bb_error_msg("PUT[%llu]:[%u]", off, size); 155 155 xlseek(fd, off, SEEK_SET); 156 156 xwrite(fd, buf, size); … … 413 413 // transition (at 16M). 414 414 if (remainder && (remainder < overhead + 50)) { 415 //bb_ info_msg("CHOP[%u]", remainder);415 //bb_error_msg("CHOP[%u]", remainder); 416 416 nblocks -= remainder; 417 417 goto retry; … … 569 569 570 570 // mark preallocated blocks as allocated 571 //bb_ info_msg("ALLOC: [%u][%u][%u]", blocksize, overhead, blocks_per_group - (free_blocks + overhead));571 //bb_error_msg("ALLOC: [%u][%u][%u]", blocksize, overhead, blocks_per_group - (free_blocks + overhead)); 572 572 allocate(buf, blocksize, 573 573 // reserve "overhead" blocks … … 648 648 for (i = 0; i < lost_and_found_blocks; ++i) 649 649 STORE_LE(inode->i_block[i], i + n); // use next block 650 //bb_ info_msg("LAST BLOCK USED[%u]", i + n);650 //bb_error_msg("LAST BLOCK USED[%u]", i + n); 651 651 PUT(((uint64_t)FETCH_LE32(gd[0].bg_inode_table) * blocksize) + (EXT2_GOOD_OLD_FIRST_INO-1) * inodesize, 652 652 buf, inodesize); -
branches/3.3/mindi-busybox/util-linux/mkfs_minix.c
r3232 r3621 196 196 # define BLKGETSIZE _IO(0x12,96) /* return device size */ 197 197 #endif 198 199 200 static long valid_offset(int fd, int offset)201 {202 char ch;203 204 if (lseek(fd, offset, SEEK_SET) < 0)205 return 0;206 if (read(fd, &ch, 1) < 1)207 return 0;208 return 1;209 }210 211 static int count_blocks(int fd)212 {213 int high, low;214 215 low = 0;216 for (high = 1; valid_offset(fd, high); high *= 2)217 low = high;218 219 while (low < high - 1) {220 const int mid = (low + high) / 2;221 222 if (valid_offset(fd, mid))223 low = mid;224 else225 high = mid;226 }227 valid_offset(fd, 0);228 return (low + 1);229 }230 231 static int get_size(const char *file)232 {233 int fd;234 long size;235 236 fd = xopen(file, O_RDWR);237 if (ioctl(fd, BLKGETSIZE, &size) >= 0) {238 close(fd);239 return (size * 512);240 }241 242 size = count_blocks(fd);243 close(fd);244 return size;245 }246 198 247 199 static void write_tables(void) … … 554 506 listfile = xfopen_for_read(filename); 555 507 while (!feof(listfile)) { 556 fscanf(listfile, "%l d\n", &blockno);508 fscanf(listfile, "%lu\n", &blockno); 557 509 mark_zone(blockno); 558 510 G.badblocks++; … … 625 577 unmark_inode(i); 626 578 G.inode_buffer = xzalloc(INODE_BUFFER_SIZE); 627 printf("%l d inodes\n", (long)SB_INODES);628 printf("%l d blocks\n", (long)SB_ZONES);629 printf("Firstdatazone=%l d (%ld)\n", (long)SB_FIRSTZONE, (long)norm_firstzone);630 printf("Zonesize=% d\n", BLOCK_SIZE << SB_ZONE_SIZE);631 printf("Maxsize=%l d\n", (long)SB_MAXSIZE);579 printf("%lu inodes\n", (unsigned long)SB_INODES); 580 printf("%lu blocks\n", (unsigned long)SB_ZONES); 581 printf("Firstdatazone=%lu (%lu)\n", (unsigned long)SB_FIRSTZONE, (unsigned long)norm_firstzone); 582 printf("Zonesize=%u\n", BLOCK_SIZE << SB_ZONE_SIZE); 583 printf("Maxsize=%lu\n", (unsigned long)SB_MAXSIZE); 632 584 } 633 585 … … 637 589 unsigned opt; 638 590 char *tmp; 639 struct stat statbuf;640 591 char *str_i; 641 592 char *listfile = NULL; … … 674 625 } 675 626 676 G.device_name = *argv++;627 G.device_name = argv[0]; 677 628 if (!G.device_name) 678 629 bb_show_usage(); 679 if (*argv) 680 G.total_blocks = xatou32(*argv); 681 else 682 G.total_blocks = get_size(G.device_name) / 1024; 630 631 /* Check if it is mounted */ 632 if (find_mount_point(G.device_name, 0)) 633 bb_error_msg_and_die("can't format mounted filesystem"); 634 635 xmove_fd(xopen(G.device_name, O_RDWR), dev_fd); 636 637 G.total_blocks = get_volume_size_in_bytes(dev_fd, argv[1], 1024, /*extend:*/ 1) / 1024; 683 638 684 639 if (G.total_blocks < 10) … … 691 646 } else if (G.total_blocks > 65535) 692 647 G.total_blocks = 65535; 693 694 /* Check if it is mounted */ 695 if (find_mount_point(G.device_name, 0)) 696 bb_error_msg_and_die("can't format mounted filesystem"); 697 698 xmove_fd(xopen(G.device_name, O_RDWR), dev_fd); 648 #if 0 649 struct stat statbuf; 699 650 xfstat(dev_fd, &statbuf, G.device_name); 651 /* why? */ 700 652 if (!S_ISBLK(statbuf.st_mode)) 701 653 opt &= ~1; // clear -c (check) 702 654 #if 0 703 655 /* I don't know why someone has special code to prevent mkfs.minix 704 656 * on IDE devices. Why IDE but not SCSI, etc?... */ 705 #if 0706 657 else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) 707 658 /* what is this? */ … … 709 660 "to make filesystem on '%s'", G.device_name); 710 661 #endif 711 662 #endif 712 663 tmp = G.root_block; 713 664 *(short *) tmp = 1; -
branches/3.3/mindi-busybox/util-linux/mkfs_reiser.c
r3232 r3621 67 67 char s_magic[10]; /* 52 "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ 68 68 uint16_t sb_fs_state; /* 62 it is set to used by fsck to mark which phase of rebuilding is done (used for fsck debugging) */ 69 uint32_t sb_hash_function_code; /* 64 code of fu ction which was/is/will be used to sort names in a directory. See codes in above */69 uint32_t sb_hash_function_code; /* 64 code of function which was/is/will be used to sort names in a directory. See codes in above */ 70 70 uint16_t sb_tree_height; /* 68 height of filesytem tree. Tree consisting of only one root block has 2 here */ 71 71 uint16_t sb_bmap_nr; /* 70 amount of bitmap blocks needed to address each block of file system */ … … 225 225 STORE_LE(jp->jp_journal_1st_block, REISERFS_DISK_OFFSET_IN_BYTES / blocksize + 1/*sb*/ + 1/*bmp#0*/); 226 226 timestamp = time(NULL); 227 srand om(timestamp);228 STORE_LE(jp->jp_journal_magic, rand om());227 srand(timestamp); 228 STORE_LE(jp->jp_journal_magic, rand()); 229 229 STORE_LE(jp->jp_journal_size, journal_blocks); 230 230 STORE_LE(jp->jp_journal_trans_max, JOURNAL_TRANS_MAX); -
branches/3.3/mindi-busybox/util-linux/mkfs_vfat.c
r3232 r3621 579 579 start_data_block = (start_data_sector + SECTORS_PER_BLOCK - 1) / SECTORS_PER_BLOCK; 580 580 581 bb_ info_msg("searching for bad blocks");581 bb_error_msg("searching for bad blocks"); 582 582 currently_testing = 0; 583 583 try = TEST_BUFFER_BLOCKS; … … 617 617 free(blkbuf); 618 618 if (badblocks) 619 bb_ info_msg("%d bad block(s)", badblocks);619 bb_error_msg("%d bad block(s)", badblocks); 620 620 } 621 621 #endif -
branches/3.3/mindi-busybox/util-linux/mkswap.c
r3232 r3621 14 14 15 15 #include "libbb.h" 16 #include "common_bufsiz.h" 16 17 17 18 #if ENABLE_SELINUX … … 76 77 #define NWORDS 129 77 78 #define hdr ((struct swap_header_v1*)bb_common_bufsiz1) 79 #define INIT_G() do { setup_common_bufsiz(); } while (0) 78 80 79 81 struct BUG_sizes { … … 92 94 off_t len; 93 95 const char *label = ""; 96 97 INIT_G(); 94 98 95 99 opt_complementary = "-1"; /* at least one param */ -
branches/3.3/mindi-busybox/util-linux/more.c
r3232 r3621 24 24 25 25 #include "libbb.h" 26 #include "common_bufsiz.h" 26 27 27 28 /* Support for FEATURE_USE_TERMIOS */ … … 33 34 } FIX_ALIASING; 34 35 #define G (*(struct globals*)bb_common_bufsiz1) 35 #define INIT_G() ((void)0)36 36 #define initial_settings (G.initial_settings) 37 37 #define new_settings (G.new_settings ) 38 38 #define cin_fileno (G.cin_fileno ) 39 #define INIT_G() do { setup_common_bufsiz(); } while (0) 39 40 40 41 #define setTermSettings(fd, argp) \ -
branches/3.3/mindi-busybox/util-linux/mount.c
r3232 r3621 18 18 // 19 19 20 //config:config MOUNT 21 //config: bool "mount" 22 //config: default y 23 //config: select PLATFORM_LINUX 24 //config: help 25 //config: All files and filesystems in Unix are arranged into one big directory 26 //config: tree. The 'mount' utility is used to graft a filesystem onto a 27 //config: particular part of the tree. A filesystem can either live on a block 28 //config: device, or it can be accessible over the network, as is the case with 29 //config: NFS filesystems. Most people using BusyBox will also want to enable 30 //config: the 'mount' utility. 31 //config: 32 //config:config FEATURE_MOUNT_FAKE 33 //config: bool "Support option -f" 34 //config: default y 35 //config: depends on MOUNT 36 //config: help 37 //config: Enable support for faking a file system mount. 38 //config: 39 //config:config FEATURE_MOUNT_VERBOSE 40 //config: bool "Support option -v" 41 //config: default y 42 //config: depends on MOUNT 43 //config: help 44 //config: Enable multi-level -v[vv...] verbose messages. Useful if you 45 //config: debug mount problems and want to see what is exactly passed 46 //config: to the kernel. 47 //config: 48 //config:config FEATURE_MOUNT_HELPERS 49 //config: bool "Support mount helpers" 50 //config: default n 51 //config: depends on MOUNT 52 //config: help 53 //config: Enable mounting of virtual file systems via external helpers. 54 //config: E.g. "mount obexfs#-b00.11.22.33.44.55 /mnt" will in effect call 55 //config: "obexfs -b00.11.22.33.44.55 /mnt" 56 //config: Also "mount -t sometype [-o opts] fs /mnt" will try 57 //config: "sometype [-o opts] fs /mnt" if simple mount syscall fails. 58 //config: The idea is to use such virtual filesystems in /etc/fstab. 59 //config: 60 //config:config FEATURE_MOUNT_LABEL 61 //config: bool "Support specifying devices by label or UUID" 62 //config: default y 63 //config: depends on MOUNT 64 //config: select VOLUMEID 65 //config: help 66 //config: This allows for specifying a device by label or uuid, rather than by 67 //config: name. This feature utilizes the same functionality as blkid/findfs. 68 //config: This also enables label or uuid support for swapon. 69 //config: 70 //config:config FEATURE_MOUNT_NFS 71 //config: bool "Support mounting NFS file systems on Linux < 2.6.23" 72 //config: default n 73 //config: depends on MOUNT 74 //config: select FEATURE_HAVE_RPC 75 //config: select FEATURE_SYSLOG 76 //config: help 77 //config: Enable mounting of NFS file systems on Linux kernels prior 78 //config: to version 2.6.23. Note that in this case mounting of NFS 79 //config: over IPv6 will not be possible. 80 //config: 81 //config: Note that this option links in RPC support from libc, 82 //config: which is rather large (~10 kbytes on uclibc). 83 //config: 84 //config:config FEATURE_MOUNT_CIFS 85 //config: bool "Support mounting CIFS/SMB file systems" 86 //config: default y 87 //config: depends on MOUNT 88 //config: help 89 //config: Enable support for samba mounts. 90 //config: 91 //config:config FEATURE_MOUNT_FLAGS 92 //config: depends on MOUNT 93 //config: bool "Support lots of -o flags in mount" 94 //config: default y 95 //config: help 96 //config: Without this, mount only supports ro/rw/remount. With this, it 97 //config: supports nosuid, suid, dev, nodev, exec, noexec, sync, async, atime, 98 //config: noatime, diratime, nodiratime, loud, bind, move, shared, slave, 99 //config: private, unbindable, rshared, rslave, rprivate, and runbindable. 100 //config: 101 //config:config FEATURE_MOUNT_FSTAB 102 //config: depends on MOUNT 103 //config: bool "Support /etc/fstab and -a" 104 //config: default y 105 //config: help 106 //config: Support mount all and looking for files in /etc/fstab. 107 //config: 108 //config:config FEATURE_MOUNT_OTHERTAB 109 //config: depends on FEATURE_MOUNT_FSTAB 110 //config: bool "Support -T <alt_fstab>" 111 //config: default y 112 //config: help 113 //config: Support mount -T (specifying an alternate fstab) 114 20 115 //usage:#define mount_trivial_usage 21 //usage: "[OPTIONS] [-o OPT S] DEVICE NODE"116 //usage: "[OPTIONS] [-o OPT] DEVICE NODE" 22 117 //usage:#define mount_full_usage "\n\n" 23 118 //usage: "Mount a filesystem. Filesystem autodetection requires /proc.\n" … … 42 137 ////usage: "\n -s Sloppy (ignored)" 43 138 //usage: "\n -r Read-only mount" 44 // usage: "\n -w Read-write mount (default)"139 ////usage: "\n -w Read-write mount (default)" 45 140 //usage: "\n -t FSTYPE[,...] Filesystem type(s)" 141 //usage: IF_FEATURE_MOUNT_OTHERTAB( 142 //usage: "\n -T FILE Read FILE instead of /etc/fstab" 143 //usage: ) 46 144 //usage: "\n -O OPT Mount only filesystems with option OPT (-a only)" 47 145 //usage: "\n-o OPT:" … … 65 163 //usage: ) 66 164 //usage: "\n remount Remount a mounted filesystem, changing flags" 67 //usage: "\n ro /rw Same as -r/-w"165 //usage: "\n ro Same as -r" 68 166 //usage: "\n" 69 167 //usage: "\nThere are filesystem-specific -o flags." … … 126 224 127 225 #include "libbb.h" 226 #include "common_bufsiz.h" 128 227 #if ENABLE_FEATURE_MOUNT_LABEL 129 228 # include "volume_id.h" … … 162 261 // Not real flags, but we want to be able to check for this. 163 262 enum { 164 MOUNT_USERS = (1 << 28) * ENABLE_DESKTOP, 263 MOUNT_USERS = (1 << 27) * ENABLE_DESKTOP, 264 MOUNT_NOFAIL = (1 << 28) * ENABLE_DESKTOP, 165 265 MOUNT_NOAUTO = (1 << 29), 166 266 MOUNT_SWAP = (1 << 30), 267 MOUNT_FAKEFLAGS = MOUNT_USERS | MOUNT_NOFAIL | MOUNT_NOAUTO | MOUNT_SWAP 167 268 }; 168 269 169 270 170 #define OPTION_STR "o:t:rwanfvsiO:" 271 #define OPTION_STR "o:t:rwanfvsiO:" IF_FEATURE_MOUNT_OTHERTAB("T:") 171 272 enum { 172 273 OPT_o = (1 << 0), … … 181 282 OPT_i = (1 << 9), 182 283 OPT_O = (1 << 10), 284 OPT_T = (1 << 11), 183 285 }; 184 286 … … 228 330 IF_DESKTOP(/* "user" */ MOUNT_USERS,) 229 331 IF_DESKTOP(/* "users" */ MOUNT_USERS,) 332 IF_DESKTOP(/* "nofail" */ MOUNT_NOFAIL,) 230 333 /* "_netdev" */ 0, 231 334 IF_DESKTOP(/* "comment=" */ 0,) /* systemd uses this in fstab */ … … 275 378 }; 276 379 277 static const char mount_option_str[] =380 static const char mount_option_str[] ALIGN1 = 278 381 IF_FEATURE_MOUNT_LOOP( 279 382 "loop\0" … … 287 390 IF_DESKTOP("user\0") 288 391 IF_DESKTOP("users\0") 392 IF_DESKTOP("nofail\0") 289 393 "_netdev\0" 290 394 IF_DESKTOP("comment=\0") /* systemd uses this in fstab */ … … 345 449 } FIX_ALIASING; 346 450 enum { GETMNTENT_BUFSIZE = COMMON_BUFSIZE - offsetof(struct globals, getmntent_buf) }; 347 #define G (*(struct globals*) &bb_common_bufsiz1)451 #define G (*(struct globals*)bb_common_bufsiz1) 348 452 #define nfs_mount_version (G.nfs_mount_version) 349 453 #if ENABLE_FEATURE_MOUNT_VERBOSE … … 354 458 #define fslist (G.fslist ) 355 459 #define getmntent_buf (G.getmntent_buf ) 356 #define INIT_G() do { } while (0)460 #define INIT_G() do { setup_common_bufsiz(); } while (0) 357 461 358 462 #if ENABLE_FEATURE_MTAB_SUPPORT … … 543 647 544 648 while ((buf = xmalloc_fgetline(f)) != NULL) { 545 if ( strncmp(buf, "nodev", 5) == 0&& isspace(buf[5]))649 if (is_prefixed_with(buf, "nodev") && isspace(buf[5])) 546 650 goto next; 547 651 fs = skip_whitespace(buf); … … 573 677 { 574 678 int rc = 0; 679 680 vfsflags &= ~(unsigned long)MOUNT_FAKEFLAGS; 575 681 576 682 if (FAKE_IT) { … … 898 1004 #endif 899 1005 /* Convert each NFSERR_BLAH into EBLAH */ 900 static const uint8_t nfs_err_stat[] = {1006 static const uint8_t nfs_err_stat[] ALIGN1 = { 901 1007 1, 2, 5, 6, 13, 17, 902 1008 19, 20, 21, 22, 27, 28, … … 911 1017 typedef uint16_t nfs_err_type; 912 1018 #endif 913 static const nfs_err_type nfs_err_errnum[] = {1019 static const nfs_err_type nfs_err_errnum[] ALIGN2 = { 914 1020 EPERM , ENOENT , EIO , ENXIO , EACCES, EEXIST, 915 1021 ENODEV, ENOTDIR , EISDIR , EINVAL, EFBIG , ENOSPC, … … 1266 1372 continue; 1267 1373 case 18: // "proto" 1268 if ( !strncmp(opteq, "tcp", 3))1374 if (is_prefixed_with(opteq, "tcp")) 1269 1375 tcp = 1; 1270 else if ( !strncmp(opteq, "udp", 3))1376 else if (is_prefixed_with(opteq, "udp")) 1271 1377 tcp = 0; 1272 1378 else … … 1361 1467 "acl\0"; 1362 1468 int val = 1; 1363 if ( !strncmp(opt, "no", 2)) {1469 if (is_prefixed_with(opt, "no")) { 1364 1470 val = 0; 1365 1471 opt += 2; … … 1857 1963 share + len + 1 /* "dir1/dir2" */ 1858 1964 ); 1859 1860 1965 parse_mount_options(unc, &filteropts); 1966 if (ENABLE_FEATURE_CLEAN_UP) free(unc); 1861 1967 } 1862 1968 … … 1881 1987 1882 1988 // Might this be an NFS filesystem? 1883 if ((!mp->mnt_type || strncmp(mp->mnt_type, "nfs", 3) == 0)1989 if ((!mp->mnt_type || is_prefixed_with(mp->mnt_type, "nfs")) 1884 1990 && strchr(mp->mnt_fsname, ':') != NULL 1885 1991 ) { … … 1953 2059 if (ENABLE_FEATURE_CLEAN_UP) { 1954 2060 free(loopFile); 1955 free(mp->mnt_fsname);2061 /* No, "rc != 0" needs it: free(mp->mnt_fsname); */ 1956 2062 } 1957 2063 } … … 1962 2068 1963 2069 if (errno == EBUSY && ignore_busy) 2070 return 0; 2071 if (errno == ENOENT && (vfsflags & MOUNT_NOFAIL)) 1964 2072 return 0; 1965 2073 if (rc != 0) … … 2035 2143 char *storage_path; 2036 2144 llist_t *lst_o = NULL; 2037 const char *fstabname ;2145 const char *fstabname = "/etc/fstab"; 2038 2146 FILE *fstab; 2039 2147 int i, j; … … 2062 2170 opt_complementary = "?2o::" IF_FEATURE_MOUNT_VERBOSE("vv"); 2063 2171 opt = getopt32(argv, OPTION_STR, &lst_o, &fstype, &O_optmatch 2172 IF_FEATURE_MOUNT_OTHERTAB(, &fstabname) 2064 2173 IF_FEATURE_MOUNT_VERBOSE(, &verbose)); 2065 2174 while (lst_o) append_mount_options(&cmdopts, llist_pop(&lst_o)); // -o … … 2129 2238 } 2130 2239 2240 // A malicious user could overmount /usr without this. 2241 if (ENABLE_FEATURE_MOUNT_OTHERTAB && nonroot) 2242 fstabname = "/etc/fstab"; 2131 2243 // Open either fstab or mtab 2132 fstabname = "/etc/fstab";2133 2244 if (cmdopt_flags & MS_REMOUNT) { 2134 2245 // WARNING. I am not sure this matches util-linux's -
branches/3.3/mindi-busybox/util-linux/rdate.c
r3232 r3621 12 12 //usage: "[-sp] HOST" 13 13 //usage:#define rdate_full_usage "\n\n" 14 //usage: "Get and possibly set the system date/time from a remote HOST\n"15 //usage: "\n -s Set the system date/time (default)"16 //usage: "\n -p Print t he date/time"14 //usage: "Get and possibly set system time from a remote HOST\n" 15 //usage: "\n -s Set system time (default)" 16 //usage: "\n -p Print time" 17 17 18 18 #include "libbb.h" … … 37 37 38 38 if (safe_read(fd, &nett, 4) != 4) /* read time from server */ 39 bb_error_msg_and_die("%s did not send the complete time", host);39 bb_error_msg_and_die("%s: %s", host, "short read"); 40 40 if (ENABLE_FEATURE_CLEAN_UP) 41 41 close(fd); -
branches/3.3/mindi-busybox/util-linux/readprofile.c
r3232 r3621 153 153 step = buf[0]; 154 154 if (optInfo) { 155 printf("Sampling_step: % i\n", step);155 printf("Sampling_step: %u\n", step); 156 156 return EXIT_SUCCESS; 157 157 } … … 220 220 ) { 221 221 if (optVerbose) 222 printf("%016llx %-40s %6 i%8.4f\n", fn_add,222 printf("%016llx %-40s %6u %8.4f\n", fn_add, 223 223 fn_name, this, this/(double)fn_len); 224 224 else 225 printf("%6 i%-40s %8.4f\n",225 printf("%6u %-40s %8.4f\n", 226 226 this, fn_name, this/(double)fn_len); 227 227 if (optSub) { … … 247 247 248 248 /* clock ticks, out of kernel text - probably modules */ 249 printf("%6 i%s\n", buf[len/sizeof(*buf)-1], "*unknown*");249 printf("%6u %s\n", buf[len/sizeof(*buf)-1], "*unknown*"); 250 250 251 251 /* trailer */ 252 252 if (optVerbose) 253 printf("%016x %-40s %6 i%8.4f\n",253 printf("%016x %-40s %6u %8.4f\n", 254 254 0, "total", total, total/(double)(fn_add-add0)); 255 255 else 256 printf("%6 i%-40s %8.4f\n",256 printf("%6u %-40s %8.4f\n", 257 257 total, "total", total/(double)(fn_add-add0)); 258 258 -
branches/3.3/mindi-busybox/util-linux/rtcwake.c
r3232 r3621 33 33 //usage: "\n -u,--utc Clock is set to UTC time" 34 34 //usage: "\n -d,--device=DEV Specify the RTC device" 35 //usage: "\n -m,--mode=MODE Set thesleep state (default: standby)"36 //usage: "\n -s,--seconds=SEC Set t he timeout in SEC seconds from now"37 //usage: "\n -t,--time=TIME Set t he timeout to TIME seconds from epoch"35 //usage: "\n -m,--mode=MODE Set sleep state (default: standby)" 36 //usage: "\n -s,--seconds=SEC Set timeout in SEC seconds from now" 37 //usage: "\n -t,--time=TIME Set timeout to TIME seconds from epoch" 38 38 //usage: ) 39 39 //usage: IF_NOT_LONG_OPTS( … … 42 42 //usage: "\n -u Clock is set to UTC time" 43 43 //usage: "\n -d DEV Specify the RTC device" 44 //usage: "\n -m MODE Set thesleep state (default: standby)"45 //usage: "\n -s SEC Set t he timeout in SEC seconds from now"46 //usage: "\n -t TIME Set t he timeout to TIME seconds from epoch"44 //usage: "\n -m MODE Set sleep state (default: standby)" 45 //usage: "\n -s SEC Set timeout in SEC seconds from now" 46 //usage: "\n -t TIME Set timeout to TIME seconds from epoch" 47 47 //usage: ) 48 48 … … 52 52 #define SYS_RTC_PATH "/sys/class/rtc/%s/device/power/wakeup" 53 53 #define SYS_POWER_PATH "/sys/power/state" 54 #define DEFAULT_MODE "standby"55 54 56 55 static NOINLINE bool may_wakeup(const char *rtcname) … … 68 67 69 68 /* wakeup events could be disabled or not supported */ 70 return strncmp(buf, "enabled\n", 8) == 0;69 return is_prefixed_with(buf, "enabled\n") != NULL; 71 70 } 72 71 … … 123 122 int rtcwake_main(int argc UNUSED_PARAM, char **argv) 124 123 { 125 time_t rtc_time;126 127 124 unsigned opt; 128 125 const char *rtcname = NULL; 129 const char *suspend ;126 const char *suspend = "standby"; 130 127 const char *opt_seconds; 131 128 const char *opt_time; 132 129 130 time_t rtc_time; 133 131 time_t sys_time; 134 time_t alarm_time = 0;135 unsigned seconds = 0;132 time_t alarm_time = alarm_time; 133 unsigned seconds = seconds; /* for compiler */ 136 134 int utc = -1; 137 135 int fd; … … 149 147 applet_long_options = rtcwake_longopts; 150 148 #endif 149 /* Must have -s or -t, exclusive */ 150 opt_complementary = "s:t:s--t:t--s"; 151 151 opt = getopt32(argv, "alud:m:s:t:", &rtcname, &suspend, &opt_seconds, &opt_time); 152 152 … … 157 157 if (opt & (RTCWAKE_OPT_UTC | RTCWAKE_OPT_LOCAL)) 158 158 utc = opt & RTCWAKE_OPT_UTC; 159 if (!(opt & RTCWAKE_OPT_SUSPEND_MODE)) 160 suspend = DEFAULT_MODE; 161 if (opt & RTCWAKE_OPT_SECONDS) 159 if (opt & RTCWAKE_OPT_SECONDS) { 162 160 /* alarm time, seconds-to-sleep (relative) */ 163 seconds = xatoi(opt_seconds); 164 if (opt & RTCWAKE_OPT_TIME) 161 seconds = xatou(opt_seconds); 162 } else { 163 /* RTCWAKE_OPT_TIME */ 165 164 /* alarm time, time_t (absolute, seconds since 1/1 1970 UTC) */ 166 alarm_time = xatol(opt_time); 167 168 if (!alarm_time && !seconds) 169 bb_error_msg_and_die("must provide wake time"); 165 if (sizeof(alarm_time) <= sizeof(long)) 166 alarm_time = xatol(opt_time); 167 else 168 alarm_time = xatoll(opt_time); 169 } 170 170 171 171 if (utc == -1) … … 178 178 fd = rtc_xopen(&rtcname, O_RDONLY); 179 179 180 if (strcmp(suspend, "on") && !may_wakeup(rtcname)) 181 bb_error_msg_and_die("%s not enabled for wakeup events", rtcname); 180 if (strcmp(suspend, "on") != 0) 181 if (!may_wakeup(rtcname)) 182 bb_error_msg_and_die("%s not enabled for wakeup events", rtcname); 182 183 183 184 /* relative or absolute alarm time, normalized to time_t */ … … 189 190 } 190 191 191 192 if (alarm_time) { 193 if (alarm_time < sys_time) 192 if (opt & RTCWAKE_OPT_TIME) { 193 /* Correct for RTC<->system clock difference */ 194 alarm_time += rtc_time - sys_time; 195 if (alarm_time < rtc_time) 196 /* 197 * Compat message text. 198 * I'd say "RTC time is already ahead of ..." instead. 199 */ 194 200 bb_error_msg_and_die("time doesn't go backward to %s", ctime(&alarm_time)); 195 alarm_time += sys_time - rtc_time;196 201 } else 197 202 alarm_time = rtc_time + seconds + 1; 203 198 204 setup_alarm(fd, &alarm_time, rtc_time); 199 200 205 sync(); 206 #if 0 /*debug*/ 207 printf("sys_time: %s", ctime(&sys_time)); 208 printf("rtc_time: %s", ctime(&rtc_time)); 209 #endif 201 210 printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time)); 202 211 fflush_all(); 203 212 usleep(10 * 1000); 204 213 205 if (strcmp(suspend, "on") )214 if (strcmp(suspend, "on") != 0) 206 215 xopen_xwrite_close(SYS_POWER_PATH, suspend); 207 216 else { -
branches/3.3/mindi-busybox/util-linux/script.c
r3232 r3621 24 24 25 25 #include "libbb.h" 26 #include "common_bufsiz.h" 26 27 27 28 int script_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; … … 78 79 printf("Script started, file is %s\n", fname); 79 80 } 81 80 82 shell = get_shell_name(); 83 84 /* Some people run "script ... 0>&-". 85 * Our code assumes that STDIN_FILENO != pty. 86 * Ensure STDIN_FILENO is not closed: 87 */ 88 bb_sanitize_stdio(); 81 89 82 90 pty = xgetpty(pty_line); … … 102 110 if (child_pid) { 103 111 /* parent */ 104 #define buf bb_common_bufsiz1105 112 struct pollfd pfd[2]; 106 113 int outfd, count, loop; 107 114 double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0; 108 115 smallint fd_count = 2; 116 #define buf bb_common_bufsiz1 117 setup_common_bufsiz(); 109 118 110 119 outfd = xopen(fname, mode); … … 128 137 if (pfd[0].revents) { 129 138 errno = 0; 130 count = safe_read(pty, buf, sizeof(buf));139 count = safe_read(pty, buf, COMMON_BUFSIZE); 131 140 if (count <= 0 && errno != EAGAIN) { 132 141 /* err/eof from pty: exit */ … … 151 160 } 152 161 if (pfd[1].revents) { 153 count = safe_read(STDIN_FILENO, buf, sizeof(buf));162 count = safe_read(STDIN_FILENO, buf, COMMON_BUFSIZE); 154 163 if (count <= 0) { 155 164 /* err/eof from stdin: don't read stdin anymore */ … … 170 179 loop = 999; 171 180 /* pty is in O_NONBLOCK mode, we exit as soon as buffer is empty */ 172 while (--loop && (count = safe_read(pty, buf, sizeof(buf))) > 0) {181 while (--loop && (count = safe_read(pty, buf, COMMON_BUFSIZE)) > 0) { 173 182 full_write(STDOUT_FILENO, buf, count); 174 183 full_write(outfd, buf, count); -
branches/3.3/mindi-busybox/util-linux/setarch.c
r3232 r3621 7 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 //config:config SETARCH 10 //config: bool "setarch" 11 //config: default y 12 //config: select PLATFORM_LINUX 13 //config: help 14 //config: The linux32 utility is used to create a 32bit environment for the 15 //config: specified program (usually a shell). It only makes sense to have 16 //config: this util on a system that supports both 64bit and 32bit userland 17 //config: (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...). 18 19 //applet:IF_SETARCH(APPLET(setarch, BB_DIR_BIN, BB_SUID_DROP)) 20 //applet:IF_SETARCH(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32)) 21 //applet:IF_SETARCH(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64)) 22 23 //kbuild:lib-$(CONFIG_SETARCH) += setarch.o 9 24 10 25 //usage:#define setarch_trivial_usage 11 //usage: " personalityPROG ARGS"26 //usage: "PERSONALITY [-R] PROG ARGS" 12 27 //usage:#define setarch_full_usage "\n\n" 13 //usage: "Personality may be:\n" 14 //usage: " linux32 Set 32bit uname emulation\n" 15 //usage: " linux64 Set 64bit uname emulation" 28 //usage: "PERSONALITY may be:" 29 //usage: "\n"" linux32 Set 32bit uname emulation" 30 //usage: "\n"" linux64 Set 64bit uname emulation" 31 //usage: "\n" 32 //usage: "\n"" -R Disable address space randomization" 16 33 //usage: 17 34 //usage:#define linux32_trivial_usage NOUSAGE_STR … … 21 38 //usage:#define linux64_full_usage "" 22 39 40 #include "libbb.h" 23 41 #include <sys/personality.h> 24 42 25 #include "libbb.h" 43 #ifndef ADDR_NO_RANDOMIZE 44 # define ADDR_NO_RANDOMIZE 0x0040000 45 #endif 26 46 27 47 int setarch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 28 48 int setarch_main(int argc UNUSED_PARAM, char **argv) 29 49 { 30 int pers; 50 unsigned opts; 51 unsigned long pers; 31 52 32 53 /* Figure out what personality we are supposed to switch to ... … … 36 57 */ 37 58 if (ENABLE_SETARCH && applet_name[0] == 's' 38 && argv[1] && strncpy(argv[1], "linux", 5)59 && argv[1] && is_prefixed_with(argv[1], "linux") 39 60 ) { 40 61 applet_name = argv[1]; … … 48 69 bb_show_usage(); 49 70 50 argv++;51 if ( argv[0] == NULL)52 bb_show_usage();71 opts = getopt32(argv, "+R"); /* '+': stop at first non-option */ 72 if (opts) 73 pers |= ADDR_NO_RANDOMIZE; 53 74 54 75 /* Try to set personality */ 55 if (personality(pers) >= 0) { 56 /* Try to execute the program */ 57 BB_EXECVP(argv[0], argv); 58 } 76 if (personality(pers) < 0) 77 bb_perror_msg_and_die("personality(0x%lx)", pers); 59 78 60 bb_simple_perror_msg_and_die(argv[0]); 79 argv += optind; 80 if (!argv[0]) 81 (--argv)[0] = (char*)"/bin/sh"; 82 83 /* Try to execute the program */ 84 BB_EXECVP_or_die(argv); 61 85 } -
branches/3.3/mindi-busybox/util-linux/swaponoff.c
r3232 r3621 9 9 10 10 //usage:#define swapon_trivial_usage 11 //usage: "[-a] "IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]"11 //usage: "[-a] [-e]" IF_FEATURE_SWAPON_DISCARD(" [-d[POL]]") IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]" 12 12 //usage:#define swapon_full_usage "\n\n" 13 13 //usage: "Start swapping on DEVICE\n" 14 14 //usage: "\n -a Start swapping on all swap devices" 15 //usage: IF_FEATURE_SWAPON_DISCARD( 16 //usage: "\n -d[POL] Discard blocks at swapon (POL=once)," 17 //usage: "\n as freed (POL=pages), or both (POL omitted)" 18 //usage: ) 19 //usage: "\n -e Silently skip devices that do not exist" 15 20 //usage: IF_FEATURE_SWAPON_PRI( 16 21 //usage: "\n -p PRI Set swap device priority" … … 24 29 25 30 #include "libbb.h" 31 #include "common_bufsiz.h" 26 32 #include <mntent.h> 27 33 #ifndef __BIONIC__ … … 39 45 #endif 40 46 41 #if ENABLE_FEATURE_SWAPON_PRI 47 #if ENABLE_FEATURE_SWAPON_DISCARD 48 #ifndef SWAP_FLAG_DISCARD 49 #define SWAP_FLAG_DISCARD 0x10000 50 #endif 51 #ifndef SWAP_FLAG_DISCARD_ONCE 52 #define SWAP_FLAG_DISCARD_ONCE 0x20000 53 #endif 54 #ifndef SWAP_FLAG_DISCARD_PAGES 55 #define SWAP_FLAG_DISCARD_PAGES 0x40000 56 #endif 57 #define SWAP_FLAG_DISCARD_MASK \ 58 (SWAP_FLAG_DISCARD | SWAP_FLAG_DISCARD_ONCE | SWAP_FLAG_DISCARD_PAGES) 59 #endif 60 61 62 #if ENABLE_FEATURE_SWAPON_DISCARD || ENABLE_FEATURE_SWAPON_PRI 42 63 struct globals { 43 64 int flags; 44 65 } FIX_ALIASING; 45 #define G (*(struct globals*) &bb_common_bufsiz1)66 #define G (*(struct globals*)bb_common_bufsiz1) 46 67 #define g_flags (G.flags) 68 #define save_g_flags() int save_g_flags = g_flags 69 #define restore_g_flags() g_flags = save_g_flags 47 70 #else 48 71 #define g_flags 0 49 #endif 50 #define INIT_G() do { } while (0) 72 #define save_g_flags() ((void)0) 73 #define restore_g_flags() ((void)0) 74 #endif 75 #define INIT_G() do { setup_common_bufsiz(); } while (0) 76 77 #define do_swapoff (applet_name[5] == 'f') 78 79 /* Command line options */ 80 enum { 81 OPTBIT_a, /* -a all */ 82 OPTBIT_e, /* -e ifexists */ 83 IF_FEATURE_SWAPON_DISCARD( OPTBIT_d ,) /* -d discard */ 84 IF_FEATURE_SWAPON_PRI ( OPTBIT_p ,) /* -p priority */ 85 OPT_a = 1 << OPTBIT_a, 86 OPT_e = 1 << OPTBIT_e, 87 OPT_d = IF_FEATURE_SWAPON_DISCARD((1 << OPTBIT_d)) + 0, 88 OPT_p = IF_FEATURE_SWAPON_PRI ((1 << OPTBIT_p)) + 0, 89 }; 90 91 #define OPT_ALL (option_mask32 & OPT_a) 92 #define OPT_DISCARD (option_mask32 & OPT_d) 93 #define OPT_IFEXISTS (option_mask32 & OPT_e) 94 #define OPT_PRIO (option_mask32 & OPT_p) 51 95 52 96 static int swap_enable_disable(char *device) 53 97 { 54 int status;55 struct stat st;98 int err = 0; 99 int quiet = 0; 56 100 57 101 resolve_mount_spec(&device); 58 xstat(device, &st); 59 60 #if ENABLE_DESKTOP 61 /* test for holes */ 62 if (S_ISREG(st.st_mode)) 63 if (st.st_blocks * (off_t)512 < st.st_size) 64 bb_error_msg("warning: swap file has holes"); 65 #endif 66 67 if (applet_name[5] == 'n') 68 status = swapon(device, g_flags); 69 else 70 status = swapoff(device); 71 72 if (status != 0) { 102 103 if (do_swapoff) { 104 err = swapoff(device); 105 /* Don't complain on OPT_ALL if not a swap device or if it doesn't exist */ 106 quiet = (OPT_ALL && (errno == EINVAL || errno == ENOENT)); 107 } else { 108 /* swapon */ 109 struct stat st; 110 err = stat(device, &st); 111 if (!err) { 112 if (ENABLE_DESKTOP && S_ISREG(st.st_mode)) { 113 if (st.st_blocks * (off_t)512 < st.st_size) { 114 bb_error_msg("%s: file has holes", device); 115 return 1; 116 } 117 } 118 err = swapon(device, g_flags); 119 /* Don't complain on swapon -a if device is already in use */ 120 quiet = (OPT_ALL && errno == EBUSY); 121 } 122 /* Don't complain if file does not exist with -e option */ 123 if (err && OPT_IFEXISTS && errno == ENOENT) 124 err = 0; 125 } 126 127 if (err && !quiet) { 73 128 bb_simple_perror_msg(device); 74 129 return 1; 75 130 } 76 77 131 return 0; 78 132 } 79 133 80 static int do_em_all(void) 134 #if ENABLE_FEATURE_SWAPON_DISCARD 135 static void set_discard_flag(char *s) 136 { 137 /* Unset the flag first to allow fstab options to override */ 138 /* options set on the command line */ 139 g_flags = (g_flags & ~SWAP_FLAG_DISCARD_MASK) | SWAP_FLAG_DISCARD; 140 141 if (!s) /* No optional policy value on the commandline */ 142 return; 143 /* Skip prepended '=' */ 144 if (*s == '=') 145 s++; 146 /* For fstab parsing: remove other appended options */ 147 *strchrnul(s, ',') = '\0'; 148 149 if (strcmp(s, "once") == 0) 150 g_flags |= SWAP_FLAG_DISCARD_ONCE; 151 if (strcmp(s, "pages") == 0) 152 g_flags |= SWAP_FLAG_DISCARD_PAGES; 153 } 154 #else 155 #define set_discard_flag(s) ((void)0) 156 #endif 157 158 #if ENABLE_FEATURE_SWAPON_PRI 159 static void set_priority_flag(char *s) 160 { 161 unsigned prio; 162 163 /* For fstab parsing: remove other appended options */ 164 *strchrnul(s, ',') = '\0'; 165 /* Max allowed 32767 (== SWAP_FLAG_PRIO_MASK) */ 166 prio = bb_strtou(s, NULL, 10); 167 if (!errno) { 168 /* Unset the flag first to allow fstab options to override */ 169 /* options set on the command line */ 170 g_flags = (g_flags & ~SWAP_FLAG_PRIO_MASK) | SWAP_FLAG_PREFER | 171 MIN(prio, SWAP_FLAG_PRIO_MASK); 172 } 173 } 174 #else 175 #define set_priority_flag(s) ((void)0) 176 #endif 177 178 static int do_em_all_in_fstab(void) 81 179 { 82 180 struct mntent *m; 83 FILE *f; 84 int err; 85 86 f = setmntent("/etc/fstab", "r"); 87 if (f == NULL) 88 bb_perror_msg_and_die("/etc/fstab"); 89 90 err = 0; 181 int err = 0; 182 FILE *f = xfopen_for_read("/etc/fstab"); 183 91 184 while ((m = getmntent(f)) != NULL) { 92 185 if (strcmp(m->mnt_type, MNTTYPE_SWAP) == 0) { 93 186 /* swapon -a should ignore entries with noauto, 94 * but swapoff -a should process them */ 95 if (applet_name[5] != 'n' 96 || hasmntopt(m, MNTOPT_NOAUTO) == NULL 97 ) { 98 err += swap_enable_disable(m->mnt_fsname); 187 * but swapoff -a should process them 188 */ 189 if (do_swapoff || hasmntopt(m, MNTOPT_NOAUTO) == NULL) { 190 /* each swap space might have different flags */ 191 /* save global flags for the next round */ 192 save_g_flags(); 193 if (ENABLE_FEATURE_SWAPON_DISCARD) { 194 char *p = hasmntopt(m, "discard"); 195 if (p) { 196 /* move to '=' or to end of string */ 197 p += 7; 198 set_discard_flag(p); 199 } 200 } 201 if (ENABLE_FEATURE_SWAPON_PRI) { 202 char *p = hasmntopt(m, "pri"); 203 if (p) { 204 set_priority_flag(p + 4); 205 } 206 } 207 err |= swap_enable_disable(m->mnt_fsname); 208 restore_g_flags(); 99 209 } 100 210 } … … 107 217 } 108 218 219 static int do_all_in_proc_swaps(void) 220 { 221 char *line; 222 int err = 0; 223 FILE *f = fopen_for_read("/proc/swaps"); 224 /* Don't complain if missing */ 225 if (f) { 226 while ((line = xmalloc_fgetline(f)) != NULL) { 227 if (line[0] == '/') { 228 *strchrnul(line, ' ') = '\0'; 229 err |= swap_enable_disable(line); 230 } 231 free(line); 232 } 233 if (ENABLE_FEATURE_CLEAN_UP) 234 fclose(f); 235 } 236 237 return err; 238 } 239 240 #define OPTSTR_SWAPON "ae" \ 241 IF_FEATURE_SWAPON_DISCARD("d::") \ 242 IF_FEATURE_SWAPON_PRI("p:") 243 109 244 int swap_on_off_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 110 245 int swap_on_off_main(int argc UNUSED_PARAM, char **argv) 111 246 { 112 int ret; 247 IF_FEATURE_SWAPON_PRI(char *prio;) 248 IF_FEATURE_SWAPON_DISCARD(char *discard = NULL;) 249 int ret = 0; 113 250 114 251 INIT_G(); 115 252 116 #if !ENABLE_FEATURE_SWAPON_PRI 117 ret = getopt32(argv, "a"); 118 #else 119 if (applet_name[5] == 'n') 120 opt_complementary = "p+"; 121 ret = getopt32(argv, (applet_name[5] == 'n') ? "ap:" : "a", &g_flags); 122 123 if (ret & 2) { // -p 124 g_flags = SWAP_FLAG_PREFER | 125 ((g_flags & SWAP_FLAG_PRIO_MASK) << SWAP_FLAG_PRIO_SHIFT); 126 ret &= 1; 127 } 128 #endif 129 130 if (ret /* & 1: not needed */) // -a 131 return do_em_all(); 253 getopt32(argv, do_swapoff ? "ae" : OPTSTR_SWAPON 254 IF_FEATURE_SWAPON_DISCARD(, &discard) 255 IF_FEATURE_SWAPON_PRI(, &prio) 256 ); 132 257 133 258 argv += optind; 134 if (!*argv) 259 260 if (OPT_DISCARD) { 261 set_discard_flag(discard); 262 } 263 if (OPT_PRIO) { 264 set_priority_flag(prio); 265 } 266 267 if (OPT_ALL) { 268 /* swapoff -a does also /proc/swaps */ 269 if (do_swapoff) 270 ret = do_all_in_proc_swaps(); 271 ret |= do_em_all_in_fstab(); 272 } else if (!*argv) { 273 /* if not -a we need at least one arg */ 135 274 bb_show_usage(); 136 137 /* ret = 0; redundant */ 138 do { 139 ret += swap_enable_disable(*argv); 140 } while (*++argv); 141 275 } 276 /* Unset -a now to allow for more messages in swap_enable_disable */ 277 option_mask32 = option_mask32 & ~OPT_a; 278 /* Now process devices on the commandline if any */ 279 while (*argv) { 280 ret |= swap_enable_disable(*argv++); 281 } 142 282 return ret; 143 283 } -
branches/3.3/mindi-busybox/util-linux/switch_root.c
r3232 r3621 207 207 That's why the careful sequencing above: we cd into the new mount point before 208 208 we do the mount --move. Moving the mount point would otherwise make it 209 totally inaccessible to is because cd-ing to the old path wouldn't give it to209 totally inaccessible to us because cd-ing to the old path wouldn't give it to 210 210 us anymore, and cd "/" just gives us the cached dentry from when the process 211 211 was created (in this case the old initramfs one). But the "." symlink gives -
branches/3.3/mindi-busybox/util-linux/umount.c
r3232 r3621 31 31 #include <mntent.h> 32 32 #include <sys/mount.h> 33 #ifndef MNT_DETACH 34 # define MNT_DETACH 0x00000002 35 #endif 33 36 #include "libbb.h" 37 #include "common_bufsiz.h" 34 38 35 39 #if defined(__dietlibc__) … … 82 86 83 87 // MNT_FORCE and MNT_DETACH (from linux/fs.h) must match 84 // OPT_FORCE and OPT_LAZY, otherwise this trick won't work: 85 doForce = MAX((opt & OPT_FORCE), (opt & OPT_LAZY)); 88 // OPT_FORCE and OPT_LAZY. 89 BUILD_BUG_ON(OPT_FORCE != MNT_FORCE || OPT_LAZY != MNT_DETACH); 90 doForce = opt & (OPT_FORCE|OPT_LAZY); 86 91 87 92 /* Get a list of mount points from mtab. We read them all in now mostly … … 99 104 bb_error_msg_and_die("can't open '%s'", bb_path_mtab_file); 100 105 } else { 101 while (getmntent_r(fp, &me, bb_common_bufsiz1, sizeof(bb_common_bufsiz1))) { 106 setup_common_bufsiz(); 107 while (getmntent_r(fp, &me, bb_common_bufsiz1, COMMON_BUFSIZE)) { 102 108 /* Match fstype if passed */ 103 109 if (!match_fstype(&me, fstype)) … … 148 154 if (m) zapit = m->dir; 149 155 156 // umount from util-linux 2.22.2 does not do this: 157 // umount -f uses umount2(MNT_FORCE) immediately, 158 // not trying umount() first. 159 // (Strangely, umount -fl ignores -f: it is equivalent to umount -l. 160 // We do pass both flags in this case) 161 #if 0 150 162 // Let's ask the thing nicely to unmount. 151 163 curstat = umount(zapit); 152 164 153 // Force the unmount, if necessary.165 // Unmount with force and/or lazy flags, if necessary. 154 166 if (curstat && doForce) 167 #endif 155 168 curstat = umount2(zapit, doForce); 156 169 … … 169 182 } else { 170 183 status = EXIT_FAILURE; 171 bb_perror_msg("can't %sumount %s", (doForce ? "forcibly " : ""), zapit);184 bb_perror_msg("can't unmount %s", zapit); 172 185 } 173 186 } else { -
branches/3.3/mindi-busybox/util-linux/volume_id/Kbuild.src
r3232 r3621 8 8 9 9 INSERT 10 11 lib-$(CONFIG_BLKID) += get_devname.o12 lib-$(CONFIG_FINDFS) += get_devname.o13 lib-$(CONFIG_FEATURE_MOUNT_LABEL) += get_devname.o14 15 lib-$(CONFIG_VOLUMEID) += volume_id.o util.o16 lib-$(CONFIG_FEATURE_VOLUMEID_BTRFS) += btrfs.o17 lib-$(CONFIG_FEATURE_VOLUMEID_EXT) += ext.o18 lib-$(CONFIG_FEATURE_VOLUMEID_FAT) += fat.o19 lib-$(CONFIG_FEATURE_VOLUMEID_HFS) += hfs.o20 ### lib-$(CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID) += highpoint.o21 ### lib-$(CONFIG_FEATURE_VOLUMEID_ISWRAID) += isw_raid.o22 ### lib-$(CONFIG_FEATURE_VOLUMEID_LSIRAID) += lsi_raid.o23 ### lib-$(CONFIG_FEATURE_VOLUMEID_VIARAID) += via_raid.o24 ### lib-$(CONFIG_FEATURE_VOLUMEID_SILICONRAID) += silicon_raid.o25 ### lib-$(CONFIG_FEATURE_VOLUMEID_NVIDIARAID) += nvidia_raid.o26 ### lib-$(CONFIG_FEATURE_VOLUMEID_PROMISERAID) += promise_raid.o27 lib-$(CONFIG_FEATURE_VOLUMEID_ISO9660) += iso9660.o28 lib-$(CONFIG_FEATURE_VOLUMEID_JFS) += jfs.o29 lib-$(CONFIG_FEATURE_VOLUMEID_LINUXRAID) += linux_raid.o30 lib-$(CONFIG_FEATURE_VOLUMEID_LINUXSWAP) += linux_swap.o31 ### lib-$(CONFIG_FEATURE_VOLUMEID_LVM) += lvm.o32 ### lib-$(CONFIG_FEATURE_VOLUMEID_MAC) += mac.o33 ### lib-$(CONFIG_FEATURE_VOLUMEID_MSDOS) += msdos.o34 lib-$(CONFIG_FEATURE_VOLUMEID_NILFS) += nilfs.o35 lib-$(CONFIG_FEATURE_VOLUMEID_NTFS) += ntfs.o36 lib-$(CONFIG_FEATURE_VOLUMEID_EXFAT) += exfat.o37 lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o38 lib-$(CONFIG_FEATURE_VOLUMEID_UDF) += udf.o39 ### lib-$(CONFIG_FEATURE_VOLUMEID_UFS) += ufs.o40 lib-$(CONFIG_FEATURE_VOLUMEID_XFS) += xfs.o41 lib-$(CONFIG_FEATURE_VOLUMEID_CRAMFS) += cramfs.o42 ### lib-$(CONFIG_FEATURE_VOLUMEID_HPFS) += hpfs.o43 lib-$(CONFIG_FEATURE_VOLUMEID_ROMFS) += romfs.o44 lib-$(CONFIG_FEATURE_VOLUMEID_SYSV) += sysv.o45 ### lib-$(CONFIG_FEATURE_VOLUMEID_MINIX) += minix.o46 lib-$(CONFIG_FEATURE_VOLUMEID_LUKS) += luks.o47 lib-$(CONFIG_FEATURE_VOLUMEID_OCFS2) += ocfs2.o -
branches/3.3/mindi-busybox/util-linux/volume_id/btrfs.c
r3232 r3621 19 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 */ 21 22 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_BTRFS) += btrfs.o 23 24 //config: 25 //config:config FEATURE_VOLUMEID_BTRFS 26 //config: bool "btrfs filesystem" 27 //config: default y 28 //config: depends on VOLUMEID 29 //config: help 30 //config: TODO 31 //config: 21 32 22 33 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/cramfs.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_CRAMFS) += cramfs.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_CRAMFS 25 //config: bool "cramfs filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/exfat.c
r3233 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_EXFAT) += exfat.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_EXFAT 25 //config: bool "exFAT filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: exFAT (extended FAT) is a proprietary file system designed especially 30 //config: for flash drives. It has many features from NTFS, but with less 31 //config: overhead. exFAT is used on most SDXC cards for consumer electronics. 32 //config: 20 33 21 34 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/ext.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_EXT) += ext.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_EXT 25 //config: bool "Ext filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/fat.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_FAT) += fat.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_FAT 25 //config: bool "fat filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/get_devname.c
r3232 r3621 8 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 9 */ 10 11 //kbuild:lib-$(CONFIG_BLKID) += get_devname.o 12 //kbuild:lib-$(CONFIG_FINDFS) += get_devname.o 13 //kbuild:lib-$(CONFIG_FEATURE_MOUNT_LABEL) += get_devname.o 14 10 15 #include <sys/mount.h> /* BLKGETSIZE64 */ 11 16 #if !defined(BLKGETSIZE64) … … 298 303 char *tmp = *fsname; 299 304 300 if ( strncmp(*fsname, "UUID=", 5) == 0)305 if (is_prefixed_with(*fsname, "UUID=")) 301 306 tmp = get_devname_from_uuid(*fsname + 5); 302 else if ( strncmp(*fsname, "LABEL=", 6) == 0)307 else if (is_prefixed_with(*fsname, "LABEL=")) 303 308 tmp = get_devname_from_label(*fsname + 6); 304 309 -
branches/3.3/mindi-busybox/util-linux/volume_id/hfs.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_HFS) += hfs.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_HFS 25 //config: bool "hfs filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/iso9660.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_ISO9660) += iso9660.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_ISO9660 25 //config: bool "iso9660 filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/jfs.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_JFS) += jfs.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_JFS 25 //config: bool "jfs filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/linux_raid.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_LINUXRAID) += linux_raid.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_LINUXRAID 25 //config: bool "linuxraid" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/linux_swap.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_LINUXSWAP) += linux_swap.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_LINUXSWAP 25 //config: bool "linux swap filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/luks.c
r3232 r3621 19 19 */ 20 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_LUKS) += luks.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_LUKS 25 //config: bool "luks filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 31 21 32 #include "volume_id_internal.h" 22 33 … … 30 41 #define LUKS_NUMKEYS 8 31 42 32 static const uint8_t LUKS_MAGIC[] = { 'L','U','K','S', 0xba, 0xbe };43 static const uint8_t LUKS_MAGIC[] ALIGN1 = { 'L','U','K','S', 0xba, 0xbe }; 33 44 34 45 struct luks_phdr { -
branches/3.3/mindi-busybox/util-linux/volume_id/nilfs.c
r3233 r3621 19 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 */ 21 22 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_NILFS) += nilfs.o 23 24 //config: 25 //config:config FEATURE_VOLUMEID_NILFS 26 //config: bool "nilfs filesystem" 27 //config: default y 28 //config: depends on VOLUMEID 29 //config: help 30 //config: NILFS is a New Implementation of a Log-Structured File System (LFS) 31 //config: that supports continuous snapshots. This provides features like 32 //config: versioning of the entire filesystem, restoration of files that 33 //config: were deleted a few minutes ago. NILFS keeps consistency like 34 //config: conventional LFS, so it provides quick recovery after system crashes. 35 //config: 36 //config: The possible use of NILFS includes versioning, tamper detection, 37 //config: SOX compliance logging, and so forth. It can serve as an alternative 38 //config: filesystem for Linux desktop environment, or as a basis of advanced 39 //config: storage appliances. 40 //config: 21 41 22 42 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/ntfs.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_NTFS) += ntfs.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_NTFS 25 //config: bool "ntfs filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/ocfs2.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_OCFS2) += ocfs2.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_OCFS2 25 //config: bool "ocfs2 filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/reiserfs.c
r3232 r3621 19 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 */ 21 22 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o 23 24 //config: 25 //config:config FEATURE_VOLUMEID_REISERFS 26 //config: bool "Reiser filesystem" 27 //config: default y 28 //config: depends on VOLUMEID 29 //config: help 30 //config: TODO 31 //config: 21 32 22 33 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/romfs.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_ROMFS) += romfs.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_ROMFS 25 //config: bool "romfs filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/sysv.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_SYSV) += sysv.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_SYSV 25 //config: bool "sysv filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/udf.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_UDF) += udf.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_UDF 25 //config: bool "udf filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_highpoint.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID) += highpoint.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_HIGHPOINTRAID 25 //config:### bool "highpoint raid" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_hpfs.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_HPFS) += hpfs.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_HPFS 25 //config:### bool "hpfs filesystem" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_isw_raid.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_ISWRAID) += isw_raid.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_ISWRAID 25 //config:### bool "intel raid" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_lsi_raid.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_LSIRAID) += lsi_raid.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_LSIRAID 25 //config:### bool "lsi raid" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_lvm.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_LVM) += lvm.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_LVM 25 //config:### bool "lvm" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_mac.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_MAC) += mac.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_MAC 25 //config:### bool "mac filesystem" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_minix.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_MINIX) += minix.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_MINIX 25 //config:### bool "minix filesystem" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_msdos.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_MSDOS) += msdos.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_MSDOS 25 //config:### bool "msdos filesystem" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" … … 166 177 id->partition_count = 4; 167 178 168 p = &id->partitions[id->partition_count];179 // p = &id->partitions[id->partition_count]; 169 180 170 181 // if (is_raid(part[i].sys_ind)) -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_nvidia_raid.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_NVIDIARAID) += nvidia_raid.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_NVIDIARAID 25 //config:### bool "nvidia raid" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_promise_raid.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_PROMISERAID) += promise_raid.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_PROMISERAID 25 //config:### bool "promise raid" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_silicon_raid.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_SILICONRAID) += silicon_raid.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_SILICONRAID 25 //config:### bool "silicon raid" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_ufs.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_UFS) += ufs.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_UFS 25 //config:### bool "ufs filesystem" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/unused_via_raid.c
r2725 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:### lib-$(CONFIG_FEATURE_VOLUMEID_VIARAID) += via_raid.o 22 23 //config: 24 //config:### config FEATURE_VOLUMEID_VIARAID 25 //config:### bool "via raid" 26 //config:### default y 27 //config:### depends on VOLUMEID 28 //config:### help 29 //config:### TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h" -
branches/3.3/mindi-busybox/util-linux/volume_id/volume_id.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_VOLUMEID) += volume_id.o util.o 20 22 21 23 #include "volume_id_internal.h" … … 106 108 volume_id_probe_xfs, 107 109 #endif 110 #if ENABLE_FEATURE_VOLUMEID_BCACHE 111 volume_id_probe_bcache, 112 #endif 108 113 }; 109 114 … … 136 141 #if ENABLE_FEATURE_VOLUMEID_UFS 137 142 volume_id_probe_ufs, 143 #endif 144 #if ENABLE_FEATURE_VOLUMEID_F2FS 145 volume_id_probe_f2fs, 138 146 #endif 139 147 #if ENABLE_FEATURE_VOLUMEID_NILFS -
branches/3.3/mindi-busybox/util-linux/volume_id/volume_id_internal.h
r3232 r3621 97 97 #define SEEK_BUFFER_SIZE 0x10000 98 98 99 #define bswap16(x) (uint16_t) ( \100 (((uint16_t)(x) & 0x00ffu) << 8) | \101 (((uint16_t)(x) & 0xff00u) >> 8))102 103 #define bswap32(x) (uint32_t) ( \104 (((uint32_t)(x) & 0xff000000u) >> 24) | \105 (((uint32_t)(x) & 0x00ff0000u) >> 8) | \106 (((uint32_t)(x) & 0x0000ff00u) << 8) | \107 (((uint32_t)(x) & 0x000000ffu) << 24))108 109 #define bswap64(x) (uint64_t) ( \110 (((uint64_t)(x) & 0xff00000000000000ull) >> 56) | \111 (((uint64_t)(x) & 0x00ff000000000000ull) >> 40) | \112 (((uint64_t)(x) & 0x0000ff0000000000ull) >> 24) | \113 (((uint64_t)(x) & 0x000000ff00000000ull) >> 8) | \114 (((uint64_t)(x) & 0x00000000ff000000ull) << 8) | \115 (((uint64_t)(x) & 0x0000000000ff0000ull) << 24) | \116 (((uint64_t)(x) & 0x000000000000ff00ull) << 40) | \117 (((uint64_t)(x) & 0x00000000000000ffull) << 56))118 119 99 #if BB_LITTLE_ENDIAN 120 # define le16_to_cpu(x)(x)121 # define le32_to_cpu(x)(x)122 # define le64_to_cpu(x)(x)123 # define be16_to_cpu(x) bswap16(x)124 # define be32_to_cpu(x) bswap32(x)125 # define cpu_to_le16(x)(x)126 # define cpu_to_le32(x)(x)127 # define cpu_to_be32(x) bswap32(x)100 # define le16_to_cpu(x) (uint16_t)(x) 101 # define le32_to_cpu(x) (uint32_t)(x) 102 # define le64_to_cpu(x) (uint64_t)(x) 103 # define be16_to_cpu(x) (uint16_t)(bswap_16(x)) 104 # define be32_to_cpu(x) (uint32_t)(bswap_32(x)) 105 # define cpu_to_le16(x) (uint16_t)(x) 106 # define cpu_to_le32(x) (uint32_t)(x) 107 # define cpu_to_be32(x) (uint32_t)(bswap_32(x)) 128 108 #else 129 # define le16_to_cpu(x) bswap16(x)130 # define le32_to_cpu(x) bswap32(x)131 # define le64_to_cpu(x) bswap64(x)132 # define be16_to_cpu(x)(x)133 # define be32_to_cpu(x)(x)134 # define cpu_to_le16(x) bswap16(x)135 # define cpu_to_le32(x) bswap32(x)136 # define cpu_to_be32(x)(x)109 # define le16_to_cpu(x) (uint16_t)(bswap_16(x)) 110 # define le32_to_cpu(x) (uint32_t)(bswap_32(x)) 111 # define le64_to_cpu(x) (uint64_t)(bb_bswap_64(x)) 112 # define be16_to_cpu(x) (uint16_t)(x) 113 # define be32_to_cpu(x) (uint32_t)(x) 114 # define cpu_to_le16(x) (uint16_t)(bswap_16(x)) 115 # define cpu_to_le32(x) (uint32_t)(bswap_32(x)) 116 # define cpu_to_be32(x) (uint32_t)(x) 137 117 #endif 138 118 … … 190 170 /* FS */ 191 171 172 int FAST_FUNC volume_id_probe_bcache(struct volume_id *id /*,uint64_t off*/); 173 192 174 int FAST_FUNC volume_id_probe_btrfs(struct volume_id *id /*,uint64_t off*/); 193 175 … … 216 198 //int FAST_FUNC volume_id_probe_msdos_part_table(struct volume_id *id /*,uint64_t off*/); 217 199 200 int FAST_FUNC volume_id_probe_f2fs(struct volume_id *id /*,uint64_t off*/); 201 218 202 int FAST_FUNC volume_id_probe_nilfs(struct volume_id *id /*,uint64_t off*/); 219 203 -
branches/3.3/mindi-busybox/util-linux/volume_id/xfs.c
r3232 r3621 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 21 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_XFS) += xfs.o 22 23 //config: 24 //config:config FEATURE_VOLUMEID_XFS 25 //config: bool "xfs filesystem" 26 //config: default y 27 //config: depends on VOLUMEID 28 //config: help 29 //config: TODO 30 //config: 20 31 21 32 #include "volume_id_internal.h"
Note:
See TracChangeset
for help on using the changeset viewer.