/** Copy string to clipboard. * * Sets the clipboard contents to @a str. Passing an empty string or NULL * makes the clipboard empty. * * @param str String to put to clipboard or NULL. * * @return Zero on success or negative error code. * */ int clipboard_put_str(const char *str) { size_t size = str_size(str); if (size == 0) { async_exch_t *exch = clip_exchange_begin(); sysarg_t rc = async_req_1_0(exch, CLIPBOARD_PUT_DATA, CLIPBOARD_TAG_NONE); clip_exchange_end(exch); return (int) rc; } else { async_exch_t *exch = clip_exchange_begin(); aid_t req = async_send_1(exch, CLIPBOARD_PUT_DATA, CLIPBOARD_TAG_DATA, NULL); sysarg_t rc = async_data_write_start(exch, (void *) str, size); clip_exchange_end(exch); if (rc != EOK) { sysarg_t rc_orig; async_wait_for(req, &rc_orig); if (rc_orig == EOK) return (int) rc; else return (int) rc_orig; } async_wait_for(req, &rc); return (int) rc; } }
int fb_vp_set_style(async_sess_t *sess, vp_handle_t vp, console_style_t style) { async_exch_t *exch = vp_exchange_begin(sess, vp); int ret = async_req_1_0(exch, FB_VP_SET_STYLE, style); vp_exchange_end(exch); return ret; }
int fb_vp_update(async_sess_t *sess, vp_handle_t vp, frontbuf_handle_t frontbuf) { async_exch_t *exch = vp_exchange_begin(sess, vp); int ret = async_req_1_0(exch, FB_VP_UPDATE, frontbuf); vp_exchange_end(exch); return ret; }
/** Request the driver to poll the NIC. * * @param[in] dev_sess * * @return EOK If the operation was successfully completed * */ int nic_poll_now(async_sess_t *dev_sess) { async_exch_t *exch = async_exchange_begin(dev_sess); int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_POLL_NOW); async_exchange_end(exch); return rc; }
static int inet_set_proto(uint8_t protocol) { async_exch_t *exch = async_exchange_begin(inet_sess); int rc = async_req_1_0(exch, INET_SET_PROTO, protocol); async_exchange_end(exch); return rc; }
int graph_dev_connect(async_sess_t *sess) { async_exch_t *exch = async_exchange_begin(sess); int ret = async_req_1_0(exch, DEV_IFACE_ID(GRAPH_DEV_IFACE), GRAPH_DEV_CONNECT); async_exchange_end(exch); return ret; }
/** Disable auto-negotiation. * * @param[in] dev_sess * * @return EOK If the operation was successfully completed * */ int nic_autoneg_disable(async_sess_t *dev_sess) { async_exch_t *exch = async_exchange_begin(dev_sess); int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_AUTONEG_DISABLE); async_exchange_end(exch); return rc; }
int fb_vp_sequence_start(async_sess_t *sess, vp_handle_t vp, sequence_handle_t sequence) { async_exch_t *exch = vp_exchange_begin(sess, vp); int ret = async_req_1_0(exch, FB_VP_SEQUENCE_START, sequence); vp_exchange_end(exch); return ret; }
/** * Remove application context from the server's list. * @param sess Valid audio session. * @param id Valid context id. * @return Error code. */ int hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id) { assert(sess); async_exch_t *exch = async_exchange_begin(sess); const int ret = async_req_1_0(exch, IPC_M_HOUND_CONTEXT_UNREGISTER, id); async_exchange_end(exch); return ret; }
/** Restart the auto-negotiation process. * * @param[in] dev_sess * * @return EOK If the operation was successfully completed * */ int nic_autoneg_restart(async_sess_t *dev_sess) { async_exch_t *exch = async_exchange_begin(dev_sess); int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_AUTONEG_RESTART); async_exchange_end(exch); return rc; }
/** Unregister service. * * @param sid Service ID */ int loc_service_unregister(service_id_t sid) { async_exch_t *exch; sysarg_t retval; exch = loc_exchange_begin_blocking(LOC_PORT_SUPPLIER); retval = async_req_1_0(exch, LOC_SERVICE_UNREGISTER, sid); loc_exchange_end(exch); return (int)retval; }
int vbd_part_delete(vbd_t *vbd, vbd_part_id_t part) { async_exch_t *exch; int retval; exch = async_exchange_begin(vbd->sess); retval = async_req_1_0(exch, VBD_PART_DELETE, part); async_exchange_end(exch); if (retval != EOK) return EIO; return EOK; }
int vbd_label_delete(vbd_t *vbd, service_id_t sid) { async_exch_t *exch; int retval; exch = async_exchange_begin(vbd->sess); retval = async_req_1_0(exch, VBD_LABEL_DELETE, sid); async_exchange_end(exch); if (retval != EOK) return EIO; return EOK; }
/** Destroy UDP association. * * Destroy UDP association. The caller should destroy all associations * he created before destroying the UDP client and before terminating. * * @param assoc UDP association */ void udp_assoc_destroy(udp_assoc_t *assoc) { async_exch_t *exch; if (assoc == NULL) return; list_remove(&assoc->ludp); exch = async_exchange_begin(assoc->udp->sess); sysarg_t rc = async_req_1_0(exch, UDP_ASSOC_DESTROY, assoc->id); async_exchange_end(exch); free(assoc); (void) rc; }
static async_exch_t *vp_exchange_begin(async_sess_t *sess, vp_handle_t vp) { vp_handle_t cur_vp = (vp_handle_t) async_remote_state_acquire(sess); async_exch_t *exch = async_exchange_begin(sess); if (cur_vp != vp) { int ret = async_req_1_0(exch, FB_VP_FOCUS, vp); if (ret != EOK) { async_exchange_end(exch); return NULL; } async_remote_state_update(sess, (void *) vp); } return exch; }
/** Request current VLAN filtering mask. * * @param[in] dev_sess * @param[out] stats Structure with the statistics * * @return EOK If the operation was successfully completed * */ int nic_vlan_get_mask(async_sess_t *dev_sess, nic_vlan_mask_t *mask) { assert(mask); async_exch_t *exch = async_exchange_begin(dev_sess); int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_VLAN_GET_MASK); if (rc != EOK) { async_exchange_end(exch); return rc; } rc = async_data_read_start(exch, mask, sizeof(nic_vlan_mask_t)); async_exchange_end(exch); return rc; }
/** Request statistic data about NIC operation. * * @param[in] dev_sess * @param[out] stats Structure with the statistics * * @return EOK If the operation was successfully completed * */ int nic_get_stats(async_sess_t *dev_sess, nic_device_stats_t *stats) { assert(stats); async_exch_t *exch = async_exchange_begin(dev_sess); int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_GET_STATS); if (rc != EOK) { async_exchange_end(exch); return rc; } rc = async_data_read_start(exch, stats, sizeof(nic_device_stats_t)); async_exchange_end(exch); return rc; }
/** Request information about the device. * * @see nic_device_info_t * * @param[in] dev_sess * @param[out] device_info Information about the device * * @return EOK If the operation was successfully completed * */ int nic_get_device_info(async_sess_t *dev_sess, nic_device_info_t *device_info) { assert(device_info); async_exch_t *exch = async_exchange_begin(dev_sess); int rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_GET_DEVICE_INFO); if (rc != EOK) { async_exchange_end(exch); return rc; } rc = async_data_read_start(exch, device_info, sizeof(nic_device_info_t)); async_exchange_end(exch); return rc; }
/** Disconnect device from network. * * @param[in] dev_sess Device session. * * @return EOK If the operation was successfully completed, * negative error code otherwise. * */ int ieee80211_disconnect(async_sess_t *dev_sess) { async_exch_t *exch = async_exchange_begin(dev_sess); int rc = async_req_1_0(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE), IEEE80211_DISCONNECT); async_exchange_end(exch); if (rc != EOK) return rc; nic_address_t wifi_mac; rc = nic_get_address(dev_sess, &wifi_mac); if (rc != EOK) return rc; inet_link_info_t link_info; inet_addr_info_t addr_info; inet_sroute_info_t route_info; sysarg_t *addr_list; sysarg_t *route_list; size_t count; /* Remove previous DHCP address. */ rc = inetcfg_get_addr_list(&addr_list, &count); if (rc != EOK) return rc; for (size_t i = 0; i < count; i++) { rc = inetcfg_addr_get(addr_list[i], &addr_info); if (rc != EOK) return rc; rc = inetcfg_link_get(addr_info.ilink, &link_info); if (rc != EOK) return rc; if (mac_matches(wifi_mac.address, link_info.mac_addr)) { if (str_test_prefix(addr_info.name, "dhcp")) { rc = inetcfg_addr_delete(addr_list[i]); if (rc != EOK) return rc; break; } } } /* * TODO: At this moment there can be only one DHCP route, * so it must be reimplemented after this limitation will be * dropped. */ /* Remove previous DHCP static route. */ rc = inetcfg_get_sroute_list(&route_list, &count); if (rc != EOK) return rc; for (size_t i = 0; i < count; i++) { rc = inetcfg_sroute_get(route_list[i], &route_info); if (rc != EOK) return rc; if (str_test_prefix(route_info.name, "dhcp")) { rc = inetcfg_sroute_delete(route_list[i]); if (rc != EOK) return rc; break; } } return rc; }
void loc_null_destroy(int null_id) { async_exch_t *exch = loc_exchange_begin_blocking(LOC_PORT_CONSUMER); async_req_1_0(exch, LOC_NULL_DESTROY, (sysarg_t) null_id); loc_exchange_end(exch); }