From 7ca970113ed0913396cd312391e4b3eb5997c7ca Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Wed, 23 Oct 2024 16:54:09 -0700 Subject: [PATCH 1/3] install FUSE dependency Signed-off-by: Brian L. Troutwine --- .github/actions/install-fuse/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/install-fuse/action.yml b/.github/actions/install-fuse/action.yml index 986e6eee7..5e12d81fa 100644 --- a/.github/actions/install-fuse/action.yml +++ b/.github/actions/install-fuse/action.yml @@ -5,7 +5,11 @@ runs: steps: - run: | if [ "${{ runner.os }}" == "Linux" ]; then +<<<<<<< HEAD sudo apt-get update && sudo apt-get install -y fuse3 libfuse3-dev +======= + sudo apt-get update && sudo apt-get install -y fuse +>>>>>>> f07473c (install FUSE dependency) elif [ "${{ runner.os }}" == "macOS" ]; then brew install macfuse fi From 48ad9ed1d746151f754fbf8acc96f690e8d47a24 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Wed, 23 Oct 2024 16:58:11 -0700 Subject: [PATCH 2/3] install fuse3 not fuse2 on linux Signed-off-by: Brian L. Troutwine --- .github/actions/install-fuse/action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/actions/install-fuse/action.yml b/.github/actions/install-fuse/action.yml index 5e12d81fa..986e6eee7 100644 --- a/.github/actions/install-fuse/action.yml +++ b/.github/actions/install-fuse/action.yml @@ -5,11 +5,7 @@ runs: steps: - run: | if [ "${{ runner.os }}" == "Linux" ]; then -<<<<<<< HEAD sudo apt-get update && sudo apt-get install -y fuse3 libfuse3-dev -======= - sudo apt-get update && sudo apt-get install -y fuse ->>>>>>> f07473c (install FUSE dependency) elif [ "${{ runner.os }}" == "macOS" ]; then brew install macfuse fi From 4206504e2903f4717160d9ce9e803f0fcb093cc3 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Wed, 16 Oct 2024 16:40:44 -0700 Subject: [PATCH 3/3] Ensure file size updates due to getattr This commit ensures that a Node has advance_time called on it when the filesystem calls getattr. If this is not done repeat calls to ls, for instance, will show the file size not changing although a call to read would. Signed-off-by: Brian L. Troutwine --- lading/src/generator/file_gen/model.rs | 47 ++++++++++++++++---------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/lading/src/generator/file_gen/model.rs b/lading/src/generator/file_gen/model.rs index c65dc8071..5649014aa 100644 --- a/lading/src/generator/file_gen/model.rs +++ b/lading/src/generator/file_gen/model.rs @@ -146,6 +146,16 @@ pub enum Node { }, } +impl Node { + /// Run the clock forward on this node + pub fn advance_time(&mut self, now: Tick) { + match self { + Node::Directory { .. } => { /* nothing, intentionally */ } + Node::File { file, .. } => file.advance_time(now), + } + } +} + /// The state of the filesystem /// /// This structure is responsible for maintenance of the structure of the @@ -299,23 +309,26 @@ impl State { pub fn getattr(&mut self, now: Tick, inode: Inode) -> Option { self.advance_time(now); - self.nodes.get(&inode).map(|node| match node { - Node::File { file, .. } => NodeAttributes { - inode, - kind: NodeType::File, - size: file.bytes_written, - access_tick: file.access_tick, - modified_tick: file.modified_tick, - status_tick: file.status_tick, - }, - Node::Directory { .. } => NodeAttributes { - inode, - kind: NodeType::Directory, - size: 0, - access_tick: self.now, - modified_tick: self.now, - status_tick: self.now, - }, + self.nodes.get_mut(&inode).map(|node| { + node.advance_time(now); + match node { + Node::File { file, .. } => NodeAttributes { + inode, + kind: NodeType::File, + size: file.bytes_written, + access_tick: file.access_tick, + modified_tick: file.modified_tick, + status_tick: file.status_tick, + }, + Node::Directory { .. } => NodeAttributes { + inode, + kind: NodeType::Directory, + size: 0, + access_tick: self.now, + modified_tick: self.now, + status_tick: self.now, + }, + } }) }