| 645 | } |
| 646 | |
| 647 | cs_error_t cpg_join ( |
| 648 | cpg_handle_t handle, |
| 649 | const struct cpg_name *group) |
| 650 | { |
| 651 | cs_error_t error; |
| 652 | struct cpg_inst *cpg_inst; |
| 653 | struct iovec iov[2]; |
| 654 | struct req_lib_cpg_join req_lib_cpg_join; |
| 655 | struct res_lib_cpg_join response; |
| 656 | |
| 657 | if (group->length > CPG_MAX_NAME_LENGTH) { |
| 658 | return (CS_ERR_NAME_TOO_LONG); |
| 659 | } |
| 660 | |
| 661 | error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst)); |
| 662 | if (error != CS_OK) { |
| 663 | return (error); |
| 664 | } |
| 665 | |
| 666 | /* Now join */ |
| 667 | req_lib_cpg_join.header.size = sizeof (struct req_lib_cpg_join); |
| 668 | req_lib_cpg_join.header.id = MESSAGE_REQ_CPG_JOIN; |
| 669 | req_lib_cpg_join.pid = getpid(); |
| 670 | req_lib_cpg_join.flags = 0; |
| 671 | |
| 672 | switch (cpg_inst->model_data.model) { |
| 673 | case CPG_MODEL_V1: |
| 674 | req_lib_cpg_join.flags = cpg_inst->model_v1_data.flags; |
| 675 | break; |
| 676 | } |
| 677 | |
| 678 | marshall_to_mar_cpg_name_t (&req_lib_cpg_join.group_name, |
| 679 | group); |
| 680 | |
| 681 | iov[0].iov_base = (void *)&req_lib_cpg_join; |
| 682 | iov[0].iov_len = sizeof (struct req_lib_cpg_join); |
| 683 | |
| 684 | do { |
| 685 | error = coroipcc_msg_send_reply_receive (cpg_inst->c, iov, 1, |
| 686 | &response, sizeof (struct res_lib_cpg_join)); |
| 687 | |
| 688 | if (error != CS_OK) { |
| 689 | goto error_exit; |
| 690 | } |
| 691 | } while (response.header.error == CS_ERR_BUSY); |
| 692 | |
| 693 | error = response.header.error; |
| 694 | |
| 695 | error_exit: |
| 696 | hdb_handle_put (&cpg_handle_t_db, handle); |
| 697 | |
| 698 | return (error); |
| 699 | } |
| 700 | |
| 701 | cs_error_t cpg_leave ( |
| 702 | cpg_handle_t handle, |