| 737 | } |
| 738 | |
| 739 | int rpmsgfs_client_bind(FAR void **handle, FAR const char *cpuname) |
| 740 | { |
| 741 | struct rpmsgfs_s *priv; |
| 742 | int ret; |
| 743 | |
| 744 | if (!cpuname) |
| 745 | { |
| 746 | return -EINVAL; |
| 747 | } |
| 748 | |
| 749 | priv = fs_heap_zalloc(sizeof(struct rpmsgfs_s)); |
| 750 | if (!priv) |
| 751 | { |
| 752 | return -ENOMEM; |
| 753 | } |
| 754 | |
| 755 | nxsem_init(&priv->wait, 0, 0); |
| 756 | strlcpy(priv->cpuname, cpuname, sizeof(priv->cpuname)); |
| 757 | ret = rpmsg_register_callback(priv, |
| 758 | rpmsgfs_device_created, |
| 759 | rpmsgfs_device_destroy, |
| 760 | NULL, |
| 761 | NULL); |
| 762 | if (ret < 0) |
| 763 | { |
| 764 | nxsem_destroy(&priv->wait); |
| 765 | fs_heap_free(priv); |
| 766 | return ret; |
| 767 | } |
| 768 | |
| 769 | *handle = priv; |
| 770 | |
| 771 | return 0; |
| 772 | } |
| 773 | |
| 774 | int rpmsgfs_client_unbind(FAR void *handle) |
| 775 | { |
no test coverage detected