mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-17 01:58:02 +00:00
vm/vmimpl: refactor DiagnoseFree/OpenBSD
Make signatures of these functions match vm.Diagnose. Both more flexible, less code, more reasonable.
This commit is contained in:
parent
a2d5b1c04d
commit
d60b9c6b0e
@ -346,7 +346,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
|
||||
}
|
||||
|
||||
func (inst *instance) Diagnose() ([]byte, bool) {
|
||||
return nil, vmimpl.DiagnoseFreeBSD(inst.consolew)
|
||||
return vmimpl.DiagnoseFreeBSD(inst.consolew)
|
||||
}
|
||||
|
||||
func parseIP(output []byte) string {
|
||||
|
@ -371,10 +371,10 @@ func waitForConsoleConnect(merger *vmimpl.OutputMerger) error {
|
||||
|
||||
func (inst *instance) Diagnose() ([]byte, bool) {
|
||||
if inst.env.OS == "freebsd" {
|
||||
return nil, vmimpl.DiagnoseFreeBSD(inst.consolew)
|
||||
return vmimpl.DiagnoseFreeBSD(inst.consolew)
|
||||
}
|
||||
if inst.env.OS == "openbsd" {
|
||||
return nil, vmimpl.DiagnoseOpenBSD(inst.consolew)
|
||||
return vmimpl.DiagnoseOpenBSD(inst.consolew)
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
// is expected to be connected to a panicked FreeBSD kernel. If kernel
|
||||
// just hanged, we've lost connection or detected some non-panic
|
||||
// error, console still shows normal login prompt.
|
||||
func DiagnoseFreeBSD(w io.Writer) bool {
|
||||
func DiagnoseFreeBSD(w io.Writer) ([]byte, bool) {
|
||||
commands := []string{
|
||||
"",
|
||||
"set $lines = 0", // disable pagination
|
||||
@ -28,5 +28,5 @@ func DiagnoseFreeBSD(w io.Writer) bool {
|
||||
w.Write([]byte(c + "\n"))
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
return true
|
||||
return nil, true
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
// is expected to be connected to a paniced openbsd kernel. If kernel
|
||||
// just hanged, we've lost connection or detected some non-panic
|
||||
// error, console still shows normal login prompt.
|
||||
func DiagnoseOpenBSD(w io.Writer) bool {
|
||||
func DiagnoseOpenBSD(w io.Writer) ([]byte, bool) {
|
||||
commands := []string{
|
||||
"",
|
||||
"set $lines = 0", // disable pagination
|
||||
@ -30,5 +30,5 @@ func DiagnoseOpenBSD(w io.Writer) bool {
|
||||
w.Write([]byte(c + "\n"))
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
return true
|
||||
return nil, true
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
|
||||
}
|
||||
|
||||
func (inst *instance) Diagnose() ([]byte, bool) {
|
||||
return nil, vmimpl.DiagnoseOpenBSD(inst.consolew)
|
||||
return vmimpl.DiagnoseOpenBSD(inst.consolew)
|
||||
}
|
||||
|
||||
// Run the given vmctl(8) command and wait for it to finish.
|
||||
|
Loading…
x
Reference in New Issue
Block a user