Changeset f3504c1 in mainline for uspace/app/mkexfat/mkexfat.c
- Timestamp:
- 2017-07-11T19:05:33Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 94c05b89
- Parents:
- b2906c0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkexfat/mkexfat.c
rb2906c0 rf3504c1 101 101 size_t sector_size; 102 102 size_t cluster_size; 103 const char *label; 103 104 } exfat_cfg_t; 104 105 105 106 106 static unsigned log2(unsigned n); … … 126 126 {"cluster-size", required_argument, 0, 'c'}, 127 127 {"fs-size", required_argument, 0, 's'}, 128 {"label", required_argument, 0, 'L' }, 128 129 }; 129 130 … … 132 133 printf("Usage: mkexfat [options] <device>\n" 133 134 "-c, --cluster-size ## Specify the cluster size (Kb)\n" 134 "-s, --fs-size ## Specify the filesystem size (sectors)\n"); 135 "-s, --fs-size ## Specify the filesystem size (sectors)\n" 136 " --label ## Volume label\n"); 135 137 } 136 138 … … 597 599 exfat_dentry_t *d; 598 600 aoff64_t rootdir_sec; 601 uint16_t wlabel[EXFAT_VOLLABEL_LEN + 1]; 599 602 int rc; 600 603 uint8_t *data; … … 608 611 609 612 /* Initialize the volume label dentry */ 610 d->type = EXFAT_TYPE_VOLLABEL; 611 str_to_utf16(d->vollabel.label, 8, "HELENOS "); 612 d->vollabel.size = 8; 613 614 d++; 613 614 if (cfg->label != NULL) { 615 memset(wlabel, 0, (EXFAT_VOLLABEL_LEN + 1) * sizeof(uint16_t)); 616 rc = str_to_utf16(wlabel, EXFAT_VOLLABEL_LEN + 1, cfg->label); 617 if (rc != EOK) { 618 rc = EINVAL; 619 goto exit; 620 } 621 622 d->type = EXFAT_TYPE_VOLLABEL; 623 memcpy(d->vollabel.label, wlabel, EXFAT_VOLLABEL_LEN * 2); 624 d->vollabel.size = utf16_wsize(wlabel); 625 assert(d->vollabel.size <= EXFAT_VOLLABEL_LEN); 626 627 d++; 628 } else { 629 d->type = EXFAT_TYPE_VOLLABEL & ~EXFAT_TYPE_USED; 630 } 615 631 616 632 /* Initialize the allocation bitmap dentry */ … … 751 767 752 768 cfg.cluster_size = 0; 769 cfg.label = NULL; 753 770 754 771 for (c = 0, optind = 0, opt_ind = 0; c != -1;) { 755 c = getopt_long(argc, argv, "hs:c: ",772 c = getopt_long(argc, argv, "hs:c:L:", 756 773 long_options, &opt_ind); 757 774 switch (c) { … … 781 798 } 782 799 break; 800 case 'L': 801 cfg.label = optarg; 802 break; 783 803 } 784 804 }
Note:
See TracChangeset
for help on using the changeset viewer.