blob: 1a1cce8d5eb5e7a384d99a1450cc353584758dcd [file] [log] [blame]
Inseob Kimbdca0472023-07-28 19:20:56 +09001// Copyright 2023 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Android VfioHandler
16
17mod aidl;
18
19use crate::aidl::VfioHandler;
20use android_logger::Config;
21use android_system_virtualizationservice_internal::aidl::android::system::virtualizationservice_internal::IVfioHandler::{
22 BnVfioHandler,
23 BpVfioHandler,
24 IVfioHandler,
25};
26use binder::{register_lazy_service, BinderFeatures, ProcessState};
27use log::{info, Level};
28
29const LOG_TAG: &str = "VfioHandler";
30
31fn main() {
32 android_logger::init_once(
33 Config::default()
34 .with_tag(LOG_TAG)
35 .with_min_level(Level::Info)
36 .with_log_id(android_logger::LogId::System),
37 );
38
39 let service = VfioHandler::init();
40 let service = BnVfioHandler::new_binder(service, BinderFeatures::default());
41 register_lazy_service(<BpVfioHandler as IVfioHandler>::get_descriptor(), service.as_binder())
42 .unwrap();
43 info!("Registered Binder service, joining threadpool.");
44 ProcessState::join_thread_pool();
45}