Changeset 2175178 in mainline for uspace/app/mkext4/mkext4.c
- Timestamp:
- 2018-10-03T08:34:52Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b209135
- Parents:
- 174156fd
- git-author:
- Jiri Svoboda <jiri@…> (2018-10-02 21:31:25)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-10-03 08:34:52)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkext4/mkext4.c
r174156fd r2175178 45 45 46 46 static void syntax_print(void); 47 static errno_t ext4_version_parse(const char *, ext4_cfg_ver_t *); 47 48 48 49 int main(int argc, char **argv) … … 51 52 char *dev_path; 52 53 service_id_t service_id; 54 ext4_cfg_ver_t ver; 53 55 char *endptr; 54 56 aoff64_t nblocks; 55 57 char *label; 58 59 ver = ext4_def_fs_version; 56 60 57 61 if (argc < 2) { … … 76 80 nblocks = strtol(*argv, &endptr, 10); 77 81 if (*endptr != '\0') { 82 printf(NAME ": Error, invalid argument.\n"); 83 syntax_print(); 84 return 1; 85 } 86 87 --argc; 88 ++argv; 89 } 90 91 if (str_cmp(*argv, "--type") == 0) { 92 --argc; 93 ++argv; 94 if (*argv == NULL) { 95 printf(NAME ": Error, argument missing.\n"); 96 syntax_print(); 97 return 1; 98 } 99 100 rc = ext4_version_parse(*argv, &ver); 101 if (rc != EOK) { 78 102 printf(NAME ": Error, invalid argument.\n"); 79 103 syntax_print(); … … 125 149 (void) nblocks; 126 150 127 rc = ext4_filesystem_create( service_id);151 rc = ext4_filesystem_create(ver, service_id); 128 152 if (rc != EOK) { 129 153 printf(NAME ": Error initializing file system.\n"); … … 141 165 printf("options:\n" 142 166 "\t--size <sectors> Filesystem size, overrides device size\n" 143 "\t--label <label> Volume label\n"); 167 "\t--label <label> Volume label\n" 168 "\t--type <fstype> Filesystem type (ext2, ext2old)\n"); 169 } 170 171 static errno_t ext4_version_parse(const char *str, ext4_cfg_ver_t *ver) 172 { 173 if (str_cmp(str, "ext2old") == 0) { 174 *ver = extver_ext2_old; 175 return EOK; 176 } 177 178 if (str_cmp(str, "ext2") == 0) { 179 *ver = extver_ext2; 180 return EOK; 181 } 182 183 return EINVAL; 144 184 } 145 185
Note:
See TracChangeset
for help on using the changeset viewer.