tls: reorder a few more cipher ids
[oweals/busybox.git] / util-linux / mkfs_vfat.c
index e83ae7510d2d76503a40940ad1a30485ca5abb3b..6a6dc652fb87c4188680a6d5637ab32775c9abd9 100644 (file)
@@ -7,6 +7,26 @@
  *
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
+//config:config MKDOSFS
+//config:      bool "mkdosfs (6.8 kb)"
+//config:      default y
+//config:      select PLATFORM_LINUX
+//config:      help
+//config:      Utility to create FAT32 filesystems.
+//config:
+//config:config MKFS_VFAT
+//config:      bool "mkfs.vfat (6.8 kb)"
+//config:      default y
+//config:      select PLATFORM_LINUX
+//config:      help
+//config:      Alias to "mkdosfs".
+
+//                    APPLET_ODDNAME:name       main       location     suid_type     help
+//applet:IF_MKDOSFS(  APPLET_ODDNAME(mkdosfs,   mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))
+//applet:IF_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))
+
+//kbuild:lib-$(CONFIG_MKDOSFS) += mkfs_vfat.o
+//kbuild:lib-$(CONFIG_MKFS_VFAT) += mkfs_vfat.o
 
 //usage:#define mkfs_vfat_trivial_usage
 //usage:       "[-v] [-n LABEL] BLOCKDEV [KBYTES]"
@@ -18,7 +38,6 @@
 */
 //usage:#define mkfs_vfat_full_usage "\n\n"
 //usage:       "Make a FAT32 filesystem\n"
-//usage:     "\nOptions:"
 /* //usage:  "\n       -c      Check device for bad blocks" */
 //usage:     "\n       -v      Verbose"
 /* //usage:  "\n       -I      Allow to use entire disk device (e.g. /dev/hda)" */
@@ -187,19 +206,6 @@ static const char boot_code[] ALIGN1 =
 #define MARK_CLUSTER(cluster, value) \
        ((uint32_t *)fat)[cluster] = SWAP_LE32(value)
 
-void BUG_unsupported_field_size(void);
-#define STORE_LE(field, value) \
-do { \
-       if (sizeof(field) == 4) \
-               field = SWAP_LE32(value); \
-       else if (sizeof(field) == 2) \
-               field = SWAP_LE16(value); \
-       else if (sizeof(field) == 1) \
-               field = (value); \
-       else \
-               BUG_unsupported_field_size(); \
-} while (0)
-
 /* compat:
  * mkdosfs 2.11 (12 Mar 2005)
  * Usage: mkdosfs [-A] [-c] [-C] [-v] [-I] [-l bad-block-file]
@@ -250,8 +256,9 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
                OPT_v = 1 << 16, // verbose
        };
 
-       opt_complementary = "-1";//:b+:f+:F+:h+:r+:R+:s+:S+:vv:c--l:l--c";
-       opts = getopt32(argv, "Ab:cCf:F:h:Ii:l:m:n:r:R:s:S:v",
+       opts = getopt32(argv, "^"
+               "Ab:cCf:F:h:Ii:l:m:n:r:R:s:S:v"
+               "\0" "-1", //:b+:f+:F+:h+:r+:R+:s+:S+:vv:c--l:l--c
                NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, &volume_label, NULL, NULL, NULL, NULL);
        argv += optind;
@@ -502,7 +509,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
                //STORE_LE(boot_blk->reserved2[3], 0,0,0);
                STORE_LE(boot_blk->vi.ext_boot_sign, 0x29);
                STORE_LE(boot_blk->vi.volume_id32, volume_id);
-               strncpy(boot_blk->vi.fs_type, "FAT32   ", sizeof(boot_blk->vi.fs_type));
+               memcpy(boot_blk->vi.fs_type, "FAT32   ", sizeof(boot_blk->vi.fs_type));
                strncpy(boot_blk->vi.volume_label, volume_label, sizeof(boot_blk->vi.volume_label));
                memcpy(boot_blk->boot_code, boot_code, sizeof(boot_code));
                STORE_LE(boot_blk->boot_sign, BOOT_SIGN);
@@ -579,7 +586,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
                start_data_sector = (reserved_sect + NUM_FATS * sect_per_fat) * (bytes_per_sect / SECTOR_SIZE);
                start_data_block = (start_data_sector + SECTORS_PER_BLOCK - 1) / SECTORS_PER_BLOCK;
 
-               bb_info_msg("searching for bad blocks ");
+               bb_error_msg("searching for bad blocks");
                currently_testing = 0;
                try = TEST_BUFFER_BLOCKS;
                while (currently_testing < volume_size_blocks) {
@@ -617,7 +624,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
                }
                free(blkbuf);
                if (badblocks)
-                       bb_info_msg("%d bad block(s)", badblocks);
+                       bb_error_msg("%d bad block(s)", badblocks);
        }
 #endif