From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PG5jwufd; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 5164D5A004E for ; Fri, 06 Sep 2024 18:05:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725638706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jkEAtZYKlFfvHpv8WQNY/ZcE2YUKIhc4C12mM4+QcMY=; b=PG5jwufdo1ggIcuyh6/K31FSG6QTWofqBtUhR+XgmWkzwcKlMRpvguh3lw+T/Ak8qNedWr Q48PjaD+Ye0ffyRw6pw9BPwE8T+seUi5pDfy9XNgKCGQJWg5UT82y1P/fXkoznfKxOVUy7 Oh/Ea/J4W7MtP97EMtGs9RTolvmNUKw= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-663-ncaDzb8FPsmG6YkahCv0fA-1; Fri, 06 Sep 2024 12:05:04 -0400 X-MC-Unique: ncaDzb8FPsmG6YkahCv0fA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C8BB91954209 for ; Fri, 6 Sep 2024 16:05:03 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.193.22]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4413F1956086; Fri, 6 Sep 2024 16:05:02 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v4 3/4] vhost-user: introduce vhost-user API Date: Fri, 6 Sep 2024 18:04:48 +0200 Message-ID: <20240906160455.2088854-4-lvivier@redhat.com> In-Reply-To: <20240906160455.2088854-1-lvivier@redhat.com> References: <20240906160455.2088854-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Message-ID-Hash: XOM7CBQKDM6IDX7LKDQ6Z3VJR352P4IX X-Message-ID-Hash: XOM7CBQKDM6IDX7LKDQ6Z3VJR352P4IX X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: QWRkIHZob3N0X3VzZXIuYyBhbmQgdmhvc3RfdXNlci5oIHRoYXQgZGVmaW5lIHRoZSBmdW5jdGlv bnMgbmVlZGVkDQp0byBpbXBsZW1lbnQgdmhvc3QtdXNlciBiYWNrZW5kLg0KDQpTaWduZWQtb2Zm LWJ5OiBMYXVyZW50IFZpdmllciA8bHZpdmllckByZWRoYXQuY29tPg0KLS0tDQogTWFrZWZpbGUg ICAgIH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