Changeset aca1777 in mainline
- Timestamp:
- 2025-05-08T17:12:05Z (3 weeks ago)
- Children:
- 2f21cd4
- Parents:
- 1cfce3f (diff), 61f28c4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/malloc.c
r1cfce3f raca1777 190 190 return NULL; 191 191 192 void *obj = mem_alloc(alignof(max_align_t), size + _offset) + _offset; 192 void *obj = mem_alloc(alignof(max_align_t), size + _offset); 193 if (!obj) 194 return NULL; 195 196 obj += _offset; 193 197 194 198 /* Remember the allocation size just before the object. */ … … 205 209 * slab_free() will detect it and panic. 206 210 */ 207 size_t size = ((size_t *) obj)[-1]; 208 mem_free(obj - _offset, alignof(max_align_t), size + _offset); 211 if (obj) { 212 size_t size = ((size_t *) obj)[-1]; 213 mem_free(obj - _offset, alignof(max_align_t), size + _offset); 214 } 209 215 } 210 216 -
meson/part/exports/copy-export.sh
r1cfce3f raca1777 45 45 ar -t "$2" | xargs ar crs "${target_dir}/lib/$3" 46 46 ;; 47 sharedlib) 48 filename="$(basename "$2")" 49 major_versioned_name="$3" 50 # libfoo.so.5 -> libfoo.so (remove the last part delimited by dot) 51 unversioned_name="${major_versioned_name%.[0-9]*}" 52 cp -L "$2" "${target_dir}/lib/$filename" 53 ln -s "$filename" "${target_dir}/lib/$major_versioned_name" 54 ln -s "$filename" "${target_dir}/lib/$unversioned_name" 55 ;; 47 56 include) 48 57 mkdir -p "${target_dir}/include/$3" -
uspace/app/blkdump/blkdump.c
r1cfce3f raca1777 95 95 } 96 96 97 if ( str_cmp(*argv, "--offset") == 0) {97 if (*argv && str_cmp(*argv, "--offset") == 0) { 98 98 --argc; 99 99 ++argv; … … 115 115 } 116 116 117 if ( str_cmp(*argv, "--count") == 0) {117 if (*argv && str_cmp(*argv, "--count") == 0) { 118 118 --argc; 119 119 ++argv; … … 136 136 137 137 devname: 138 if (*argv == NULL) { 139 printf(NAME ": Error, argument missing (device_name).\n"); 140 syntax_print(); 141 return 1; 142 } 143 138 144 if (argc != 1) { 139 145 printf(NAME ": Error, unexpected argument.\n"); -
uspace/app/sysinst/sysinst.c
r1cfce3f raca1777 73 73 #define DEFAULT_DEV_0 "devices/\\hw\\sys\\00:01.1\\c0d0" 74 74 #define DEFAULT_DEV_1 "devices/\\hw\\sys\\ide1\\c0d0" 75 #define DEFAULT_DEV_2 "devices/\\hw\\sys\\00:01.0\\ide1\\c0d0" 75 76 //#define DEFAULT_DEV "devices/\\hw\\pci0\\00:01.2\\uhci_rh\\usb01_a1\\mass-storage0\\l0" 76 77 /** Volume label for the new file system */ … … 95 96 DEFAULT_DEV_0, 96 97 DEFAULT_DEV_1, 98 DEFAULT_DEV_2, 97 99 NULL 98 100 }; … … 155 157 static void sysinst_futil_copy_file(void *, const char *, const char *); 156 158 static void sysinst_futil_create_dir(void *, const char *); 159 static errno_t sysinst_eject_dev(sysinst_t *, service_id_t); 160 static errno_t sysinst_eject_phys_by_mp(sysinst_t *, const char *); 157 161 158 162 static futil_cb_t sysinst_futil_cb = { … … 269 273 case 0: 270 274 /* OK */ 275 sysinst_action(sysinst, "Ejecting installation media."); 276 (void)sysinst_eject_phys_by_mp(sysinst, CD_MOUNT_POINT); 271 277 (void)sysinst_restart(sysinst); 272 278 break; … … 424 430 } 425 431 426 /** Label the destination device.432 /** Label and mount the destination device. 427 433 * 428 434 * @param sysinst System installer … … 432 438 * @return EOK on success or an error code 433 439 */ 434 static errno_t sysinst_label_dev(sysinst_t *sysinst, const char *dev, 435 service_id_t *psvc_id) 436 { 437 fdisk_t *fdisk; 438 fdisk_dev_t *fdev; 440 static errno_t sysinst_label_dev(sysinst_t *sysinst, const char *dev) 441 { 442 fdisk_t *fdisk = NULL; 443 fdisk_dev_t *fdev = NULL; 439 444 fdisk_part_t *part; 440 445 fdisk_part_spec_t pspec; 441 446 fdisk_part_info_t pinfo; 447 bool dir_created = false; 448 bool label_created = false; 442 449 capa_spec_t capa; 443 450 service_id_t sid; … … 448 455 rc = loc_service_get_id(dev, &sid, 0); 449 456 if (rc != EOK) 450 return rc;457 goto error; 451 458 452 459 sysinst_debug(sysinst, "sysinst_label_dev(): open device"); … … 455 462 if (rc != EOK) { 456 463 sysinst_error(sysinst, "Error initializing fdisk."); 457 return rc;464 goto error; 458 465 } 459 466 … … 461 468 if (rc != EOK) { 462 469 sysinst_error(sysinst, "Error opening device."); 463 return rc;470 goto error; 464 471 } 465 472 … … 469 476 if (rc != EOK) { 470 477 sysinst_error(sysinst, "Error creating mount directory."); 471 return rc; 472 } 478 goto error; 479 } 480 481 dir_created = true; 473 482 474 483 sysinst_debug(sysinst, "sysinst_label_dev(): create label"); … … 477 486 if (rc != EOK) { 478 487 sysinst_error(sysinst, "Error creating label."); 479 return rc; 480 } 488 goto error; 489 } 490 491 label_created = true; 481 492 482 493 sysinst_debug(sysinst, "sysinst_label_dev(): create partition"); … … 486 497 sysinst_error(sysinst, 487 498 "Error getting available capacity."); 488 return rc;499 goto error; 489 500 } 490 501 … … 499 510 if (rc != EOK) { 500 511 sysinst_error(sysinst, "Error creating partition."); 501 return rc;512 goto error; 502 513 } 503 514 … … 505 516 if (rc != EOK) { 506 517 sysinst_error(sysinst, "Error getting partition information."); 507 return rc;518 goto error; 508 519 } 509 520 510 521 sysinst_debug(sysinst, "sysinst_label_dev(): OK"); 511 *psvc_id = pinfo.svc_id; 522 fdisk_dev_close(fdev); 523 fdisk_destroy(fdisk); 524 sysinst->psvc_id = pinfo.svc_id; 525 return EOK; 526 error: 527 if (label_created) 528 fdisk_label_destroy(fdev); 529 if (dir_created) 530 (void)vfs_unlink_path(MOUNT_POINT); 531 if (fdev != NULL) 532 fdisk_dev_close(fdev); 533 if (fdisk != NULL) 534 fdisk_destroy(fdisk); 535 return rc; 536 } 537 538 /** Finish/unmount destination device. 539 * 540 * @param sysinst System installer 541 * 542 * @return EOK on success or an error code 543 */ 544 static errno_t sysinst_finish_dev(sysinst_t *sysinst) 545 { 546 errno_t rc; 547 548 sysinst_debug(sysinst, "sysinst_finish_dev(): eject target volume"); 549 rc = sysinst_eject_dev(sysinst, sysinst->psvc_id); 550 if (rc != EOK) 551 return rc; 552 553 sysinst_debug(sysinst, "sysinst_finish_dev(): " 554 "deleting mount directory"); 555 (void)vfs_unlink_path(MOUNT_POINT); 556 512 557 return EOK; 513 558 } … … 550 595 rc = futil_rcopy_contents(sysinst->futil, CFG_FILES_SRC, 551 596 CFG_FILES_DEST); 552 if (rc != EOK) 553 return rc; 597 if (rc != EOK) { 598 sysinst_error(sysinst, "Error copying initial configuration " 599 "files."); 600 return rc; 601 } 554 602 555 603 return EOK; … … 571 619 "sysinst_copy_boot_files(): copy bootloader files"); 572 620 rc = futil_rcopy_contents(sysinst->futil, BOOT_FILES_SRC, MOUNT_POINT); 573 if (rc != EOK) 574 return rc; 621 if (rc != EOK) { 622 sysinst_error(sysinst, "Error copying bootloader " 623 "files."); 624 return rc; 625 } 575 626 576 627 sysinst_debug(sysinst, "sysinst_copy_boot_files(): OK"); … … 811 862 * 812 863 * @param sysinst System installer 813 * @param p svc_id Partition service ID864 * @param part_id Partition service ID 814 865 * @return EOK on success or an error code 815 866 */ … … 825 876 } 826 877 827 rc = vol_part_eject(vol, part_id, vef_ physical);878 rc = vol_part_eject(vol, part_id, vef_none); 828 879 if (rc != EOK) { 829 880 sysinst_error(sysinst, "Error ejecting volume."); … … 837 888 } 838 889 890 /** Physically eject volume by mount point. 891 * 892 * @param sysinst System installer 893 * @param path Mount point 894 * @return EOK on success or an error code 895 */ 896 static errno_t sysinst_eject_phys_by_mp(sysinst_t *sysinst, const char *path) 897 { 898 vol_t *vol = NULL; 899 sysarg_t part_id; 900 errno_t rc; 901 902 log_msg(LOG_DEFAULT, LVL_NOTE, 903 "sysinst_eject_phys_by_mp(%s)", path); 904 905 rc = vol_create(&vol); 906 if (rc != EOK) { 907 sysinst_error(sysinst, "Error contacting volume service."); 908 goto out; 909 } 910 911 log_msg(LOG_DEFAULT, LVL_NOTE, "vol_part_by_mp: mp='%s'\n", 912 path); 913 rc = vol_part_by_mp(vol, path, &part_id); 914 if (rc != EOK) { 915 sysinst_error(sysinst, 916 "Error finding installation media mount point."); 917 goto out; 918 } 919 920 log_msg(LOG_DEFAULT, LVL_NOTE, "eject svc_id %lu", (unsigned long)part_id); 921 rc = vol_part_eject(vol, part_id, vef_physical); 922 if (rc != EOK) { 923 sysinst_error(sysinst, "Error ejecting volume."); 924 goto out; 925 } 926 927 rc = EOK; 928 out: 929 vol_destroy(vol); 930 return rc; 931 } 932 839 933 /** Restart the system. 840 934 * … … 852 946 shutdown_failed = false; 853 947 948 sysinst_action(sysinst, "Restarting the system."); 949 854 950 rc = system_open(SYSTEM_DEFAULT, &sysinst_system_cb, NULL, &system); 855 951 if (rc != EOK) { … … 901 997 { 902 998 errno_t rc; 903 service_id_t psvc_id;999 bool clean_dev = false; 904 1000 905 1001 sysinst_action(sysinst, "Creating device label and file system."); 906 1002 907 rc = sysinst_label_dev(sysinst, dev, &psvc_id); 908 if (rc != EOK) 909 return rc; 1003 rc = sysinst_label_dev(sysinst, dev); 1004 if (rc != EOK) 1005 goto error; 1006 1007 clean_dev = true; 910 1008 911 1009 sysinst_action(sysinst, "Creating system directory structure."); 912 1010 rc = sysinst_setup_sysvol(sysinst); 913 1011 if (rc != EOK) 914 return rc;1012 goto error; 915 1013 916 1014 sysinst_action(sysinst, "Copying boot files."); 917 1015 rc = sysinst_copy_boot_files(sysinst); 918 1016 if (rc != EOK) 919 return rc;1017 goto error; 920 1018 921 1019 sysinst_action(sysinst, "Configuring the system."); 922 1020 rc = sysinst_customize_initrd(sysinst); 923 1021 if (rc != EOK) 924 return rc; 1022 goto error; 1023 1024 sysinst_action(sysinst, "Finishing system volume."); 1025 rc = sysinst_finish_dev(sysinst); 1026 if (rc != EOK) 1027 goto error; 1028 1029 clean_dev = false; 925 1030 926 1031 sysinst_action(sysinst, "Installing boot blocks."); … … 929 1034 return rc; 930 1035 931 sysinst_action(sysinst, "Ejecting device."); 932 rc = sysinst_eject_dev(sysinst, psvc_id); 933 if (rc != EOK) 934 return rc; 935 936 return EOK; 1036 return EOK; 1037 error: 1038 if (clean_dev) 1039 (void)sysinst_finish_dev(sysinst); 1040 return rc; 937 1041 } 938 1042 … … 969 1073 970 1074 sysinst_progress_destroy(sysinst->progress); 1075 sysinst->progress = NULL; 1076 971 1077 rc = sysinst_restart_dlg_create(sysinst); 972 1078 if (rc != EOK) … … 1147 1253 static void sysinst_action(sysinst_t *sysinst, const char *action) 1148 1254 { 1255 log_msg(LOG_DEFAULT, LVL_NOTE, "%s", action); 1256 1149 1257 if (sysinst->progress == NULL) 1150 1258 return; … … 1152 1260 ui_label_set_text(sysinst->progress->action, action); 1153 1261 ui_label_paint(sysinst->progress->action); 1154 log_msg(LOG_DEFAULT, LVL_NOTE, "%s", action);1155 1262 } 1156 1263 -
uspace/app/sysinst/sysinst.h
r1cfce3f raca1777 39 39 #include <futil.h> 40 40 #include <gfx/color.h> 41 #include <loc.h> 41 42 #include <system.h> 42 43 #include <ui/fixed.h> … … 60 61 sysinst_progress_t *progress; 61 62 system_t *system; 63 /** Service ID of destination partition. */ 64 sysarg_t psvc_id; 62 65 futil_t *futil; 63 66 char errmsg[128]; -
uspace/app/vol/vol.c
r1cfce3f raca1777 54 54 } vol_cmd_t; 55 55 56 /** Find volume by current mount point. */57 static errno_t vol_cmd_part_by_mp(vol_t *vol, const char *mp,58 service_id_t *rid)59 {60 vol_part_info_t vinfo;61 service_id_t *part_ids = NULL;62 char *canon_mp_buf = NULL;63 char *canon_mp;64 size_t nparts;65 size_t i;66 errno_t rc;67 68 canon_mp_buf = str_dup(mp);69 if (canon_mp_buf == NULL) {70 printf("Out of memory.\n");71 rc = ENOMEM;72 goto out;73 }74 75 canon_mp = vfs_absolutize(canon_mp_buf, NULL);76 if (canon_mp == NULL) {77 printf("Invalid volume path '%s'.\n", mp);78 rc = EINVAL;79 goto out;80 }81 82 rc = vol_get_parts(vol, &part_ids, &nparts);83 if (rc != EOK) {84 printf("Error getting list of volumes.\n");85 goto out;86 }87 88 for (i = 0; i < nparts; i++) {89 rc = vol_part_info(vol, part_ids[i], &vinfo);90 if (rc != EOK) {91 printf("Error getting volume information.\n");92 rc = EIO;93 goto out;94 }95 96 if (str_cmp(vinfo.cur_mp, canon_mp) == 0) {97 *rid = part_ids[i];98 rc = EOK;99 goto out;100 }101 }102 103 rc = ENOENT;104 out:105 free(part_ids);106 free(canon_mp_buf);107 return rc;108 }109 110 56 static errno_t vol_cmd_eject(const char *volspec, bool physical) 111 57 { … … 120 66 } 121 67 122 rc = vol_ cmd_part_by_mp(vol, volspec, &part_id);68 rc = vol_part_by_mp(vol, volspec, &part_id); 123 69 if (rc != EOK) { 124 70 printf("Error looking up volume '%s'.\n", volspec); -
uspace/drv/hid/usbhid/mouse/mousedev.c
r1cfce3f raca1777 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda 2 3 * Copyright (c) 2011 Lubos Slovak, Vojtech Horky 3 4 * Copyright (c) 2018 Ondrej Hlavaty … … 166 167 assert(mouse_dev != NULL); 167 168 168 if (mouse_dev->mouse_sess == NULL) { 169 usb_log_warning(NAME " No console session."); 170 return; 171 } 169 if (mouse_dev->mouse_sess == NULL) 170 return; 172 171 173 172 const usb_hid_report_field_t *move_x = get_mouse_axis_move_field( -
uspace/lib/device/include/vol.h
r1cfce3f raca1777 61 61 extern errno_t vol_pcnt_fs_format(vol_part_cnt_t, vol_fstype_t, char **); 62 62 extern errno_t vol_mountp_validate(const char *); 63 extern errno_t vol_part_by_mp(vol_t *, const char *, service_id_t *); 63 64 64 65 #endif -
uspace/lib/device/src/vol.c
r1cfce3f raca1777 608 608 } 609 609 610 /** Find volume by current mount point. 611 * 612 * @param vol Volume service 613 * @param mp Mount point 614 * @param rid Place to store partition service ID 615 * @return EOK on success or an error code 616 */ 617 errno_t vol_part_by_mp(vol_t *vol, const char *mp, service_id_t *rid) 618 { 619 vol_part_info_t vinfo; 620 service_id_t *part_ids = NULL; 621 char *canon_mp_buf = NULL; 622 char *canon_mp; 623 size_t nparts; 624 size_t i; 625 errno_t rc; 626 627 canon_mp_buf = str_dup(mp); 628 if (canon_mp_buf == NULL) { 629 rc = ENOMEM; 630 goto out; 631 } 632 633 canon_mp = vfs_absolutize(canon_mp_buf, NULL); 634 if (canon_mp == NULL) { 635 rc = EINVAL; 636 goto out; 637 } 638 639 rc = vol_get_parts(vol, &part_ids, &nparts); 640 if (rc != EOK) 641 goto out; 642 643 for (i = 0; i < nparts; i++) { 644 rc = vol_part_info(vol, part_ids[i], &vinfo); 645 if (rc != EOK) { 646 rc = EIO; 647 goto out; 648 } 649 650 if (str_cmp(vinfo.cur_mp, canon_mp) == 0) { 651 *rid = part_ids[i]; 652 rc = EOK; 653 goto out; 654 } 655 } 656 657 rc = ENOENT; 658 out: 659 free(part_ids); 660 free(canon_mp_buf); 661 return rc; 662 } 663 610 664 /** @} 611 665 */ -
uspace/lib/dltest/meson.build
r1cfce3f raca1777 28 28 29 29 allow_shared = true 30 30 31 src = files( 31 32 'dltest.c', -
uspace/lib/futil/src/futil.c
r1cfce3f raca1777 99 99 return EIO; 100 100 101 rc = vfs_lookup_open(destp, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE, &df); 102 if (rc != EOK) 103 return EIO; 101 rc = vfs_lookup_open(destp, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE, 102 &df); 103 if (rc != EOK) { 104 vfs_put(sf); 105 return EIO; 106 } 104 107 105 108 do { … … 152 155 de = readdir(dir); 153 156 while (de != NULL) { 154 if (asprintf(&srcp, "%s/%s", srcdir, de->d_name) < 0) 155 return ENOMEM; 156 if (asprintf(&destp, "%s/%s", destdir, de->d_name) < 0) 157 return ENOMEM; 157 if (asprintf(&srcp, "%s/%s", srcdir, de->d_name) < 0) { 158 rc = ENOMEM; 159 goto error; 160 } 161 162 if (asprintf(&destp, "%s/%s", destdir, de->d_name) < 0) { 163 rc = ENOMEM; 164 goto error; 165 } 158 166 159 167 rc = vfs_stat_path(srcp, &s); 160 168 if (rc != EOK) 161 return EIO;169 goto error; 162 170 163 171 if (s.is_file) { 164 172 rc = futil_copy_file(futil, srcp, destp); 165 if (rc != EOK) 166 return EIO; 173 if (rc != EOK) { 174 rc = EIO; 175 goto error; 176 } 167 177 } else if (s.is_directory) { 168 178 if (futil->cb != NULL && futil->cb->create_dir != NULL) … … 170 180 rc = vfs_link_path(destp, KIND_DIRECTORY, NULL); 171 181 if (rc != EOK) 172 return EIO;182 goto error; 173 183 rc = futil_rcopy_contents(futil, srcp, destp); 174 184 if (rc != EOK) 175 return EIO;185 goto error; 176 186 } else { 177 return EIO; 187 rc = EIO; 188 goto error; 178 189 } 179 190 … … 181 192 } 182 193 183 return EOK; 194 closedir(dir); 195 return EOK; 196 error: 197 closedir(dir); 198 return rc; 184 199 } 185 200 -
uspace/lib/inet/meson.build
r1cfce3f raca1777 27 27 # 28 28 29 allow_shared = true 30 29 31 src = files( 30 32 'src/addr.c', -
uspace/lib/meson.build
r1cfce3f raca1777 288 288 dependencies: _shared_deps, 289 289 ) 290 exported_devel_files += [ 'sharedlib', _shared_lib, _libname ] 290 291 endif 291 292 -
uspace/lib/posix/meson.build
r1cfce3f raca1777 30 30 includes += include_directories('include/posix', 'include') 31 31 c_args += [ '-fno-builtin', '-D_XOPEN_SOURCE' ] 32 33 allow_shared = true 32 34 33 35 # TODO
Note:
See TracChangeset
for help on using the changeset viewer.