Changes in uspace/lib/device/src/vol.c [629b480:5fc8244] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/device/src/vol.c
r629b480 r5fc8244 1 1 /* 2 * Copyright (c) 20 25 Jiri Svoboda2 * Copyright (c) 2015 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup lib device29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 253 253 * @param vol Volume service 254 254 * @param sid Service ID of the partition 255 * @param flags Ejection flags 256 * @return EOK on success or an error code 257 */ 258 errno_t vol_part_eject(vol_t *vol, service_id_t sid, vol_eject_flags_t flags) 259 { 260 async_exch_t *exch; 261 errno_t retval; 262 263 exch = async_exchange_begin(vol->sess); 264 retval = async_req_2_0(exch, VOL_PART_EJECT, sid, flags); 255 * @return EOK on success or an error code 256 */ 257 errno_t vol_part_eject(vol_t *vol, service_id_t sid) 258 { 259 async_exch_t *exch; 260 errno_t retval; 261 262 exch = async_exchange_begin(vol->sess); 263 retval = async_req_1_0(exch, VOL_PART_EJECT, sid); 265 264 async_exchange_end(exch); 266 265 … … 608 607 } 609 608 610 /** Find volume by current mount point.611 *612 * @param vol Volume service613 * @param mp Mount point614 * @param rid Place to store partition service ID615 * @return EOK on success or an error code616 */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 664 609 /** @} 665 610 */
Note:
See TracChangeset
for help on using the changeset viewer.