Changeset 63c1dd5 in mainline for uspace/srv/volsrv/volsrv.c
- Timestamp:
- 2018-10-09T08:40:53Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63a045c
- Parents:
- ee9c703
- git-author:
- Jiri Svoboda <jiri@…> (2018-10-08 18:38:16)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-10-09 08:40:53)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/volsrv/volsrv.c
ree9c703 r63c1dd5 419 419 } 420 420 421 static void vol_get_volumes_srv(vol_parts_t *parts, ipc_call_t *icall) 422 { 423 ipc_call_t call; 424 size_t size; 425 size_t act_size; 426 errno_t rc; 427 428 log_msg(LOG_DEFAULT, LVL_NOTE, "vol_get_volumes_srv()"); 429 430 if (!async_data_read_receive(&call, &size)) { 431 async_answer_0(&call, EREFUSED); 432 async_answer_0(icall, EREFUSED); 433 return; 434 } 435 436 volume_id_t *id_buf = (volume_id_t *) malloc(size); 437 if (id_buf == NULL) { 438 async_answer_0(&call, ENOMEM); 439 async_answer_0(icall, ENOMEM); 440 return; 441 } 442 443 rc = vol_get_ids(parts->volumes, id_buf, size, &act_size); 444 if (rc != EOK) { 445 async_answer_0(&call, rc); 446 async_answer_0(icall, rc); 447 return; 448 } 449 450 errno_t retval = async_data_read_finalize(&call, id_buf, size); 451 free(id_buf); 452 453 async_answer_1(icall, retval, act_size); 454 } 455 456 static void vol_info_srv(vol_parts_t *parts, ipc_call_t *icall) 457 { 458 volume_id_t vid; 459 vol_volume_t *volume; 460 vol_info_t vinfo; 461 errno_t rc; 462 463 vid.id = IPC_GET_ARG1(*icall); 464 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_info_srv(%zu)", vid.id); 465 466 rc = vol_volume_find_by_id_ref(parts->volumes, vid, &volume); 467 if (rc != EOK) { 468 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_info_srv: volume %zu not found", 469 vid.id); 470 async_answer_0(icall, ENOENT); 471 return; 472 } 473 474 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_info_srv: vol_volume_get_info"); 475 rc = vol_volume_get_info(volume, &vinfo); 476 if (rc != EOK) { 477 async_answer_0(icall, EIO); 478 goto error; 479 } 480 481 ipc_call_t call; 482 size_t size; 483 if (!async_data_read_receive(&call, &size)) { 484 async_answer_0(&call, EREFUSED); 485 async_answer_0(icall, EREFUSED); 486 goto error; 487 } 488 489 if (size != sizeof(vol_info_t)) { 490 async_answer_0(&call, EINVAL); 491 async_answer_0(icall, EINVAL); 492 goto error; 493 } 494 495 rc = async_data_read_finalize(&call, &vinfo, 496 min(size, sizeof(vinfo))); 497 if (rc != EOK) { 498 async_answer_0(&call, rc); 499 async_answer_0(icall, rc); 500 goto error; 501 } 502 503 async_answer_0(icall, EOK); 504 error: 505 vol_volume_del_ref(volume); 506 } 507 421 508 static void vol_client_conn(ipc_call_t *icall, void *arg) 422 509 { … … 467 554 vol_part_set_mountp_srv(parts, &call); 468 555 break; 556 case VOL_GET_VOLUMES: 557 vol_get_volumes_srv(parts, &call); 558 break; 559 case VOL_INFO: 560 vol_info_srv(parts, &call); 561 break; 469 562 default: 470 563 async_answer_0(&call, EINVAL);
Note:
See TracChangeset
for help on using the changeset viewer.