Changeset d3b2ffa in mainline for uspace/lib/c/generic/vol.c
- Timestamp:
- 2018-06-29T15:40:10Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5e904dd
- Parents:
- 1e472ee (diff), 1a9174e (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/c/generic/vol.c
r1e472ee rd3b2ffa 235 235 } 236 236 237 /** Unmount partition (and possibly eject the media). */ 238 errno_t vol_part_eject(vol_t *vol, service_id_t sid) 239 { 240 async_exch_t *exch; 241 errno_t retval; 242 243 exch = async_exchange_begin(vol->sess); 244 retval = async_req_1_0(exch, VOL_PART_EJECT, sid); 245 async_exchange_end(exch); 246 247 if (retval != EOK) 248 return retval; 249 250 return EOK; 251 } 252 237 253 /** Erase partition (to the extent where we will consider it not containing 238 254 * a file system. … … 304 320 } 305 321 322 /** Format file system type as string. 323 * 324 * @param fstype File system type 325 * @param rstr Place to store pointer to newly allocated string 326 * @return EOK on success, ENOMEM if out of memory 327 */ 328 errno_t vol_fstype_format(vol_fstype_t fstype, char **rstr) 329 { 330 const char *sfstype; 331 char *s; 332 333 sfstype = NULL; 334 switch (fstype) { 335 case fs_exfat: 336 sfstype = "ExFAT"; 337 break; 338 case fs_fat: 339 sfstype = "FAT"; 340 break; 341 case fs_minix: 342 sfstype = "MINIX"; 343 break; 344 case fs_ext4: 345 sfstype = "Ext4"; 346 break; 347 case fs_cdfs: 348 sfstype = "ISO 9660"; 349 break; 350 } 351 352 s = str_dup(sfstype); 353 if (s == NULL) 354 return ENOMEM; 355 356 *rstr = s; 357 return EOK; 358 } 359 360 /** Format partition content / file system type as string. 361 * 362 * @param pcnt Partition content 363 * @param fstype File system type 364 * @param rstr Place to store pointer to newly allocated string 365 * @return EOK on success, ENOMEM if out of memory 366 */ 367 errno_t vol_pcnt_fs_format(vol_part_cnt_t pcnt, vol_fstype_t fstype, 368 char **rstr) 369 { 370 int rc; 371 char *s = NULL; 372 373 switch (pcnt) { 374 case vpc_empty: 375 s = str_dup("Empty"); 376 if (s == NULL) 377 return ENOMEM; 378 break; 379 case vpc_fs: 380 rc = vol_fstype_format(fstype, &s); 381 if (rc != EOK) 382 return ENOMEM; 383 break; 384 case vpc_unknown: 385 s = str_dup("Unknown"); 386 if (s == NULL) 387 return ENOMEM; 388 break; 389 } 390 391 assert(s != NULL); 392 *rstr = s; 393 return EOK; 394 } 395 306 396 /** @} 307 397 */
Note:
See TracChangeset
for help on using the changeset viewer.