agent: Use a constant for CCW root bus path

used a function like PCI does, but this is not necessary

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
Jakob Naucke 2022-02-16 15:18:07 +00:00 committed by Hyounggyu Choi
parent 814d07af58
commit 68a586e52c
2 changed files with 4 additions and 5 deletions

View File

@ -280,7 +280,7 @@ pub async fn get_virtio_blk_ccw_device_name(
sandbox: &Arc<Mutex<Sandbox>>, sandbox: &Arc<Mutex<Sandbox>>,
device: &ccw::Device, device: &ccw::Device,
) -> Result<String> { ) -> Result<String> {
let matcher = VirtioBlkCCWMatcher::new(&create_ccw_root_bus_path(), device); let matcher = VirtioBlkCCWMatcher::new(CCW_ROOT_BUS_PATH, device);
let uev = wait_for_uevent(sandbox, matcher).await?; let uev = wait_for_uevent(sandbox, matcher).await?;
let devname = uev.devname; let devname = uev.devname;
return match Path::new(SYSTEM_DEV_PATH).join(&devname).to_str() { return match Path::new(SYSTEM_DEV_PATH).join(&devname).to_str() {
@ -1378,7 +1378,7 @@ mod tests {
#[cfg(target_arch = "s390x")] #[cfg(target_arch = "s390x")]
#[tokio::test] #[tokio::test]
async fn test_virtio_blk_ccw_matcher() { async fn test_virtio_blk_ccw_matcher() {
let root_bus = create_ccw_root_bus_path(); let root_bus = CCW_ROOT_BUS_PATH;
let subsystem = "block"; let subsystem = "block";
let devname = "vda"; let devname = "vda";
let relpath = "0.0.0002"; let relpath = "0.0.0002";

View File

@ -65,9 +65,8 @@ pub fn create_pci_root_bus_path() -> String {
} }
#[cfg(target_arch = "s390x")] #[cfg(target_arch = "s390x")]
pub fn create_ccw_root_bus_path() -> String { pub const CCW_ROOT_BUS_PATH: &str = "/devices/css0";
String::from("/devices/css0")
}
// From https://www.kernel.org/doc/Documentation/acpi/namespace.txt // From https://www.kernel.org/doc/Documentation/acpi/namespace.txt
// The Linux kernel's core ACPI subsystem creates struct acpi_device // The Linux kernel's core ACPI subsystem creates struct acpi_device
// objects for ACPI namespace objects representing devices, power resources // objects for ACPI namespace objects representing devices, power resources