1
0

Add comments for exported functions

This commit is contained in:
dump_stack() 2018-12-10 03:06:26 +00:00
parent 556ead8594
commit 42bebad9ca

View File

@ -44,6 +44,7 @@ func readUntilEOF(pipe io.ReadCloser, buf *[]byte) (err error) {
type arch string type arch string
const ( const (
// X86_64 must be exactly same as in qemu-system-${HERE}
X86_64 arch = "x86_64" X86_64 arch = "x86_64"
I386 = "i386" I386 = "i386"
// TODO add other // TODO add other
@ -325,6 +326,7 @@ func (q *QemuSystem) CopyFile(user, localPath, remotePath string) (err error) {
return return
} }
// CopyAndInsmod copy kernel module to temporary file on qemu then insmod it
func (q *QemuSystem) CopyAndInsmod(localKoPath string) (output string, err error) { func (q *QemuSystem) CopyAndInsmod(localKoPath string) (output string, err error) {
remoteKoPath := fmt.Sprintf("/tmp/module_%d.ko", rand.Int()) remoteKoPath := fmt.Sprintf("/tmp/module_%d.ko", rand.Int())
err = q.CopyFile("root", localKoPath, remoteKoPath) 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) 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) { func (q *QemuSystem) Debug(conn string) {
q.debug = true q.debug = true
q.gdb = conn q.gdb = conn
} }
// GetSshCommand returns command for connect to qemu machine over ssh
func (q QemuSystem) GetSshCommand() (cmd string) { func (q QemuSystem) GetSshCommand() (cmd string) {
addrPort := strings.Split(q.sshAddrPort, ":") addrPort := strings.Split(q.sshAddrPort, ":")
addr := addrPort[0] addr := addrPort[0]