Changeset 9f9d9067 in mainline
- Timestamp:
- 2026-04-08T11:23:57Z (4 days ago)
- Branches:
- master
- Children:
- 6d06bbc
- Parents:
- 8bf4494
- git-author:
- Jiri Svoboda <jiri@…> (2026-04-08 18:23:43)
- git-committer:
- Jiri Svoboda <jiri@…> (2026-04-08 11:23:57)
- Location:
- uspace
- Files:
-
- 2 edited
-
app/sysinst/sysinst.c (modified) (6 diffs)
-
lib/futil/src/futil.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysinst/sysinst.c
r8bf4494 r9f9d9067 77 77 /** Index of partition which we must install to (hardwired in load.cfg) */ 78 78 #define INST_PART_IDX 1 79 /* File system type cannot be changed without modifying core.img */ 80 #define INST_FSTYPE fs_ext4 79 81 /** Volume label for the new file system */ 80 82 #define INST_VOL_LABEL "HelenOS" … … 432 434 } 433 435 436 /** Find existing OS partition. 437 * 438 * @param sysinst System installer 439 * @param fdev Destination device 440 * @param rpart Place to store pointer to partition 441 * 442 * @return EOK on success or an error code 443 */ 444 static errno_t sysinst_existing_os_part_find(sysinst_t *sysinst, 445 fdisk_dev_t *fdev, fdisk_part_t **rpart) 446 { 447 fdisk_part_t *part; 448 fdisk_part_info_t pinfo; 449 errno_t rc; 450 451 sysinst_debug(sysinst, "sysinst_existing_os_part_find(): walk partitions"); 452 453 part = fdisk_part_first(fdev); 454 while (part != NULL) { 455 rc = fdisk_part_get_info(part, &pinfo); 456 if (rc != EOK) { 457 sysinst_error(sysinst, 458 "Error getting partition information."); 459 goto error; 460 } 461 462 if (pinfo.index == INST_PART_IDX && pinfo.pkind == lpk_primary) 463 break; 464 465 part = fdisk_part_next(part); 466 } 467 468 /* Partition with index INST_PART_IDX not found? */ 469 if (part == NULL) 470 return ENOENT; 471 472 /* Correct file system type? */ 473 if (pinfo.fstype != INST_FSTYPE) { 474 /* Not a usable existing partition. */ 475 return ENOENT; 476 } 477 478 sysinst_debug(sysinst, "sysinst_existing_os_part_find(): OK"); 479 sysinst->psvc_id = pinfo.svc_id; 480 *rpart = part; 481 return EOK; 482 error: 483 return rc; 484 } 485 434 486 /** Create installation partition. 435 487 * … … 459 511 pspec.capacity = capa; 460 512 pspec.pkind = lpk_primary; 461 pspec.fstype = fs_ext4; /* Cannot be changed without modifying core.img */513 pspec.fstype = INST_FSTYPE; /* Cannot be changed without modifying core.img */ 462 514 pspec.mountp = MOUNT_POINT; 463 515 pspec.index = INST_PART_IDX; /* Cannot be changed without modifying core.img */ … … 494 546 fdisk_t *fdisk = NULL; 495 547 fdisk_dev_t *fdev = NULL; 548 fdisk_part_t *part; 496 549 fdisk_label_info_t linfo; 497 550 bool create_label = false; … … 566 619 sysinst_debug(sysinst, "sysinst_label_dev(): create partition"); 567 620 568 /* Create installation partition. */ 569 rc = sysinst_inst_part_create(sysinst, fdev); 570 if (rc != EOK) 571 goto error; 621 /* Existing OS partition? */ 622 rc = sysinst_existing_os_part_find(sysinst, fdev, &part); 623 if (rc == EOK) { 624 /* Set mount point for installation partition. */ 625 rc = fdisk_part_set_mountp(part, MOUNT_POINT); 626 if (rc != EOK) { 627 sysinst_error(sysinst, "Cannot mount installation " 628 "partition."); 629 goto error; 630 } 631 } else { 632 /* Create installation partition. */ 633 rc = sysinst_inst_part_create(sysinst, fdev); 634 if (rc != EOK) 635 goto error; 636 } 572 637 573 638 return EOK; … … 627 692 628 693 rc = vfs_link_path(path, KIND_DIRECTORY, NULL); 629 if (rc != EOK ) {694 if (rc != EOK && rc != EEXIST) { 630 695 sysinst_error(sysinst, "Error creating directory."); 631 696 goto error; -
uspace/lib/futil/src/futil.c
r8bf4494 r9f9d9067 1 1 /* 2 * Copyright (c) 202 5Jiri Svoboda2 * Copyright (c) 2026 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 179 179 futil->cb->create_dir(futil->cb_arg, destp); 180 180 rc = vfs_link_path(destp, KIND_DIRECTORY, NULL); 181 if (rc != EOK )181 if (rc != EOK && rc != EEXIST) 182 182 goto error; 183 183 rc = futil_rcopy_contents(futil, srcp, destp);
Note:
See TracChangeset
for help on using the changeset viewer.
