Changes in uspace/srv/volsrv/part.c [9e45a41:4285f384] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/volsrv/part.c
r9e45a41 r4285f384 1 1 /* 2 * Copyright (c) 20 15 Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 37 37 #include <adt/list.h> 38 #include <bd.h> 38 39 #include <errno.h> 39 40 #include <fibril_synch.h> … … 52 53 #include "types/part.h" 53 54 #include "volume.h" 55 #include "volsrv.h" 54 56 55 57 static errno_t vol_part_add_locked(vol_parts_t *, service_id_t); … … 403 405 part->cur_mp_auto = mp_auto; 404 406 407 if (str_cmp(mp, "/w") == 0) { 408 log_msg(LOG_DEFAULT, LVL_NOTE, "Mounted system volume - " 409 "loading additional configuration."); 410 rc = vol_volumes_merge_to(part->parts->volumes, 411 vol_cfg_file); 412 if (rc != EOK) { 413 log_msg(LOG_DEFAULT, LVL_ERROR, "Error loading " 414 "additional configuration."); 415 return rc; 416 } 417 } 418 405 419 return rc; 406 420 } … … 629 643 } 630 644 631 errno_t vol_part_eject_part(vol_part_t *part) 645 static errno_t vol_part_eject_device(service_id_t svcid) 646 { 647 async_sess_t *sess; 648 errno_t rc; 649 bd_t *bd; 650 651 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_eject_device(%zu)", 652 (size_t)svcid); 653 654 sess = loc_service_connect(svcid, INTERFACE_BLOCK, 0); 655 if (sess == NULL) 656 return EIO; 657 658 rc = bd_open(sess, &bd); 659 if (rc != EOK) { 660 async_hangup(sess); 661 return EIO; 662 } 663 664 rc = bd_eject(bd); 665 if (rc != EOK) { 666 log_msg(LOG_DEFAULT, LVL_WARN, "vol_part_eject_device(): " 667 "eject fail"); 668 bd_close(bd); 669 async_hangup(sess); 670 return EIO; 671 } 672 673 bd_close(bd); 674 async_hangup(sess); 675 return EOK; 676 } 677 678 errno_t vol_part_eject_part(vol_part_t *part, vol_eject_flags_t flags) 632 679 { 633 680 int rc; … … 636 683 637 684 if (part->cur_mp == NULL) { 638 log_msg(LOG_DEFAULT, LVL_DEBUG, "Attempt to mount unmounted " 639 "partition."); 640 return EINVAL; 685 /* Partition is not mounted, nothing to do. */ 686 log_msg(LOG_DEFAULT, LVL_DEBUG, "Partition not mounted, " 687 "nothing to do."); 688 goto done; 641 689 } 642 690 … … 656 704 } 657 705 706 if ((flags & vef_physical) != 0) { 707 rc = vol_part_eject_device(part->svc_id); 708 if (rc != EOK) { 709 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed physically " 710 "ejecting device %s.", part->svc_name); 711 } 712 } 713 658 714 free(part->cur_mp); 659 715 part->cur_mp = NULL; 660 716 part->cur_mp_auto = false; 661 717 done: 662 718 return EOK; 663 719 } … … 805 861 806 862 if (part->cur_mp != NULL) { 807 rc = vol_part_eject_part(part );863 rc = vol_part_eject_part(part, vef_none); 808 864 if (rc != EOK) 809 865 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.