mirror of
https://github.com/containers/podman.git
synced 2025-10-19 20:23:08 +08:00

This includes two new hidden commands: a 9p server, `podman machine server9p`, and a 9p client, `podman machine client9p` with `server9p` currently only configured to run on Windows and serve 9p via HyperV vsock, and `client9p` only configured to run on Linux. The server is run by `podman machine start` and has the same lifespan as gvproxy (waits for the gvproxy PID to die before shutting down). The client is run inside the VM, also by `podman machine start`, and mounts uses kernel 9p mount code to complete the mount. It's unfortunately not possible to use mount directly without the wrapper; we need to set up the vsock and pass it to mount as an FD. In theory this can be generalized so that the server can run anywhere and over almost any transport, but I haven't done this here as I don't think we have a usecase other than HyperV right now. [NO NEW TESTS NEEDED] This requires changes to Podman in the VM, so we need to wait until a build with this lands in FCOS to test. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package bpf
|
|
|
|
import "fmt"
|
|
|
|
// Assemble converts insts into raw instructions suitable for loading
|
|
// into a BPF virtual machine.
|
|
//
|
|
// Currently, no optimization is attempted, the assembled program flow
|
|
// is exactly as provided.
|
|
func Assemble(insts []Instruction) ([]RawInstruction, error) {
|
|
ret := make([]RawInstruction, len(insts))
|
|
var err error
|
|
for i, inst := range insts {
|
|
ret[i], err = inst.Assemble()
|
|
if err != nil {
|
|
return nil, fmt.Errorf("assembling instruction %d: %s", i+1, err)
|
|
}
|
|
}
|
|
return ret, nil
|
|
}
|
|
|
|
// Disassemble attempts to parse raw back into
|
|
// Instructions. Unrecognized RawInstructions are assumed to be an
|
|
// extension not implemented by this package, and are passed through
|
|
// unchanged to the output. The allDecoded value reports whether insts
|
|
// contains no RawInstructions.
|
|
func Disassemble(raw []RawInstruction) (insts []Instruction, allDecoded bool) {
|
|
insts = make([]Instruction, len(raw))
|
|
allDecoded = true
|
|
for i, r := range raw {
|
|
insts[i] = r.Disassemble()
|
|
if _, ok := insts[i].(RawInstruction); ok {
|
|
allDecoded = false
|
|
}
|
|
}
|
|
return insts, allDecoded
|
|
}
|