Changeset 64ffd83 in mainline for uspace/lib/c/generic/vol.c
- Timestamp:
- 2018-07-24T09:43:38Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bec18a9
- Parents:
- 05208d9
- git-author:
- Jiri Svoboda <jiri@…> (2018-07-23 18:41:45)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-07-24 09:43:38)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vol.c
r05208d9 r64ffd83 40 40 #include <stdlib.h> 41 41 #include <str.h> 42 #include <vfs/vfs.h> 42 43 #include <vol.h> 43 44 … … 220 221 exch = async_exchange_begin(vol->sess); 221 222 aid_t req = async_send_1(exch, VOL_PART_INFO, sid, &answer); 223 222 224 errno_t rc = async_data_read_start(exch, vinfo, sizeof(vol_part_info_t)); 223 225 async_exchange_end(exch); 224 225 226 if (rc != EOK) { 226 227 async_forget(req); … … 294 295 } 295 296 296 /** Create file system. */ 297 /** Create file system. 298 * 299 * @param vol Volume service 300 * @param sid Partition service ID 301 * @param fstype File system type 302 * @param label Volume label 303 * @param mountp Mount point 304 * 305 * @return EOK on success or an error code 306 */ 297 307 errno_t vol_part_mkfs(vol_t *vol, service_id_t sid, vol_fstype_t fstype, 298 const char *label )308 const char *label, const char *mountp) 299 309 { 300 310 async_exch_t *exch; … … 304 314 exch = async_exchange_begin(vol->sess); 305 315 aid_t req = async_send_2(exch, VOL_PART_MKFS, sid, fstype, &answer); 316 306 317 retval = async_data_write_start(exch, label, str_size(label)); 307 async_exchange_end(exch);308 309 318 if (retval != EOK) { 319 async_exchange_end(exch); 310 320 async_forget(req); 311 321 return retval; 312 322 } 313 323 324 retval = async_data_write_start(exch, mountp, str_size(mountp)); 325 if (retval != EOK) { 326 async_exchange_end(exch); 327 async_forget(req); 328 return retval; 329 } 330 331 async_exchange_end(exch); 314 332 async_wait_for(req, &retval); 315 333 … … 394 412 } 395 413 414 /** Validate mount point. 415 * 416 * Verify that mount point is valid. A valid mount point is 417 * one of: 418 * - 'Auto' 419 * - 'None' 420 * - /path (string beginning with '/') to an existing directory 421 * 422 * @return EOK if mount point is in valid, EINVAL if the format is invalid, 423 * ENOENT if the directory does not exist 424 */ 425 errno_t vol_mountp_validate(const char *mountp) 426 { 427 errno_t rc; 428 vfs_stat_t stat; 429 430 if (str_cmp(mountp, "Auto") == 0 || str_cmp(mountp, "auto") == 0) 431 return EOK; 432 433 if (str_casecmp(mountp, "None") == 0 || str_cmp(mountp, "none") == 0) 434 return EOK; 435 436 if (mountp[0] == '/') { 437 rc = vfs_stat_path(mountp, &stat); 438 if (rc != EOK || !stat.is_directory) 439 return ENOENT; 440 441 return EOK; 442 } 443 444 return EINVAL; 445 } 446 396 447 /** @} 397 448 */
Note:
See TracChangeset
for help on using the changeset viewer.