Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/vol.c

    r72c72d4 r7c3fb9b  
    235235}
    236236
    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 
    253237/** Erase partition (to the extent where we will consider it not containing
    254238 * a file system.
     
    320304}
    321305
    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 
    396306/** @}
    397307 */
Note: See TracChangeset for help on using the changeset viewer.