QEMU Object Model树状图
下面是QEMUobject Model(QOM)的树状图,使用bash脚本生成的
#!/bin/bash INFO_FILE="$(pwd)/test.txt" function catfile() { local dir dir="$1" cat $INFO_FILE | grep "^$dir " | awk -F " -> " '{print $2}' | xargs mkdir if [ $(ls * | wc -w) -eq 0 ];then return fi for i in * do pushd $i catfile $i popd done } mkdir object pushd object catfile object popd
QOM在预处理的初始化过程中会注册很多设备类型,具体object树状图如下:
object ├── accel │ ├── kvm-accel │ ├── qtest-accel │ └── tcg-accel ├── bus │ ├── ccid-bus │ ├── HDA │ ├── i2c-bus │ ├── IDE │ ├── IndustryPack │ ├── ISA │ ├── PCI │ │ ├── PCIE │ │ └── pxb-bus │ ├── SCSI │ ├── System │ ├── usb-bus │ ├── virtio-bus │ │ ├── virtio-mmio-bus │ │ └── virtio-pci-bus │ └── virtio-serial-bus ├── container ├── device │ ├── apic-common │ │ ├── apic │ │ └── kvm-apic │ ├── ccid-card │ ├── cpu │ │ └── x86_64-cpu │ ├── hda-codec │ │ └── hda-audio │ ├── i2c-slave │ │ └── smbus-device │ ├── ide-device │ │ ├── ide-cd │ │ ├── ide-drive │ │ └── ide-hd │ ├── ipack-device │ │ └── ipoctal232 │ ├── isa-device │ │ ├── adlib │ │ ├── cs4231a │ │ ├── gus │ │ ├── i8042 │ │ ├── ib700 │ │ ├── isa-applesmc │ │ ├── isa-cirrus-vga │ │ ├── isa-debugcon │ │ ├── isa-debug-exit │ │ ├── isa-fdc │ │ ├── isa-ide │ │ ├── isa-parallel │ │ ├── isa-pcspk │ │ ├── isa-serial │ │ ├── isa-vga │ │ ├── mc146818rtc │ │ ├── ne2k_isa │ │ ├── pc-testdev │ │ ├── pic-common │ │ │ ├── isa-i8259 │ │ │ └── kvm-i8259 │ │ ├── pit-common │ │ │ ├── isa-pit │ │ │ └── kvm-pit │ │ ├── port92 │ │ ├── pvpanic │ │ ├── sb16 │ │ ├── sga │ │ ├── tpm-tis │ │ ├── vmmouse │ │ └── vmport │ ├── pc-dimm │ ├── pci-device │ │ ├── AC97 │ │ ├── am53c974 │ │ │ └── dc390 │ │ ├── base-pci-bridge │ │ │ ├── i82801b11-bridge │ │ │ ├── pci-bridge │ │ │ │ └── pci-bridge-seat │ │ │ └── pcie-port │ │ │ ├── pcie-slot │ │ │ │ ├── ioh3420 │ │ │ │ └── xio3130-downstream │ │ │ └── x3130-upstream │ │ ├── cirrus-vga │ │ ├── e1000-base │ │ │ ├── e1000 │ │ │ ├── e1000-82544gc │ │ │ └── e1000-82545em │ │ ├── edu │ │ ├── ES1370 │ │ ├── i440FX │ │ │ └── igd-passthrough-i440FX │ │ ├── i6300esb │ │ ├── i82550 │ │ ├── i82551 │ │ ├── i82557a │ │ ├── i82557b │ │ ├── i82557c │ │ ├── i82558a │ │ ├── i82558b │ │ ├── i82559a │ │ ├── i82559b │ │ ├── i82559c │ │ ├── i82559er │ │ ├── i82562 │ │ ├── i82801 │ │ ├── ICH9 │ │ ├── ich9-ahci │ │ ├── ICH9-LPC │ │ ├── igd-passthrough-isa-bridge │ │ ├── intel-hda-generic │ │ │ ├── ich9-intel-hda │ │ │ └── intel-hda │ │ ├── ivshmem │ │ ├── kvm-pci-assign │ │ ├── lsi53c895a │ │ │ └── lsi53c810 │ │ ├── mch │ │ ├── megasas-base │ │ │ ├── megasas │ │ │ └── megasas-gen2 │ │ ├── ne2k_pci │ │ ├── nec-usb-xhci │ │ ├── nvme │ │ ├── pci-ehci-usb │ │ │ ├── ich9-usb-ehci1 │ │ │ ├── ich9-usb-ehci2 │ │ │ └── usb-ehci │ │ ├── pci-ide │ │ │ ├── piix3-ide │ │ │ ├── piix3-ide-xen │ │ │ └── piix4-ide │ │ ├── pci-ohci │ │ ├── pci-piix3 │ │ │ ├── PIIX3 │ │ │ └── PIIX3-xen │ │ ├── pci-serial │ │ ├── pci-serial-2x │ │ ├── pci-serial-4x │ │ ├── pci-testdev │ │ ├── pci-uhci-usb │ │ │ ├── ich9-usb-uhci1 │ │ │ ├── ich9-usb-uhci2 │ │ │ ├── ich9-usb-uhci3 │ │ │ ├── ich9-usb-uhci4 │ │ │ ├── ich9-usb-uhci5 │ │ │ ├── ich9-usb-uhci6 │ │ │ ├── piix3-usb-uhci │ │ │ ├── piix4-usb-uhci │ │ │ └── vt82c686b-usb-uhci │ │ ├── pci-vga │ │ │ ├── secondary-vga │ │ │ └── VGA │ │ ├── pcnet │ │ ├── PIIX4_PM │ │ ├── pvscsi │ │ ├── pxb │ │ ├── rocker │ │ ├── rtl8139 │ │ ├── sdhci-pci │ │ ├── SMB │ │ ├── tpci200 │ │ ├── vfio-pci │ │ ├── virtio-pci │ │ │ ├── virtio-balloon-pci │ │ │ ├── virtio-blk-pci │ │ │ ├── virtio-gpu-pci │ │ │ ├── virtio-input-pci │ │ │ │ ├── virtio-input-hid-pci │ │ │ │ │ ├── virtio-keyboard-pci │ │ │ │ │ ├── virtio-mouse-pci │ │ │ │ │ └── virtio-tablet-pci │ │ │ │ └── virtio-input-host-pci │ │ │ ├── virtio-net-pci │ │ │ ├── virtio-rng-pci │ │ │ ├── virtio-scsi-pci │ │ │ ├── virtio-serial-pci │ │ │ └── virtio-vga │ │ ├── vmware-svga │ │ └── vmxnet3 │ ├── pcmcia-card │ ├── scsi-device │ │ ├── scsi-block │ │ ├── scsi-cd │ │ ├── scsi-disk │ │ ├── scsi-generic │ │ └── scsi-hd │ ├── sys-bus-device │ │ ├── base-sysbus-fdc │ │ │ ├── SUNW,fdtwo │ │ │ └── sysbus-fdc │ │ ├── cfi.pflash01 │ │ ├── esp │ │ ├── fw_cfg │ │ │ ├── fw_cfg_io │ │ │ └── fw_cfg_mem │ │ ├── generic-sdhci │ │ ├── hpet │ │ ├── intel-iommu │ │ ├── ioapic-common │ │ │ ├── ioapic │ │ │ └── kvm-ioapic │ │ ├── isabus-bridge │ │ ├── kvmclock │ │ ├── kvmvapic │ │ ├── pci-host-bridge │ │ │ ├── i440FX-pcihost │ │ │ ├── pcie-host-bridge │ │ │ │ └── q35-pcihost │ │ │ └── pxb-host │ │ ├── sysbus-ahci │ │ │ └── allwinner-ahci │ │ ├── sysbus-ohci │ │ ├── vfio-platform │ │ │ └── vfio-calxeda-xgmac │ │ └── virtio-mmio │ ├── usb-device │ │ ├── usb-audio │ │ ├── usb-bt-dongle │ │ ├── usb-ccid │ │ ├── usb-hid │ │ │ ├── usb-kbd │ │ │ ├── usb-mouse │ │ │ └── usb-tablet │ │ ├── usb-host │ │ ├── usb-hub │ │ ├── usb-mtp │ │ ├── usb-net │ │ ├── usb-serial-dev │ │ │ ├── usb-braille │ │ │ └── usb-serial │ │ ├── usb-storage-dev │ │ │ ├── usb-bot │ │ │ └── usb-storage │ │ ├── usb-uas │ │ └── usb-wacom-tablet │ ├── virtio-device │ │ ├── virtio-balloon-device │ │ ├── virtio-blk-device │ │ ├── virtio-gpu-device │ │ ├── virtio-input-device │ │ │ ├── virtio-input-hid-device │ │ │ │ ├── virtio-keyboard-device │ │ │ │ ├── virtio-mouse-device │ │ │ │ └── virtio-tablet-device │ │ │ └── virtio-input-host-device │ │ ├── virtio-net-device │ │ ├── virtio-rng-device │ │ ├── virtio-scsi-common │ │ │ └── virtio-scsi-device │ │ └── virtio-serial-device │ └── virtio-serial-port │ └── virtserialport ├── iothread ├── irq ├── machine │ ├── generic-pc-machine │ │ ├── isapc-machine │ │ ├── pc-0.10-machine │ │ ├── pc-0.11-machine │ │ ├── pc-0.12-machine │ │ ├── pc-0.13-machine │ │ ├── pc-0.14-machine │ │ ├── pc-0.15-machine │ │ ├── pc-1.0-machine │ │ ├── pc-1.1-machine │ │ ├── pc-1.2-machine │ │ ├── pc-1.3-machine │ │ ├── pc-i440fx-1.4-machine │ │ ├── pc-i440fx-1.5-machine │ │ ├── pc-i440fx-1.6-machine │ │ ├── pc-i440fx-1.7-machine │ │ ├── pc-i440fx-2.0-machine │ │ ├── pc-i440fx-2.1-machine │ │ ├── pc-i440fx-2.2-machine │ │ ├── pc-i440fx-2.3-machine │ │ ├── pc-i440fx-2.4-machine │ │ ├── pc-i440fx-2.5-machine │ │ ├── pc-q35-1.4-machine │ │ ├── pc-q35-1.5-machine │ │ ├── pc-q35-1.6-machine │ │ ├── pc-q35-1.7-machine │ │ ├── pc-q35-2.0-machine │ │ ├── pc-q35-2.1-machine │ │ ├── pc-q35-2.2-machine │ │ ├── pc-q35-2.3-machine │ │ ├── pc-q35-2.4-machine │ │ └── pc-q35-2.5-machine │ └── none-machine ├── memory-backend │ ├── memory-backend-file │ └── memory-backend-ram ├── netfilter │ ├── filter-buffer │ └── filter-dump ├── qemu-console ├── qemu:memory-region ├── QJSON ├── rng-backend │ ├── rng-egd │ └── rng-random ├── tls-creds │ ├── tls-creds-anon │ └── tls-creds-x509 └── tpm-backend └── tpm-passthrough
QEMU Object Model树状图来自于OenHan
链接为:https://oenhan.com/qemu-object-model
你好!有一个小疏漏,与Object同级的还有个interface:
interface
|–acpi-device-interface
|–fw-path-provider
|–hotplug-handler
|–nmi
|–intctrl
|–ipmi-interface
|–isa-dma
|–user-creatable
test.txt 是啥?
@萧哲 是QEMU的打印日志, 将TypeInfo的name和parent打印出来
struct TypeInfo
{
const char *name;
const char *parent;
}
没太看懂你的脚本,写了一个非递归的。:)
#qom_log.txt格式: parent,name
for line in $(cat ../qom_log.txt)
do
parent=${line%,*}
name=${line##*,}
parent_path=( $(find . -name $parent) )
name_path=( $(find . -name $name) )
if [ -z “$parent_path” ]; then
mkdir $parent
parent_path=$parent
fi
if [ -z “$name_path” ]; then
mkdir $parent_path/$name
else
mv -f $name_path $parent_path/$name_path
fi
done