diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-16 02:06:41 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-16 02:06:41 +0900 |
| commit | 8dd3e1ee5d10c150f58e3b49771d3ca847f6d4cf (patch) | |
| tree | 08c0c6812d34da419cd06323073989fb7b8d0c21 /hst/fsbind.go | |
| parent | 4ffeec3004607b76f73e504da220a1490c598348 (diff) | |
hst/fs: rename method Target to Path
This allows adapter structs to use the same field names as Op structs.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/fsbind.go')
| -rw-r--r-- | hst/fsbind.go | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/hst/fsbind.go b/hst/fsbind.go index beceecb2..c6f4a7ea 100644 --- a/hst/fsbind.go +++ b/hst/fsbind.go @@ -15,9 +15,9 @@ const FilesystemBind = "bind" // FSBind represents a host to container bind mount. type FSBind struct { // mount point in container, same as src if empty - Dst *container.Absolute `json:"dst,omitempty"` + Target *container.Absolute `json:"dst,omitempty"` // host filesystem path to make available to the container - Src *container.Absolute `json:"src"` + Source *container.Absolute `json:"src"` // do not mount filesystem read-only Write bool `json:"write,omitempty"` // do not disable device files, implies Write @@ -26,23 +26,23 @@ type FSBind struct { Optional bool `json:"optional,omitempty"` } -func (b *FSBind) Valid() bool { return b != nil && b.Src != nil } +func (b *FSBind) Valid() bool { return b != nil && b.Source != nil } -func (b *FSBind) Target() *container.Absolute { +func (b *FSBind) Path() *container.Absolute { if !b.Valid() { return nil } - if b.Dst == nil { - return b.Src + if b.Target == nil { + return b.Source } - return b.Dst + return b.Target } func (b *FSBind) Host() []*container.Absolute { if !b.Valid() { return nil } - return []*container.Absolute{b.Src} + return []*container.Absolute{b.Source} } func (b *FSBind) Apply(ops *container.Ops) { @@ -50,9 +50,9 @@ func (b *FSBind) Apply(ops *container.Ops) { return } - dst := b.Dst - if dst == nil { - dst = b.Src + target := b.Target + if target == nil { + target = b.Source } var flags int if b.Write { @@ -64,7 +64,7 @@ func (b *FSBind) Apply(ops *container.Ops) { if b.Optional { flags |= container.BindOptional } - ops.Bind(b.Src, dst, flags) + ops.Bind(b.Source, target, flags) } func (b *FSBind) String() string { @@ -73,9 +73,9 @@ func (b *FSBind) String() string { return "<invalid>" } - g += len(b.Src.String()) - if b.Dst != nil { - g += len(b.Dst.String()) + g += len(b.Source.String()) + if b.Target != nil { + g += len(b.Target.String()) } expr := new(strings.Builder) @@ -93,9 +93,9 @@ func (b *FSBind) String() string { expr.WriteString("+") } - expr.WriteString(b.Src.String()) - if b.Dst != nil { - expr.WriteString(":" + b.Dst.String()) + expr.WriteString(b.Source.String()) + if b.Target != nil { + expr.WriteString(":" + b.Target.String()) } return expr.String() |
