From 44ba7a5f02b7575a706a22aac53c8ac608d18f23 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 29 Sep 2025 06:32:15 +0900 Subject: hst/enablement: move bits from system This is part of the hst API, should not be in the implementation package. Signed-off-by: Ophestra --- system/system.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'system/system.go') diff --git a/system/system.go b/system/system.go index 0d16a14a..5599218e 100644 --- a/system/system.go +++ b/system/system.go @@ -7,11 +7,12 @@ import ( "strings" "hakurei.app/container" + "hakurei.app/hst" ) const ( // User type is reverted at final instance exit. - User = EM << iota + User = hst.EM << iota // Process type is unconditionally reverted on exit. Process @@ -19,21 +20,21 @@ const ( ) // Criteria specifies types of Op to revert. -type Criteria Enablement +type Criteria hst.Enablement -func (ec *Criteria) hasType(t Enablement) bool { +func (ec *Criteria) hasType(t hst.Enablement) bool { // nil criteria: revert everything except User if ec == nil { return t != User } - return Enablement(*ec)&t != 0 + return hst.Enablement(*ec)&t != 0 } // Op is a reversible system operation. type Op interface { // Type returns [Op]'s enablement type, for matching a revert criteria. - Type() Enablement + Type() hst.Enablement apply(sys *I) error revert(sys *I, ec *Criteria) error @@ -44,7 +45,7 @@ type Op interface { } // TypeString extends [Enablement.String] to support [User] and [Process]. -func TypeString(e Enablement) string { +func TypeString(e hst.Enablement) string { switch e { case User: return "user" -- cgit v1.3.1