int v4v_init(struct domain *d) { struct v4v_domain *v4v; evtchn_port_t port; int i; int rc; v4v = xmalloc(struct v4v_domain); if ( !v4v ) return -ENOMEM; rc = evtchn_alloc_unbound_domain(d, &port, d->domain_id); if ( rc ) return rc; rwlock_init(&v4v->lock); v4v->evtchn_port = port; for ( i = 0; i < V4V_HTABLE_SIZE; ++i ) INIT_HLIST_HEAD(&v4v->ring_hash[i]); write_lock(&v4v_lock); d->v4v = v4v; write_unlock(&v4v_lock); return 0; }