1/** 2 * \file 3 * \brief Unidirectional bulk data transfer via shared memory 4 */ 5 6/* 7 * Copyright (c) 2009, 2010, 2011, 2012, ETH Zurich. 8 * All rights reserved. 9 * 10 * This file is distributed under the terms in the attached LICENSE file. 11 * If you do not find this file, copies can be found by writing to: 12 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15#include <barrelfish/barrelfish.h> 16 17#include <bulk_transfer/bulk_transfer.h> 18#include <bulk_transfer/bulk_sm.h> 19 20errval_t bulk_sm_ep_create(struct bulk_sm_endpoint_descriptor *ep_desc) 21{ 22 assert(ep_desc); 23 24 // We cannot export the service yet and bind the endpoint's iref. 25 // The iref gets bound to a waitset which is only provided upon 26 // channel_create/_bind. 27 28 ep_desc->ep_generic.f = bulk_sm_get_implementation(); 29 ep_desc->state = BULK_EPSTATE_CREATED; 30 31 return SYS_ERR_OK; 32} 33 34/** 35 * Creates a new bulk endpoint which uses the shared memory backend 36 * 37 * @param ep_desc memory location to create the endpoint in 38 * @param remote_iref the iref of the exported service on the other side 39 * 40 * This function is intended to be used by the binding side 41 */ 42errval_t bulk_sm_ep_create_remote(struct bulk_sm_endpoint_descriptor *ep_desc, 43 iref_t remote_iref) 44{ 45 ep_desc->ep_generic.f = bulk_sm_get_implementation(); 46 ep_desc->state = BULK_EPSTATE_IREF_EXPORTED; 47 // XXX How to ensure peer exported if on given iref? otherwise, should 48 // refuse to create ep. 49 50 ep_desc->iref = remote_iref; 51 return SYS_ERR_OK; 52} 53