about summary refs log tree commit diff
path: root/tvix/store/src/fs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/store/src/fs')
-rw-r--r--tvix/store/src/fs/file_attr.rs16
-rw-r--r--tvix/store/src/fs/fuse.rs8
-rw-r--r--tvix/store/src/fs/mod.rs11
3 files changed, 24 insertions, 11 deletions
diff --git a/tvix/store/src/fs/file_attr.rs b/tvix/store/src/fs/file_attr.rs
index b946aa977a0a..562cd9f19002 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()
     }
diff --git a/tvix/store/src/fs/fuse.rs b/tvix/store/src/fs/fuse.rs
index 8535c7858450..d2a734882196 100644
--- a/tvix/store/src/fs/fuse.rs
+++ b/tvix/store/src/fs/fuse.rs
@@ -11,6 +11,11 @@ where
     channel: fuse_backend_rs::transport::FuseChannel,
 }
 
+#[cfg(target_os = "macos")]
+const BADFD: libc::c_int = libc::EBADF;
+#[cfg(target_os = "linux")]
+const BADFD: libc::c_int = libc::EBADFD;
+
 impl<FS> FuseServer<FS>
 where
     FS: FileSystem + Sync + Send,
@@ -29,7 +34,7 @@ where
                     match e {
                         // This indicates the session has been shut down.
                         fuse_backend_rs::Error::EncodeMessage(e)
-                            if e.raw_os_error() == Some(libc::EBADFD) =>
+                            if e.raw_os_error() == Some(BADFD) =>
                         {
                             break;
                         }
@@ -63,6 +68,7 @@ impl FuseDaemon {
         let mut session = FuseSession::new(mountpoint.as_ref(), "tvix-store", "", true)
             .map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?;
 
+        #[cfg(target_os = "linux")]
         session.set_allow_other(false);
         session
             .mount()
diff --git a/tvix/store/src/fs/mod.rs b/tvix/store/src/fs/mod.rs
index 91adfa35f0e0..1333983460ea 100644
--- a/tvix/store/src/fs/mod.rs
+++ b/tvix/store/src/fs/mod.rs
@@ -13,6 +13,7 @@ mod tests;
 
 use crate::pathinfoservice::PathInfoService;
 
+use fuse_backend_rs::abi::fuse_abi::stat64;
 use fuse_backend_rs::api::filesystem::{Context, FileSystem, FsOptions, ROOT_ID};
 use futures::StreamExt;
 use nix_compat::store_path::StorePath;
@@ -253,7 +254,7 @@ impl FileSystem for TvixStoreFs {
         _ctx: &Context,
         inode: Self::Inode,
         _handle: Option<Self::Handle>,
-    ) -> io::Result<(libc::stat64, Duration)> {
+    ) -> io::Result<(stat64, Duration)> {
         if inode == ROOT_ID {
             return Ok((ROOT_FILE_ATTR.into(), Duration::MAX));
         }
@@ -441,7 +442,7 @@ impl FileSystem for TvixStoreFs {
                     let written = add_entry(fuse_backend_rs::api::filesystem::DirEntry {
                         ino,
                         offset: offset + i as u64 + 1,
-                        type_: ty,
+                        type_: ty as u32,
                         name: store_path.to_string().as_bytes(),
                     })?;
                     // If the buffer is full, add_entry will return `Ok(0)`.
@@ -490,9 +491,9 @@ impl FileSystem for TvixStoreFs {
                     ino: *ino,
                     offset: offset + i as u64 + 1,
                     type_: match child_node {
-                        Node::Directory(_) => libc::S_IFDIR,
-                        Node::File(_) => libc::S_IFREG,
-                        Node::Symlink(_) => libc::S_IFLNK,
+                        Node::Directory(_) => libc::S_IFDIR as u32,
+                        Node::File(_) => libc::S_IFREG as u32,
+                        Node::Symlink(_) => libc::S_IFLNK as u32,
                     },
                     name: child_node.get_name(),
                 })?;