Extract a library for common CompOS things
A small refactoring as a preliminary step to creating composd.
Create a Rust library for useful things shared by various
CompOS-related binaries. This initially includes the code to start the
VM and connect to CompOS, as well as various useful constants.
As part of extracting the start VM code I migrated to using logging
directly rather than writing to stdout/stderr for greater reusability,
as suggested by Victor.
Bug: 186126194
Test: Get odsign to run compos_verify_key, still works
Change-Id: I57b7ebcdd1a6cb604b5d739b8a8e028fd59e7b90
diff --git a/compos/src/compsvc_main.rs b/compos/src/compsvc_main.rs
index 46c8f8c..9855b53 100644
--- a/compos/src/compsvc_main.rs
+++ b/compos/src/compsvc_main.rs
@@ -16,16 +16,15 @@
//! A tool to start a standalone compsvc server that serves over RPC binder.
-mod common;
mod compilation;
mod compos_key_service;
mod compsvc;
mod fsverity;
mod signer;
-use crate::common::VSOCK_PORT;
use anyhow::{bail, Result};
use binder::unstable_api::AsNative;
+use compos_common::COMPOS_VSOCK_PORT;
use log::debug;
fn main() -> Result<()> {
@@ -40,7 +39,7 @@
let retval = unsafe {
binder_rpc_unstable_bindgen::RunRpcServer(
service.as_native_mut() as *mut binder_rpc_unstable_bindgen::AIBinder,
- VSOCK_PORT,
+ COMPOS_VSOCK_PORT,
)
};
if retval {