Changeset 25444332 in mainline
- Timestamp:
- 2026-04-06T14:26:00Z (22 hours ago)
- Branches:
- master
- Children:
- 4116579, 8bf4494
- Parents:
- 4f16db1
- Location:
- uspace
- Files:
-
- 3 edited
-
app/sysinst/sysinst.c (modified) (5 diffs)
-
lib/fdisk/include/types/fdisk.h (modified) (3 diffs)
-
lib/fdisk/src/fdisk.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysinst/sysinst.c
r4f16db1 r25444332 1 1 /* 2 * Copyright (c) 202 5Jiri Svoboda2 * Copyright (c) 2026 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 75 75 #define DEFAULT_DEV_2 "devices/\\hw\\sys\\00:01.0\\ide1\\c0d0" 76 76 //#define DEFAULT_DEV "devices/\\hw\\pci0\\00:01.2\\uhci_rh\\usb01_a1\\mass-storage0\\l0" 77 /** Index of partition which we must install to (hardwired in load.cfg) */ 78 #define INST_PART_IDX 1 77 79 /** Volume label for the new file system */ 78 80 #define INST_VOL_LABEL "HelenOS" … … 442 444 fdisk_t *fdisk = NULL; 443 445 fdisk_dev_t *fdev = NULL; 446 fdisk_label_info_t linfo; 444 447 fdisk_part_t *part; 445 448 fdisk_part_spec_t pspec; 446 449 fdisk_part_info_t pinfo; 450 bool create_label = false; 447 451 bool dir_created = false; 448 452 bool label_created = false; … … 483 487 sysinst_debug(sysinst, "sysinst_label_dev(): create label"); 484 488 485 rc = fdisk_label_create(fdev, lt_mbr); 486 if (rc != EOK) { 487 sysinst_error(sysinst, "Error creating label."); 488 goto error; 489 rc = fdisk_label_get_info(fdev, &linfo); 490 if (rc != EOK) { 491 sysinst_error(sysinst, "Error analyzing device."); 492 goto error; 493 } 494 495 switch (linfo.ltype) { 496 case lt_none: 497 /* need to create label */ 498 create_label = true; 499 break; 500 case lt_mbr: 501 /* MBR label already present */ 502 break; 503 default: 504 /* a different type of label already present */ 505 sysinst_error(sysinst, "Disk contains unusable label."); 506 goto error; 507 } 508 509 /* Need to create label? */ 510 if (create_label) { 511 rc = fdisk_label_create(fdev, lt_mbr); 512 if (rc != EOK) { 513 sysinst_error(sysinst, "Error creating label."); 514 goto error; 515 } 489 516 } 490 517 … … 505 532 pspec.fstype = fs_ext4; /* Cannot be changed without modifying core.img */ 506 533 pspec.mountp = MOUNT_POINT; 534 pspec.index = INST_PART_IDX; /* Cannot be changed without modifying core.img */ 507 535 pspec.label = INST_VOL_LABEL; 508 536 -
uspace/lib/fdisk/include/types/fdisk.h
r4f16db1 r25444332 1 1 /* 2 * Copyright (c) 20 15Jiri Svoboda2 * Copyright (c) 2026 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 155 155 /** File system type */ 156 156 vol_fstype_t fstype; 157 /** Partition index, default/0 = assign automatically */ 158 int index; 157 159 /** Volume label */ 158 160 const char *label; … … 171 173 /** File system type */ 172 174 vol_fstype_t fstype; 175 /** Partition index */ 176 int index; 173 177 /** Volume label */ 174 178 char *label; -
uspace/lib/fdisk/src/fdisk.c
r4f16db1 r25444332 1 1 /* 2 * Copyright (c) 202 5Jiri Svoboda2 * Copyright (c) 2026 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 673 673 info->fstype = part->fstype; 674 674 info->pkind = part->pkind; 675 info->index = part->index; 675 676 info->label = part->label; 676 677 info->svc_id = part->svc_id; … … 1031 1032 1032 1033 if (pspec->pkind != lpk_logical) { 1033 rc = fdisk_part_get_free_idx(dev, &index); 1034 if (rc != EOK) 1035 return EIO; 1034 if (pspec->index == 0) { 1035 /* allocate first free index */ 1036 rc = fdisk_part_get_free_idx(dev, &index); 1037 if (rc != EOK) 1038 return EIO; 1039 } else { 1040 /* user-specified index */ 1041 index = pspec->index; 1042 } 1036 1043 } else { 1037 1044 index = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
