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