From d72ae3de4a54257eea7887d0575558ed26cea0b5 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Sun, 26 Apr 2020 22:07:18 -0600 Subject: [PATCH] vfs bugfix --- sys/init/2.vfs.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/init/2.vfs.lua b/sys/init/2.vfs.lua index a19078a..bc1dc96 100644 --- a/sys/init/2.vfs.lua +++ b/sys/init/2.vfs.lua @@ -267,6 +267,16 @@ function fs.mount(path, fstype, ...) if not vfs then error('Invalid file system type') end + +-- hack - get the mount point for the path +-- ie. if packages is mapped to disk/packages +-- and a request to mount /packages/foo +-- then use disk/packages/foo as the mountPoint +local n = getNode(path) +if n.fstype == 'linkfs' then + path = path:gsub(n.mountPoint, n.source, 1) +end + local node = vfs.mount(path, ...) if node then local parts = splitpath(path) @@ -279,9 +289,12 @@ function fs.mount(path, fstype, ...) end if not tp.nodes[d] then tp.nodes[d] = Util.shallowCopy(tp) + + -- another related hack if tp.fstype == 'linkfs' then tp.nodes[d].source = fs.combine(tp.nodes[d].source, d) end + tp.nodes[d].nodes = { } tp.nodes[d].mountPoint = fs.combine(tp.mountPoint, d) end