From e55822c62f7287698a683e6e7e40aa9a992b5585 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 28 Sep 2025 21:51:10 +0900 Subject: container/init: reduce verbose noise This makes it possible to optionally omit the identifying verbose message, for when the Op implementation can provide a much more useful message in its case, using information not yet available to the String method. Signed-off-by: Ophestra --- container/autoroot.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'container/autoroot.go') diff --git a/container/autoroot.go b/container/autoroot.go index 9d456099..c37e49bc 100644 --- a/container/autoroot.go +++ b/container/autoroot.go @@ -22,7 +22,7 @@ type AutoRootOp struct { // obtained during early; // these wrap the underlying Op because BindMountOp is relatively complex, // so duplicating that code would be unwise - resolved []Op + resolved []*BindMountOp } func (r *AutoRootOp) Valid() bool { return r != nil && r.Host != nil } @@ -31,10 +31,11 @@ func (r *AutoRootOp) early(state *setupState, k syscallDispatcher) error { if d, err := k.readdir(r.Host.String()); err != nil { return err } else { - r.resolved = make([]Op, 0, len(d)) + r.resolved = make([]*BindMountOp, 0, len(d)) for _, ent := range d { name := ent.Name() if IsAutoRootBindable(name) { + // careful: the Valid method is skipped, make sure this is always valid op := &BindMountOp{ Source: r.Host.Append(name), Target: AbsFHSRoot.Append(name), @@ -57,7 +58,7 @@ func (r *AutoRootOp) apply(state *setupState, k syscallDispatcher) error { state.nonrepeatable |= nrAutoRoot for _, op := range r.resolved { - k.verbosef("%s %s", op.prefix(), op) + // these are exclusively BindMountOp, do not attempt to print identifying message if err := op.apply(state, k); err != nil { return err } @@ -71,7 +72,7 @@ func (r *AutoRootOp) Is(op Op) bool { r.Host.Is(vr.Host) && r.Flags == vr.Flags } -func (*AutoRootOp) prefix() string { return "setting up" } +func (*AutoRootOp) prefix() (string, bool) { return "setting up", true } func (r *AutoRootOp) String() string { return fmt.Sprintf("auto root %q flags %#x", r.Host, r.Flags) } -- cgit v1.3.1