From 42bebad9ca5fc289bcaad22597b5a1e7f0e3d801 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Mon, 10 Dec 2018 03:06:26 +0000 Subject: [PATCH] Add comments for exported functions --- qemu/qemu-kernel.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qemu/qemu-kernel.go b/qemu/qemu-kernel.go index fd6d9d4..6fa0bf0 100644 --- a/qemu/qemu-kernel.go +++ b/qemu/qemu-kernel.go @@ -44,6 +44,7 @@ func readUntilEOF(pipe io.ReadCloser, buf *[]byte) (err error) { type arch string const ( + // X86_64 must be exactly same as in qemu-system-${HERE} X86_64 arch = "x86_64" I386 = "i386" // TODO add other @@ -325,6 +326,7 @@ func (q *QemuSystem) CopyFile(user, localPath, remotePath string) (err error) { return } +// CopyAndInsmod copy kernel module to temporary file on qemu then insmod it func (q *QemuSystem) CopyAndInsmod(localKoPath string) (output string, err error) { remoteKoPath := fmt.Sprintf("/tmp/module_%d.ko", rand.Int()) err = q.CopyFile("root", localKoPath, remoteKoPath) @@ -346,11 +348,13 @@ func (q *QemuSystem) CopyAndRun(user, path string) (output string, err error) { return q.Command(user, "chmod +x "+remotePath+" && "+remotePath) } +// Debug is for enable qemu debug and set hostname and port for listen func (q *QemuSystem) Debug(conn string) { q.debug = true q.gdb = conn } +// GetSshCommand returns command for connect to qemu machine over ssh func (q QemuSystem) GetSshCommand() (cmd string) { addrPort := strings.Split(q.sshAddrPort, ":") addr := addrPort[0]