Changeset 629b480 in mainline for uspace/app/vol/vol.c
- Timestamp:
- 2025-04-25T20:48:07Z (3 weeks ago)
- Branches:
- master
- Children:
- 0526285, 21cd0c8, 32cb7cd, 4ae6a23, 68c4b28, 9ea3a41, a4f8c3f, abd1eff, cbaf408, f7f60e70
- Parents:
- 4b9213d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/vol/vol.c
r4b9213d r629b480 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);
Note:
See TracChangeset
for help on using the changeset viewer.