Changes in uspace/app/mkexfat/mkexfat.c [8d2dd7f2:f3504c1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkexfat/mkexfat.c
r8d2dd7f2 rf3504c1 46 46 #include <byteorder.h> 47 47 #include <align.h> 48 #include <sys/typefmt.h>49 48 #include <str.h> 50 49 #include <getopt.h> … … 102 101 size_t sector_size; 103 102 size_t cluster_size; 103 const char *label; 104 104 } exfat_cfg_t; 105 106 105 107 106 static unsigned log2(unsigned n); … … 127 126 {"cluster-size", required_argument, 0, 'c'}, 128 127 {"fs-size", required_argument, 0, 's'}, 128 {"label", required_argument, 0, 'L' }, 129 129 }; 130 130 … … 133 133 printf("Usage: mkexfat [options] <device>\n" 134 134 "-c, --cluster-size ## Specify the cluster size (Kb)\n" 135 "-s, --fs-size ## Specify the filesystem size (sectors)\n"); 135 "-s, --fs-size ## Specify the filesystem size (sectors)\n" 136 " --label ## Volume label\n"); 136 137 } 137 138 … … 598 599 exfat_dentry_t *d; 599 600 aoff64_t rootdir_sec; 601 uint16_t wlabel[EXFAT_VOLLABEL_LEN + 1]; 600 602 int rc; 601 603 uint8_t *data; … … 609 611 610 612 /* Initialize the volume label dentry */ 611 d->type = EXFAT_TYPE_VOLLABEL; 612 str_to_utf16(d->vollabel.label, 8, "HELENOS "); 613 d->vollabel.size = 8; 614 615 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 } 616 631 617 632 /* Initialize the allocation bitmap dentry */ … … 752 767 753 768 cfg.cluster_size = 0; 769 cfg.label = NULL; 754 770 755 771 for (c = 0, optind = 0, opt_ind = 0; c != -1;) { 756 c = getopt_long(argc, argv, "hs:c: ",772 c = getopt_long(argc, argv, "hs:c:L:", 757 773 long_options, &opt_ind); 758 774 switch (c) { … … 782 798 } 783 799 break; 800 case 'L': 801 cfg.label = optarg; 802 break; 784 803 } 785 804 }
Note:
See TracChangeset
for help on using the changeset viewer.