btrfs-progs: mkfs: clear whole mkfs_cfg at once
authorDavid Sterba <dsterba@suse.com>
Wed, 1 Feb 2017 13:15:08 +0000 (14:15 +0100)
committerDavid Sterba <dsterba@suse.com>
Wed, 8 Mar 2017 12:00:46 +0000 (13:00 +0100)
Zero out the structure and set only the requested fields.

Signed-off-by: David Sterba <dsterba@suse.com>
convert/main.c

index f5c560c..42b69df 100644 (file)
@@ -1216,15 +1216,13 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
        printf("\tnodesize:  %u\n", nodesize);
        printf("\tfeatures:  %s\n", features_buf);
 
+       memset(&mkfs_cfg, 0, sizeof(mkfs_cfg));
        mkfs_cfg.label = cctx.volume_name;
        mkfs_cfg.num_bytes = total_bytes;
        mkfs_cfg.nodesize = nodesize;
        mkfs_cfg.sectorsize = blocksize;
        mkfs_cfg.stripesize = blocksize;
        mkfs_cfg.features = features;
-       /* New convert need these space */
-       memset(mkfs_cfg.chunk_uuid, 0, BTRFS_UUID_UNPARSED_SIZE);
-       memset(mkfs_cfg.fs_uuid, 0, BTRFS_UUID_UNPARSED_SIZE);
 
        ret = make_convert_btrfs(fd, &mkfs_cfg, &cctx);
        if (ret) {