git.annexia.org
/
virt-mem.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change to using internal format for kernel structures.
[virt-mem.git]
/
ifconfig
/
virt_ifconfig.ml
diff --git
a/ifconfig/virt_ifconfig.ml
b/ifconfig/virt_ifconfig.ml
index
e829944
..
4c4d3ec
100644
(file)
--- a/
ifconfig/virt_ifconfig.ml
+++ b/
ifconfig/virt_ifconfig.ml
@@
-25,12
+25,17
@@
open Virt_mem_types
open Kernel_task_struct
open Kernel_task_struct
-let run debug { domname = domname; mem = mem }
- { utsname = utsname; tasks = tasks } =
- let utsname = Option.get utsname in
- let kernel_version = utsname.kernel_release in
+let run debug { domname = domname; mem = mem } { net_devices = net_devices } =
+ let net_devices = Option.get net_devices in
- ()
+ (* Sort by device name. *)
+ let cmp { netdev_name = n1 } { netdev_name = n2 } = compare n1 n2 in
+ let net_devices = List.sort cmp net_devices in
+
+ List.iter (
+ fun netdev ->
+ printf "%s\n" netdev.netdev_name
+ ) net_devices
let summary = s_"list network interfaces in virtual machine"
let description = s_"\
let summary = s_"list network interfaces in virtual machine"
let description = s_"\
@@
-38,5
+43,4
@@
virt-ifconfig prints a network interfaces for virtual machines.
"
let () =
"
let () =
- Virt_mem.register "ifconfig" summary description
- ~needs_utsname:true ~needs_net_devices:true ~run
+ Virt_mem.register "ifconfig" summary description ~needs_net_devices:true ~run