From a3a8c1b84606e178d3f46d96b28935d74680479d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?okhowang=28=E7=8E=8B=E6=B2=9B=E6=96=87=29?= Date: Tue, 27 Jan 2026 15:57:57 +0800 Subject: [PATCH] feat: Add overlay mount option parsing utilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: okhowang(王沛文) --- overlayUtils/overlayUtils.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/overlayUtils/overlayUtils.go b/overlayUtils/overlayUtils.go index 6764171..f8c2d59 100644 --- a/overlayUtils/overlayUtils.go +++ b/overlayUtils/overlayUtils.go @@ -117,3 +117,23 @@ func GetUpperLayer(mntOpts *MountOpts) string { } return "" } + +func GetWorkLayer(mntOpts *MountOpts) string { + opts := strings.Split(mntOpts.Opts, ",") + for _, opt := range opts { + if strings.HasPrefix(opt, "workdir=") { + return strings.TrimPrefix(opt, "workdir=") + } + } + return "" +} + +func GetVolatile(mntOpts *MountOpts) bool { + opts := strings.Split(mntOpts.Opts, ",") + for _, opt := range opts { + if opt == "volatile" { + return true + } + } + return false +}