cberner / fuser

Filesystem in Userspace (FUSE) for Rust
MIT License
835 stars 114 forks source link

Cannot be built on OpenBSD #262

Open tyatsumi opened 1 year ago

tyatsumi commented 1 year ago

I am trying to use fuser on OpenBSD, and found that fuser v0.13.0 cannot be built on the OS. There are two problems.

The first problem is some constants from libc crate are not defined for OpenBSD. They are:

They are not defined in C headers on OpenBSD, although defined in C++ headers.

The second problem is fuse_mount_compat25() is not defined on OpenBSD. On OpenBSD, fuse_mount() is defined.

By the way, libfuse on OpenBSD seems to be version 2.6.

realchonk commented 6 months ago

Even if I define fuse_mount_compat25() as:

extern "C" {
    fn fuse_mount(mp: *const u8, args: *mut c_void) -> *mut c_void;
    fn fuse_chan_fd(f: *mut c_void) -> i32;
}

#[no_mangle]
unsafe extern "C" fn fuse_mount_compat25(mp: *const u8, args: *mut c_void) -> i32 {
    let fuse = fuse_mount(mp, args);
    if fuse.is_null() {
        panic!("fuse is NULL");
    }

    let fd = fuse_chan_fd(fuse);
    if fd < 0 {
        panic!("fd = {fd}");
    }
    fd
}

I get EINVAL.