Switch ParcelFileDescriptor to OwnerFd
The inner type of ParcelFileDescriptor is switching
from std::fs::File to std::os::fd::OwnedFd.
Update all uses accordingly.
Bug: 242243245
Test: m
Change-Id: I10fce8d12f46f7dbbe12d399d7d5b970ccf313e0
diff --git a/virtualizationmanager/src/selinux.rs b/virtualizationmanager/src/selinux.rs
index 0485943..ba62b7f 100644
--- a/virtualizationmanager/src/selinux.rs
+++ b/virtualizationmanager/src/selinux.rs
@@ -17,11 +17,10 @@
use anyhow::{anyhow, bail, Context, Result};
use std::ffi::{CStr, CString};
use std::fmt;
-use std::fs::File;
use std::io;
use std::ops::Deref;
+use std::os::fd::AsRawFd;
use std::os::raw::c_char;
-use std::os::unix::io::AsRawFd;
use std::ptr;
// Partially copied from system/security/keystore2/selinux/src/lib.rs
@@ -102,7 +101,7 @@
}
}
-pub fn getfilecon(file: &File) -> Result<SeContext> {
+pub fn getfilecon<F: AsRawFd>(file: &F) -> Result<SeContext> {
let fd = file.as_raw_fd();
let mut con: *mut c_char = ptr::null_mut();
// SAFETY: the returned pointer `con` is wrapped in SeContext::Raw which is freed with