gevico/machina

[Open Source Workshop] Warn when -device is ignored on non-Unix or for unsupported devices

Open

#85 建立於 2026年4月25日

在 GitHub 查看
 (0 留言) (0 反應) (1 負責人)Rust (24 fork)github user discovery
buggood first issuehelp wanted

倉庫指標

Star
 (31 star)
PR 合併指標
 (PR 指標待抓取)

描述

Problem Description

In src/main.rs lines 192-203, the -device handler only enables virtio-net-device on Unix platforms:

"-device" => {
    let val = args.get(i).ok_or("-device requires argument")?;
    #[cfg(unix)]
    if val.starts_with("virtio-net-device,") {
        cli.device_net_raw = Some(val.clone());
    }
    let _ = val;
}

On Windows or other non-Unix platforms, a user passing -device virtio-net-device,netdev=net0 has the device silently dropped with no warning.

Even on Unix platforms, unsupported device names such as virtio-blk-device are silently ignored.

Expected Behavior

  1. On non-Unix platforms, when -device is specified, print a warning explaining that the device type is unsupported on that platform.
  2. On Unix platforms, print a warning for unsupported device names.

Affected Files

  • src/main.rs lines 192-203

Difficulty Notes

This only requires adding conditional branches and eprintln! warnings.

貢獻者指南