Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ofs): add freebsd OS support #4403

Merged
merged 4 commits into from
Mar 28, 2024
Merged

feat(ofs): add freebsd OS support #4403

merged 4 commits into from
Mar 28, 2024

Conversation

oowl
Copy link
Member

@oowl oowl commented Mar 27, 2024

  1. FreeBSD 13
root@freebsd:~/opendal/bin/ofs # echo "Hello OpenDAL ofs From Freebsd 13" > exampless/data.txt
root@freebsd:~/opendal/bin/ofs # cat exampless/data.txt 
Hello OpenDAL ofs From Freebsd 13
root@freebsd:~/opendal/bin/ofs # uname -a
FreeBSD freebsd 13.3-RELEASE FreeBSD 13.3-RELEASE releng/13.3-n257428-80d2b634ddf0 GENERIC amd64
[root@freebsd ~/opendal/bin/ofs]#  RUST_LOG=info ./target/debug/ofs ./exampless "fs://?root=/tmp" 
[2024-03-27T17:20:46Z INFO  fuse3::raw::session] handle_init; request=Request { unique: 1, uid: 0, gid: 0, pid: 2126 } fuse_connection=FuseConnection { unmount_notify: Notify { count: false, event: Event { listeners_notified: 18446744073709551615, listeners_total: 0 } }, mode: NonBlock(NonBlockFuseConnection { fd: AsyncFd { inner: Some(OwnedFd { fd: 9 }) }, read: Mutex { is_locked: false, has_waiters: false }, write: Mutex { is_locked: false, has_waiters: false } }) }
[2024-03-27T17:20:54Z INFO  fuse3::raw::session] handle_access; request=Request { unique: 2, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 48, opcode: 34, unique: 2, nodeid: 1, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:54Z INFO  fuse3::raw::session] handle_lookup; request=Request { unique: 3, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 49, opcode: 1, unique: 3, nodeid: 1, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:54Z INFO  fuse3::raw::session] handle_access; request=Request { unique: 4, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 48, opcode: 34, unique: 4, nodeid: 2, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:54Z INFO  fuse3::raw::session] handle_open; request=Request { unique: 5, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 48, opcode: 14, unique: 5, nodeid: 2, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:54Z INFO  fuse3::raw::session] handle_setattr; request=Request { unique: 6, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 128, opcode: 4, unique: 6, nodeid: 2, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:54Z INFO  fuse3::raw::session] handle_write; request=Request { unique: 7, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 114, opcode: 16, unique: 7, nodeid: 2, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:54Z INFO  fuse3::raw::session] handle_flush; request=Request { unique: 8, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 64, opcode: 25, unique: 8, nodeid: 2, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:54Z INFO  fuse3::raw::session] handle_release; request=Request { unique: 9, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 64, opcode: 18, unique: 9, nodeid: 2, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:56Z INFO  fuse3::raw::session] handle_getattr; request=Request { unique: 10, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 56, opcode: 3, unique: 10, nodeid: 1, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:58Z INFO  fuse3::raw::session] handle_access; request=Request { unique: 11, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 48, opcode: 34, unique: 11, nodeid: 1, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:58Z INFO  fuse3::raw::session] handle_opendir; request=Request { unique: 12, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 48, opcode: 27, unique: 12, nodeid: 1, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:58Z INFO  fuse3::raw::session] handle_readdir; request=Request { unique: 13, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 80, opcode: 28, unique: 13, nodeid: 1, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:58Z INFO  fuse3::raw::session] handle_readdir; request=Request { unique: 14, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 80, opcode: 28, unique: 14, nodeid: 1, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:58Z INFO  fuse3::raw::session] handle_access; request=Request { unique: 15, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 48, opcode: 34, unique: 15, nodeid: 1, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:58Z INFO  fuse3::raw::session] handle_lookup; request=Request { unique: 16, uid: 0, gid: 0, pid: 1624 } in_header=fuse_in_header { len: 49, opcode: 1, unique: 16, nodeid: 1, uid: 0, gid: 0, pid: 1624, padding: 0 }
[2024-03-27T17:20:59Z INFO  fuse3::raw::session] handle_access; request=Request { unique: 17, uid: 0, gid: 0, pid: 2127 } in_header=fuse_in_header { len: 48, opcode: 34, unique: 17, nodeid: 1, uid: 0, gid: 0, pid: 2127, padding: 0 }
[2024-03-27T17:20:59Z INFO  fuse3::raw::session] handle_access; request=Request { unique: 18, uid: 0, gid: 0, pid: 2127 } in_header=fuse_in_header { len: 48, opcode: 34, unique: 18, nodeid: 2, uid: 0, gid: 0, pid: 2127, padding: 0 }
[2024-03-27T17:20:59Z INFO  fuse3::raw::session] handle_open; request=Request { unique: 19, uid: 0, gid: 0, pid: 2127 } in_header=fuse_in_header { len: 48, opcode: 14, unique: 19, nodeid: 2, uid: 0, gid: 0, pid: 2127, padding: 0 }
[2024-03-27T17:20:59Z INFO  fuse3::raw::session] handle_read; request=Request { unique: 20, uid: 0, gid: 0, pid: 2127 } in_header=fuse_in_header { len: 80, opcode: 15, unique: 20, nodeid: 2, uid: 0, gid: 0, pid: 2127, padding: 0 }
[2024-03-27T17:20:59Z INFO  fuse3::raw::session] handle_setattr; request=Request { unique: 21, uid: 0, gid: 0, pid: 2127 } in_header=fuse_in_header { len: 128, opcode: 4, unique: 21, nodeid: 2, uid: 0, gid: 0, pid: 2127, padding: 0 }
[2024-03-27T17:20:59Z INFO  fuse3::raw::session] handle_release; request=Request { unique: 22, uid: 0, gid: 0, pid: 2127 } in_header=fuse_in_header { len: 64, opcode: 18, unique: 22, nodeid: 2, uid: 0, gid: 0, pid: 2127, padding: 0 }

