Changeset e0bbecb in mainline for uspace/srv/bd/hr/hr.c
- Timestamp:
- 2025-06-09T20:01:03Z (6 weeks ago)
- Children:
- e2a8fd2
- Parents:
- 431b513
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/hr/hr.c
r431b513 re0bbecb 59 59 static void hr_stop_all_srv(ipc_call_t *); 60 60 static void hr_add_hotspare_srv(ipc_call_t *); 61 static void hr_ print_state_srv(ipc_call_t *);61 static void hr_get_vol_states_srv(ipc_call_t *); 62 62 static void hr_ctl_conn(ipc_call_t *); 63 63 static void hr_client_conn(ipc_call_t *, void *); … … 416 416 } 417 417 418 /** Volume state printing (server).419 * 420 * Prints info about all active volumes.421 */ 422 static void hr_ print_state_srv(ipc_call_t *icall)418 /** Send volume states. 419 * 420 * Sends the client pairs of (volume service_id, state). 421 */ 422 static void hr_get_vol_states_srv(ipc_call_t *icall) 423 423 { 424 424 HR_DEBUG("%s()", __func__); … … 426 426 errno_t rc; 427 427 size_t vol_cnt = 0; 428 hr_ vol_info_t info;428 hr_pair_vol_state_t pair; 429 429 ipc_call_t call; 430 430 size_t size; … … 439 439 } 440 440 441 if (size != sizeof( size_t)) {441 if (size != sizeof(vol_cnt)) { 442 442 rc = EINVAL; 443 443 goto error; … … 449 449 450 450 list_foreach(hr_volumes, lvolumes, hr_volume_t, vol) { 451 memcpy(info.extents, vol->extents, 452 sizeof(hr_extent_t) * HR_MAX_EXTENTS); 453 memcpy(info.hotspares, vol->hotspares, 454 sizeof(hr_extent_t) * HR_MAX_HOTSPARES); 455 info.svc_id = vol->svc_id; 456 info.extent_no = vol->extent_no; 457 info.hotspare_no = vol->hotspare_no; 458 info.level = vol->level; 459 /* print usable number of blocks */ 460 /* TODO: change to data_blkno */ 461 info.nblocks = vol->data_blkno; 462 info.strip_size = vol->strip_size; 463 info.bsize = vol->bsize; 464 info.state = vol->state; 465 info.layout = vol->layout; 451 pair.svc_id = vol->svc_id; 452 pair.state = vol->state; 466 453 467 454 if (!async_data_read_receive(&call, &size)) { … … 470 457 } 471 458 472 if (size != sizeof( hr_vol_info_t)) {459 if (size != sizeof(pair)) { 473 460 rc = EINVAL; 474 461 goto error; 475 462 } 476 463 477 rc = async_data_read_finalize(&call, & info, size);464 rc = async_data_read_finalize(&call, &pair, size); 478 465 if (rc != EOK) 479 466 goto error; … … 489 476 } 490 477 478 /** Send volume info. 479 * 480 * Sends the client volume info. 481 */ 482 static void hr_get_vol_info_srv(ipc_call_t *icall) 483 { 484 HR_DEBUG("%s()", __func__); 485 486 errno_t rc; 487 size_t size; 488 ipc_call_t call; 489 service_id_t svc_id; 490 hr_vol_info_t info; 491 hr_volume_t *vol; 492 493 if (!async_data_write_receive(&call, &size)) { 494 rc = EREFUSED; 495 goto error; 496 } 497 498 if (size != sizeof(service_id_t)) { 499 rc = EINVAL; 500 goto error; 501 } 502 503 rc = async_data_write_finalize(&call, &svc_id, size); 504 if (rc != EOK) 505 goto error; 506 507 vol = hr_get_volume(svc_id); 508 if (vol == NULL) { 509 rc = ENOENT; 510 goto error; 511 } 512 513 memcpy(info.extents, vol->extents, 514 sizeof(hr_extent_t) * HR_MAX_EXTENTS); 515 memcpy(info.hotspares, vol->hotspares, 516 sizeof(hr_extent_t) * HR_MAX_HOTSPARES); 517 info.svc_id = vol->svc_id; 518 info.extent_no = vol->extent_no; 519 info.hotspare_no = vol->hotspare_no; 520 info.level = vol->level; 521 info.data_blkno = vol->data_blkno; 522 info.strip_size = vol->strip_size; 523 info.bsize = vol->bsize; 524 info.state = vol->state; 525 info.layout = vol->layout; 526 info.meta_type = vol->meta_ops->get_type(); 527 memcpy(info.devname, vol->devname, HR_DEVNAME_LEN); 528 529 if (!async_data_read_receive(&call, &size)) { 530 rc = EREFUSED; 531 goto error; 532 } 533 534 if (size != sizeof(info)) { 535 rc = EINVAL; 536 goto error; 537 } 538 539 rc = async_data_read_finalize(&call, &info, size); 540 if (rc != EOK) 541 goto error; 542 543 async_answer_0(icall, EOK); 544 return; 545 error: 546 async_answer_0(&call, rc); 547 async_answer_0(icall, rc); 548 } 549 491 550 /** HelenRAID server control IPC methods crossroad. 492 551 */ … … 529 588 hr_add_hotspare_srv(&call); 530 589 break; 531 case HR_STATUS: 532 hr_print_state_srv(&call); 590 case HR_GET_VOL_STATES: 591 hr_get_vol_states_srv(&call); 592 break; 593 case HR_GET_VOL_INFO: 594 hr_get_vol_info_srv(&call); 533 595 break; 534 596 default:
Note:
See TracChangeset
for help on using the changeset viewer.