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=cCuq1ftU; 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 E95535A0277 for ; Fri, 13 Sep 2024 18:20:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726244449; 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=jUQpws8Hwx6ML2gLtB/1mmqs5kCJUUg/6Z/f0ePRZoI=; b=cCuq1ftU2zY13t0M1TG6Vdn7g46ELJL8CzKqyNRnv/r43Pkbb6Feo5lQoVdRjwRgnFWhYp akh3tTIRyBzCpmHc9YPcRLSiTqQiyobG0ifSKGtzFecZCyeywYWaJ6X4p3uba6Tf0JvSKv OuQBIzR/tkAy4Piwm+NMkMfZm54I7cg= Received: from mx-prod-mc-05.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-673-w8YNoxuHPUm-yOAYZ0QVPQ-1; Fri, 13 Sep 2024 12:20:45 -0400 X-MC-Unique: w8YNoxuHPUm-yOAYZ0QVPQ-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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 332841955F44 for ; Fri, 13 Sep 2024 16:20:45 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.192.183]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8AF741956086; Fri, 13 Sep 2024 16:20:43 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v5 3/4] vhost-user: introduce vhost-user API Date: Fri, 13 Sep 2024 18:20:33 +0200 Message-ID: <20240913162036.3635783-4-lvivier@redhat.com> In-Reply-To: <20240913162036.3635783-1-lvivier@redhat.com> References: <20240913162036.3635783-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: UEA62VN37LIMLPGHDNILWIL5LCR66N7Q X-Message-ID-Hash: UEA62VN37LIMLPGHDNILWIL5LCR66N7Q 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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