@oowl
Copy link
Member Author

oowl commented Mar 27, 2024

MacOS build failed, I will try to push MacOS support to upstream.

╰─$ cargo build
    Updating crates.io index
  Downloaded cstr v0.2.11
  Downloaded http-body v1.0.0
  Downloaded trait-make v0.1.0
  Downloaded trim-in-place v0.1.7
  Downloaded tower-layer v0.3.2
  Downloaded cfg_aliases v0.1.1
  Downloaded async-notify v0.3.0
  Downloaded memoffset v0.9.0
  Downloaded parking v2.2.0
  Downloaded http-body-util v0.1.1
  Downloaded which v6.0.1
  Downloaded zeroize v1.7.0
  Downloaded rust-ini v0.21.0
  Downloaded bincode v1.3.3
  Downloaded async-trait v0.1.79
  Downloaded rustls-pki-types v1.4.0
  Downloaded concurrent-queue v2.4.0
  Downloaded errno v0.3.8
  Downloaded either v1.9.0
  Downloaded bitflags v2.4.2
  Downloaded tokio-rustls v0.25.0
  Downloaded event-listener v4.0.3
  Downloaded crossbeam-utils v0.8.19
  Downloaded smallvec v1.13.2
  Downloaded hyper-rustls v0.26.0
  Downloaded fuse3 v0.7.1
  Downloaded hyper-util v0.1.3
  Downloaded reqsign v0.15.0
  Downloaded http v1.1.0
  Downloaded base64 v0.22.0
  Downloaded tower v0.4.13
  Downloaded hyper v1.2.0
  Downloaded reqwest v0.12.2
  Downloaded rustls-webpki v0.102.2
  Downloaded webpki-roots v0.26.1
  Downloaded rustls v0.22.3
  Downloaded rustix v0.38.31
  Downloaded nix v0.28.0
  Downloaded nix v0.27.1
  Downloaded chrono v0.4.35
  Downloaded 40 crates (3.2 MB) in 1.97s
   Compiling libc v0.2.153
   Compiling syn v2.0.48
   Compiling rustls-pki-types v1.4.0
   Compiling http v1.1.0
   Compiling rustls v0.22.3
   Compiling zeroize v1.7.0
   Compiling smallvec v1.13.2
   Compiling tower-layer v0.3.2
   Compiling crossbeam-utils v0.8.19
   Compiling bitflags v2.4.2
   Compiling memoffset v0.9.0
   Compiling rustix v0.38.31
   Compiling cfg_aliases v0.1.1
   Compiling async-trait v0.1.79
   Compiling http-body v1.0.0
   Compiling hashbrown v0.14.3
   Compiling http-body-util v0.1.1
   Compiling ordered-multimap v0.7.1
   Compiling nix v0.28.0
   Compiling webpki-roots v0.26.1
   Compiling parking v2.2.0
   Compiling trim-in-place v0.1.7
   Compiling rust-ini v0.21.0
   Compiling chrono v0.4.35
   Compiling concurrent-queue v2.4.0
   Compiling base64 v0.22.0
   Compiling event-listener v4.0.3
   Compiling tokio-macros v2.2.0
   Compiling futures-macro v0.3.30
   Compiling serde_derive v1.0.196
   Compiling tracing-attributes v0.1.27
   Compiling pin-project-internal v1.1.4
   Compiling signal-hook-registry v1.4.1
   Compiling getrandom v0.2.12
   Compiling num_cpus v1.16.0
   Compiling socket2 v0.5.5
   Compiling mio v0.8.10
   Compiling futures-util v0.3.30
   Compiling ring v0.17.7
   Compiling tokio v1.36.0
   Compiling rand_core v0.6.4
   Compiling cpufeatures v0.2.12
   Compiling pin-project v1.1.4
   Compiling rand_chacha v0.3.1
   Compiling errno v0.3.8
   Compiling rand v0.8.5
   Compiling tracing v0.1.40
   Compiling rustls-webpki v0.102.2
   Compiling serde v1.0.196
   Compiling sha1 v0.10.6
   Compiling sha2 v0.10.8
   Compiling either v1.9.0
   Compiling clap_derive v4.5.0
   Compiling futures v0.3.30
   Compiling which v6.0.1
   Compiling trait-make v0.1.0
   Compiling async-notify v0.3.0
   Compiling cstr v0.2.11
   Compiling nix v0.27.1
   Compiling clap v4.5.1
   Compiling hyper v1.2.0
   Compiling tower v0.4.13
   Compiling tokio-rustls v0.25.0
   Compiling tokio-util v0.7.10
   Compiling backon v0.4.3
   Compiling serde_urlencoded v0.7.1
   Compiling quick-xml v0.31.0
   Compiling hyper-util v0.1.3
   Compiling serde_json v1.0.113
   Compiling uuid v1.7.0
   Compiling bincode v1.3.3
   Compiling fuse3 v0.7.1
   Compiling hyper-rustls v0.26.0
   Compiling reqwest v0.12.2
   Compiling reqsign v0.15.0
