Skip to content

Commit

Permalink
fixups: TODO: split and squash these
Browse files Browse the repository at this point in the history
- 9P server does not need to take flags (guest does)
- forgot to wire up the unmount unmarshal logic
- const name changed
  • Loading branch information
djdv committed Nov 19, 2023
1 parent 6a4c02a commit d7712d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
20 changes: 4 additions & 16 deletions internal/commands/mountpoint_9p.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type (
plan9HostOptions []plan9HostOption
)

const p9GuestSrvFlagName = "server"
const p9ServerFlagName = "server"

func makePlan9HostCommand() command.Command {
return makeMountSubcommand(
Expand All @@ -49,19 +49,7 @@ func (*plan9HostOptions) usage(guest filesystem.ID) string {
string(guest) + " as a 9P file server"
}

func (o9 *plan9HostOptions) BindFlags(flagSet *flag.FlagSet) {
// TODO: - dedupe with guest
var (
flagPrefix = prefixIDFlag(p9fs.HostID)
srvUsage = "9P2000.L file system server `maddr`"
srvName = flagPrefix + p9GuestSrvFlagName
)
flagSetFunc(flagSet, srvName, srvUsage, o9,
func(value multiaddr.Multiaddr, settings *plan9HostSettings) error {
settings.Maddr = value
return nil
})
}
func (*plan9HostOptions) BindFlags(*flag.FlagSet) { /* NOOP */ }

func (o9 plan9HostOptions) make() (plan9HostSettings, error) {
return makeWithOptions(o9...)
Expand Down Expand Up @@ -101,7 +89,7 @@ func (o9 *plan9GuestOptions) BindFlags(flagSet *flag.FlagSet) {
var (
flagPrefix = prefixIDFlag(p9fs.GuestID)
srvUsage = "9P2000.L file system server `maddr`"
srvName = flagPrefix + p9GuestSrvFlagName
srvName = flagPrefix + p9ServerFlagName
)
flagSetFunc(flagSet, srvName, srvUsage, o9,
func(value multiaddr.Multiaddr, settings *plan9GuestSettings) error {
Expand All @@ -118,7 +106,7 @@ func (o9 plan9GuestOptions) make() (plan9GuestSettings, error) {
if settings.Maddr == nil {
var (
flagPrefix = prefixIDFlag(p9fs.GuestID)
srvName = flagPrefix + p9GuestSrvFlagName
srvName = flagPrefix + p9ServerFlagSuffix

Check failure on line 109 in internal/commands/mountpoint_9p.go

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

undefined: p9ServerFlagSuffix

Check failure on line 109 in internal/commands/mountpoint_9p.go

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

undefined: p9ServerFlagSuffix
)
return plan9GuestSettings{}, fmt.Errorf(
"flag `-%s` must be provided for 9P guests",
Expand Down
1 change: 1 addition & 0 deletions internal/commands/unmount.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func newDecodeTargetFunc() p9fs.DecodeTargetFunc {
var (
decoderMakers = []makeDecoderFunc{
unmarshalFUSE,
unmarshalPlan9,
}
decoders = make(decoders, len(decoderMakers))
)
Expand Down

0 comments on commit d7712d6

Please sign in to comment.