about summary refs log tree commit diff
path: root/tvix/store/src/fs/file_attr.rs
diff options
context:
space:
mode:
authorBrian Olsen <brian@maven-group.org>2023-09-29T16·50+0200
committerBrian Olsen <me@griff.name>2023-10-02T15·46+0000
commitcfb810d81a4f5ba60e8d3c5502390d60799aa636 (patch)
tree0c3ddac2a5ee38151db245475d0159c09b6028cb /tvix/store/src/fs/file_attr.rs
parent5c2cad0ac48d7f223fe76b27d3d7ea9d38529e25 (diff)
fix(tvix/store): Fix FUSE support on MacOS r/6687
This partially fixes b/312 and gets FUSE to work again on MacOS.

It is mostly small type changes and an update to fuse-backend-rs because
upstream currently doesn't work with MacFuse. It also sets the default
FUSE thread count on MacOS to 1 because otherwise the mount command will
hang when shutting down as only one thread gets ENODEV and all the others
just keep blocking.

Change-Id: Ifb3c4268caf296c487049c1dc4618acb32497f44
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9490
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/store/src/fs/file_attr.rs')
-rw-r--r--tvix/store/src/fs/file_attr.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/tvix/store/src/fs/file_attr.rs b/tvix/store/src/fs/file_attr.rs
index b946aa977a..562cd9f190 100644
--- a/tvix/store/src/fs/file_attr.rs
+++ b/tvix/store/src/fs/file_attr.rs
@@ -7,7 +7,7 @@ pub const ROOT_FILE_ATTR: Attr = Attr {
     size: 0,
     blksize: 1024,
     blocks: 0,
-    mode: libc::S_IFDIR | 0o555,
+    mode: libc::S_IFDIR as u32 | 0o555,
     atime: 0,
     mtime: 0,
     ctime: 0,
@@ -19,6 +19,12 @@ pub const ROOT_FILE_ATTR: Attr = Attr {
     gid: 0,
     rdev: 0,
     flags: 0,
+    #[cfg(target_os = "macos")]
+    crtime: 0,
+    #[cfg(target_os = "macos")]
+    crtimensec: 0,
+    #[cfg(target_os = "macos")]
+    padding: 0,
 };
 
 /// for given &Node and inode, construct an [Attr]
@@ -36,10 +42,10 @@ pub fn gen_file_attr(inode_data: &InodeData, inode: u64) -> Attr {
             }
         },
         mode: match inode_data {
-            InodeData::Regular(_, _, false) => libc::S_IFREG | 0o444, // no-executable files
-            InodeData::Regular(_, _, true) => libc::S_IFREG | 0o555,  // executable files
-            InodeData::Symlink(_) => libc::S_IFLNK | 0o444,
-            InodeData::Directory(_) => libc::S_IFDIR | 0o555,
+            InodeData::Regular(_, _, false) => libc::S_IFREG as u32 | 0o444, // no-executable files
+            InodeData::Regular(_, _, true) => libc::S_IFREG as u32 | 0o555,  // executable files
+            InodeData::Symlink(_) => libc::S_IFLNK as u32 | 0o444,
+            InodeData::Directory(_) => libc::S_IFDIR as u32 | 0o555,
         },
         ..Default::default()
     }