All checks were successful
		
		
	
	Test / Create distribution (push) Successful in 34s
				
			Test / Hpkg (push) Successful in 4m3s
				
			Test / Sandbox (race detector) (push) Successful in 4m26s
				
			Test / Hakurei (race detector) (push) Successful in 5m19s
				
			Test / Sandbox (push) Successful in 1m28s
				
			Test / Hakurei (push) Successful in 2m16s
				
			Test / Flake checks (push) Successful in 1m37s
				
			This allows use of absolute pathname values without importing container. Signed-off-by: Ophestra <cat@gensokyo.uk>
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package container
 | |
| 
 | |
| import (
 | |
| 	"encoding/gob"
 | |
| 	"fmt"
 | |
| 
 | |
| 	"hakurei.app/container/check"
 | |
| )
 | |
| 
 | |
| func init() { gob.Register(new(RemountOp)) }
 | |
| 
 | |
| // Remount appends an [Op] that applies [RemountOp.Flags] on container path [RemountOp.Target].
 | |
| func (f *Ops) Remount(target *check.Absolute, flags uintptr) *Ops {
 | |
| 	*f = append(*f, &RemountOp{target, flags})
 | |
| 	return f
 | |
| }
 | |
| 
 | |
| // RemountOp remounts Target with Flags.
 | |
| type RemountOp struct {
 | |
| 	Target *check.Absolute
 | |
| 	Flags  uintptr
 | |
| }
 | |
| 
 | |
| func (r *RemountOp) Valid() bool                              { return r != nil && r.Target != nil }
 | |
| func (*RemountOp) early(*setupState, syscallDispatcher) error { return nil }
 | |
| func (r *RemountOp) apply(state *setupState, k syscallDispatcher) error {
 | |
| 	return k.remount(state, toSysroot(r.Target.String()), r.Flags)
 | |
| }
 | |
| 
 | |
| func (r *RemountOp) Is(op Op) bool {
 | |
| 	vr, ok := op.(*RemountOp)
 | |
| 	return ok && r.Valid() && vr.Valid() &&
 | |
| 		r.Target.Is(vr.Target) &&
 | |
| 		r.Flags == vr.Flags
 | |
| }
 | |
| func (*RemountOp) prefix() (string, bool) { return "remounting", true }
 | |
| func (r *RemountOp) String() string       { return fmt.Sprintf("%q flags %#x", r.Target, r.Flags) }
 |