Changeset aca1777 in mainline for uspace/lib/device/src/vol.c
- Timestamp:
- 2025-05-08T17:12:05Z (2 months 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 */
Note:
See TracChangeset
for help on using the changeset viewer.