error[E0432]: unresolved import `helper::mode_from_kind_and_perm`
  --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/lib.rs:30:18
   |
30 | pub use helper::{mode_from_kind_and_perm, perm_from_mode_and_kind};
   |                  ^^^^^^^^^^^^^^^^^^^^^^^
   |                  |
   |                  no `mode_from_kind_and_perm` in `helper`
   |                  help: a similar name exists in the module: `perm_from_mode_and_kind`
   |
note: found an item that was configured out
  --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/helper.rs:30:14
   |
30 | pub const fn mode_from_kind_and_perm(kind: FileType, perm: u16) -> u32 {
   |              ^^^^^^^^^^^^^^^^^^^^^^^
   = note: the item is gated behind the `linux` feature
note: found an item that was configured out
  --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/helper.rs:39:14
   |
39 | pub const fn mode_from_kind_and_perm(kind: FileType, perm: u16) -> u32 {
   |              ^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `crate::helper::mode_from_kind_and_perm`
  --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/reply.rs:9:5
   |
9  | use crate::helper::mode_from_kind_and_perm;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `mode_from_kind_and_perm` in `helper`
   |
note: found an item that was configured out
  --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/helper.rs:30:14
   |
30 | pub const fn mode_from_kind_and_perm(kind: FileType, perm: u16) -> u32 {
   |              ^^^^^^^^^^^^^^^^^^^^^^^
   = note: the item is gated behind the `linux` feature
note: found an item that was configured out
  --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/helper.rs:39:14
   |
39 | pub const fn mode_from_kind_and_perm(kind: FileType, perm: u16) -> u32 {
   |              ^^^^^^^^^^^^^^^^^^^^^^^
help: a similar name exists in the module
   |
9  | use crate::helper::perm_from_mode_and_kind;
   |                    ~~~~~~~~~~~~~~~~~~~~~~~
help: consider importing this unresolved item through its public re-export instead
   |
9  | use crate::mode_from_kind_and_perm;
   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0599]: no method named `mount_with_unprivileged` found for struct `raw::session::Session` in the current scope
   --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/path/session.rs:38:14
    |
37  | /         raw::Session::new(self.mount_options)
38  | |             .mount_with_unprivileged(bridge, mount_path)
    | |             -^^^^^^^^^^^^^^^^^^^^^^^ method not found in `Session<_>`
    | |_____________|
    |
    |
   ::: /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/session.rs:216:1
    |
216 |   pub struct Session<FS> {
    |   ---------------------- method `mount_with_unprivileged` not found for this struct

error[E0599]: no method named `mount` found for struct `raw::session::Session` in the current scope
   --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/path/session.rs:52:14
    |
51  | /         raw::Session::new(self.mount_options)
52  | |             .mount(bridge, mount_path)
    | |             -^^^^^ method not found in `Session<_>`
    | |_____________|
    |
    |
   ::: /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/session.rs:216:1
    |
216 |   pub struct Session<FS> {
    |   ---------------------- method `mount` not found for this struct

error[E0004]: non-exhaustive patterns: type `&ConnectionMode` is non-empty
   --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/connection/tokio.rs:127:15
    |
127 |         match &self.mode {
    |               ^^^^^^^^^^
    |
note: `ConnectionMode` defined here
   --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/connection/tokio.rs:164:6
    |
164 | enum ConnectionMode {
    |      ^^^^^^^^^^^^^^
    = note: the matched value is of type `&ConnectionMode`
    = note: references are always considered inhabited
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
    |
127 ~         match &self.mode {
128 +             _ => todo!(),
129 +         }
    |

error[E0004]: non-exhaustive patterns: type `&ConnectionMode` is non-empty
   --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/connection/tokio.rs:147:15
    |
147 |         match &self.mode {
    |               ^^^^^^^^^^
    |
note: `ConnectionMode` defined here
   --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/connection/tokio.rs:164:6
    |
164 | enum ConnectionMode {
    |      ^^^^^^^^^^^^^^
    = note: the matched value is of type `&ConnectionMode`
    = note: references are always considered inhabited
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown
    |
147 ~         match &self.mode {
148 +             _ => todo!(),
149 +         }
    |

   Compiling opendal v0.45.1 (/Users/ouyangjun/code/opendal/core)
error[E0425]: cannot find function `mode_from_kind_and_perm` in this scope
    --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/session.rs:2995:29
     |
2995 |                     r#type: mode_from_kind_and_perm(entry.kind, 0) >> 12,
     |                             ^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `perm_from_mode_and_kind`
     |
    ::: /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/helper.rs:45:1
     |
45   | pub const fn perm_from_mode_and_kind(kind: FileType, mode: mode_t) -> u16 {
     | ------------------------------------------------------------------------- similarly named function `perm_from_mode_and_kind` defined here

error[E0425]: cannot find function `mode_from_kind_and_perm` in this scope
    --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/session.rs:3912:33
     |
3912 |                         r#type: mode_from_kind_and_perm(entry.kind, 0) >> 12,
     |                                 ^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `perm_from_mode_and_kind`
     |
    ::: /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/helper.rs:45:1
     |
45   | pub const fn perm_from_mode_and_kind(kind: FileType, mode: mode_t) -> u16 {
     | ------------------------------------------------------------------------- similarly named function `perm_from_mode_and_kind` defined here

error[E0063]: missing fields `crtime` and `flags` in initializer of `raw::reply::FileAttr`
  --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/path/reply.rs:52:9
   |
52 |         crate::raw::reply::FileAttr {
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `crtime` and `flags`

error[E0308]: mismatched types
  --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/connection/tokio.rs:71:48
   |
71 |     pub fn new(unmount_notify: Arc<Notify>) -> io::Result<Self> {
   |            ---                                 ^^^^^^^^^^^^^^^^ expected `Result<FuseConnection, Error>`, found `()`
   |            |
   |            implicitly returns `()` as its body has no tail or `return` expression
   |
   = note:   expected enum `std::result::Result<FuseConnection, std::io::Error>`
           found unit type `()`

error[E0063]: missing fields `crtime`, `crtimensec` and `flags` in initializer of `fuse_attr`
  --> /Users/ouyangjun/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fuse3-0.7.1/src/raw/reply.rs:56:9
   |
56 |         fuse_attr {
   |         ^^^^^^^^^ missing `crtime`, `crtimensec` and `flags`

Some errors have detailed explanations: E0004, E0063, E0308, E0425, E0432, E0599.
For more information about an error, try `rustc --explain E0004`.
error: could not compile `fuse3` (lib) due to 11 previous errors

@oowl oowl marked this pull request as draft March 27, 2024 17:25
@oowl oowl marked this pull request as ready for review March 27, 2024 17:29
@oowl oowl changed the title feat(ofs): support freebsd feat(ofs): freebsd support Mar 27, 2024
@oowl oowl changed the title feat(ofs): freebsd support feat(ofs): add freebsd OS support Mar 27, 2024
@oowl
Copy link
Member Author

oowl commented Mar 28, 2024

@Xuanwo Let’s merge it first? We need to wait some times to PR nix and fuse3 repo support Apple target.

@Xuanwo
Copy link
Member

Xuanwo commented Mar 28, 2024

@Xuanwo Let’s merge it first? We need to wait some times to PR nix and fuse3 repo support Apple target.

I'm fine to merge this PR since it doesn't break existing CI. Would you like to create an issue first?

@oowl
Copy link
Member Author

oowl commented Mar 28, 2024

@Xuanwo Let’s merge it first? We need to wait some times to PR nix and fuse3 repo support Apple target.

I'm fine to merge this PR since it doesn't break existing CI. Would you like to create an issue first?

#4409

@Xuanwo Xuanwo merged commit d65ac9c into main Mar 28, 2024
14 checks passed
@Xuanwo Xuanwo deleted the owl/ofs-freebsd branch March 28, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants