Changeset d082801 in mainline for uspace/app
- Timestamp:
- 2025-03-29T14:04:37Z (4 months ago)
- Children:
- 746e636
- Parents:
- 1a28518
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/hrctl/hrctl.c
r1a28518 rd082801 62 62 " -F, --fail-extent fail an extent, use with -D and set it before\n" 63 63 " -c, --create=NAME create new array\n" 64 " -a, --assemble =NAMEassemble from specified extents\n"64 " -a, --assemble try to assemble from specified extents\n" 65 65 " -n non-zero number of devices\n" 66 66 " -l, --level=LEVEL set the RAID level,\n" … … 78 78 " - creates new mirroring RAID device named /hr0 consisting\n" 79 79 " of 2 drives\n" 80 " hrctl --assemble hr0-n 2 devices/\\hw\\0 devices/\\hw\\1\n"81 " - assembles RAID device named /hr0 consisting of 2 drives,\n"82 " that were previously in an array\n"80 " hrctl --assemble -n 2 devices/\\hw\\0 devices/\\hw\\1\n" 81 " - assembles RAID devices from specified extents,\n" 82 " that were previously in an (active) array\n" 83 83 " hrctl devices/hr0 --hotspare=devices/disk10\n" 84 84 " - adds \"devices/disk10\" as hotspare extent\n" … … 91 91 { "help", no_argument, 0, 'h' }, 92 92 { "status", no_argument, 0, 's' }, 93 { "assemble", required_argument, 0, 'a' },93 { "assemble", no_argument, 0, 'a' }, 94 94 { "create", required_argument, 0, 'c' }, 95 95 { "level", required_argument, 0, 'l' }, … … 253 253 254 254 while (c != -1) { 255 c = getopt_long(argc, argv, "hsC:c:Aa :l:0145Ln:D:F:H:",255 c = getopt_long(argc, argv, "hsC:c:Aal:0145Ln:D:F:H:", 256 256 long_options, NULL); 257 257 switch (c) { … … 294 294 return rc; 295 295 case 'a': 296 if (str_size(optarg) > sizeof(cfg->devname) - 1) { 297 printf("hrctl: device name too long\n"); 298 free(cfg); 299 return 1; 300 } 301 str_cpy(cfg->devname, sizeof(cfg->devname), optarg); 296 /* 297 * XXX: redo this, no devname, only svc ids... 298 * 299 * find some other way to rename the arrays..., 300 * 301 * some metadata editation tool... something like 302 * fdisk but can only change devnames on inactive 303 * extents... 304 */ 305 306 /* 307 * XXX: remake whole parsing, don't allow -a 308 * to have any levels set or anything 309 */ 302 310 assemble = true; 303 311 break; … … 414 422 415 423 if (create) { 416 rc = hr_create(hr, cfg , false);424 rc = hr_create(hr, cfg); 417 425 printf("hrctl: hr_create() rc: %s\n", str_error(rc)); 418 426 } else if (assemble) { 419 rc = hr_create(hr, cfg, true); 420 printf("hrctl: hr_assemble() rc: %s\n", str_error(rc)); 427 size_t assembled_cnt = 0; 428 rc = hr_assemble(hr, cfg, &assembled_cnt); 429 if (rc != EOK) { 430 /* XXX: here have own error codes */ 431 printf("hrctl: auto assemble rc: %s\n", str_error(rc)); 432 } else { 433 printf("hrctl: auto assembled %lu volumes\n", 434 assembled_cnt); 435 } 436 421 437 } 422 438
Note:
See TracChangeset
for help on using the changeset viewer.