devices/virtio/vhost_user_frontend/sys/
unix.rs

1// Copyright 2022 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use base::SafeDescriptor;
6use vmm_vhost::FrontendServer;
7
8use crate::virtio::vhost_user_frontend::handler::BackendReqHandler;
9use crate::virtio::vhost_user_frontend::handler::BackendReqHandlerImpl;
10use crate::virtio::vhost_user_frontend::Error;
11use crate::virtio::vhost_user_frontend::Result as VhostResult;
12
13pub fn create_backend_req_handler(
14    h: BackendReqHandlerImpl,
15) -> VhostResult<(BackendReqHandler, SafeDescriptor)> {
16    FrontendServer::with_stream(h).map_err(Error::CreateBackendReqHandler)
17}