Changeset d3b2ffa in mainline for uspace/lib/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. - Location:
- uspace/lib/c
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r1e472ee rd3b2ffa 112 112 generic/io/log.c \ 113 113 generic/io/logctl.c \ 114 generic/io/label.c \ 114 115 generic/io/kio.c \ 115 116 generic/io/klog.c \ -
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 */ -
uspace/lib/c/include/ipc/vol.h
r1e472ee rd3b2ffa 42 42 VOL_PART_ADD, 43 43 VOL_PART_INFO, 44 VOL_PART_EJECT, 44 45 VOL_PART_EMPTY, 45 46 VOL_PART_LSUPP, 46 VOL_PART_MKFS ,47 VOL_PART_MKFS 47 48 } vol_request_t; 48 49 -
uspace/lib/c/include/types/vol.h
r1e472ee rd3b2ffa 37 37 38 38 #include <async.h> 39 #include <ipc/vfs.h> 39 40 #include <ipc/vol.h> 40 41 #include <stdbool.h> … … 75 76 /** Volume label */ 76 77 char label[VOL_LABEL_MAXLEN + 1]; 78 /** Current mount point */ 79 char cur_mp[MAX_PATH_LEN + 1]; /* XXX too big */ 80 /** Current mount point is automatic */ 81 bool cur_mp_auto; 77 82 } vol_part_info_t; 78 83 -
uspace/lib/c/include/vol.h
r1e472ee rd3b2ffa 37 37 38 38 #include <async.h> 39 #include <errno.h> 39 40 #include <loc.h> 40 41 #include <stdint.h> … … 47 48 extern errno_t vol_part_add(vol_t *, service_id_t); 48 49 extern errno_t vol_part_info(vol_t *, service_id_t, vol_part_info_t *); 50 extern errno_t vol_part_eject(vol_t *, service_id_t); 49 51 extern errno_t vol_part_empty(vol_t *, service_id_t); 50 52 extern errno_t vol_part_get_lsupp(vol_t *, vol_fstype_t, vol_label_supp_t *); 51 53 extern errno_t vol_part_mkfs(vol_t *, service_id_t, vol_fstype_t, const char *); 54 55 extern errno_t vol_fstype_format(vol_fstype_t, char **); 56 extern errno_t vol_pcnt_fs_format(vol_part_cnt_t, vol_fstype_t, char **); 52 57 53 58 #endif
Note:
See TracChangeset
for help on using the changeset viewer.