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

ofs: support MacOS platform target #4409

Closed
oowl opened this issue Mar 28, 2024 · 3 comments · Fixed by #5136
Closed

ofs: support MacOS platform target #4409

oowl opened this issue Mar 28, 2024 · 3 comments · Fixed by #5136

Comments

@oowl
Copy link
Member

oowl commented Mar 28, 2024

Current states:

╰─$ 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 changed the title ofs: add MacOS support ofs: support MacOS platform target Mar 28, 2024
@oowl
Copy link
Member Author

oowl commented Mar 28, 2024

@oowl
Copy link
Member Author

oowl commented Mar 31, 2024

#4415

@oowl
Copy link
Member Author

oowl commented Apr 2, 2024

After difficult debugging on macOS environment ( macOS has the big gap in fuse feature compared to BSD and Linux.)

╭─ouyangjun@ouyangs-air ~/code/opendal/bin/ofs ‹feat/owl/ofs-macos●›
╰─$ uname -a                                                                                                                                                                                                                             1 ↵
Darwin ouyangs-air.lan 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:51:37 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T8112 arm64
╭─ouyangjun@ouyangs-air ~/code/opendal/bin/ofs ‹feat/owl/ofs-macos●›
╰─$ umount -f /Users/ouyangjun/code/opendal/bin/ofs/exampless
╭─ouyangjun@ouyangs-air ~/code/opendal/bin/ofs ‹feat/owl/ofs-macos●›
╰─$ ./target/debug/ofs ~/code/opendal/bin/ofs/exampless "fs://?root=/Users/ouyangjun/code/libuv/src"
╭─ouyangjun@ouyangs-air ~/code/opendal/bin/ofs ‹feat/owl/ofs-macos●›
╰─$ ls -al ~/code/opendal/bin/ofs/exampless/
total 0
ls: /Users/ouyangjun/code/opendal/bin/ofs/exampless/: Device not configured
╭─ouyangjun@ouyangs-air ~/code/opendal/bin/ofs ‹feat/owl/ofs-macos●›
╰─$ ls -al ~/code/opendal/bin/ofs/exampless/                                                                                                                                                                                             1 ↵
total 288
drwxrwxr-x   0 ouyangjun  staff      0 Apr  3 01:15 .
drwxr-xr-x  10 ouyangjun  staff    320 Apr  2 16:30 ..
-rwxrwxr-x   0 ouyangjun  staff      0 Apr  3 01:14 .aaa.swp
-rwxrwxr-x   0 ouyangjun  staff      0 Apr  3 01:14 aaa
-rwxrwxr-x   0 ouyangjun  staff   7607 May 30  2023 fs-poll.c
-rwxrwxr-x   0 ouyangjun  staff   7053 May 30  2023 heap-inl.h
-rwxrwxr-x   0 ouyangjun  staff   6393 May 30  2023 idna.c
-rwxrwxr-x   0 ouyangjun  staff   1455 May 30  2023 idna.h
-rwxrwxr-x   0 ouyangjun  staff   8068 May 30  2023 inet.c
-rwxrwxr-x   0 ouyangjun  staff   2671 May 30  2023 queue.h
-rwxrwxr-x   0 ouyangjun  staff   3423 May 30  2023 random.c
-rwxrwxr-x   0 ouyangjun  staff   1449 May 30  2023 strscpy.c
-rwxrwxr-x   0 ouyangjun  staff   1748 May 30  2023 strscpy.h
-rwxrwxr-x   0 ouyangjun  staff   1656 May 30  2023 strtok.c
-rwxrwxr-x   0 ouyangjun  staff   1271 May 30  2023 strtok.h
-rwxrwxr-x   0 ouyangjun  staff   3941 May 30  2023 thread-common.c
-rwxrwxr-x   0 ouyangjun  staff  11089 May 30  2023 threadpool.c
-rwxrwxr-x   0 ouyangjun  staff   4731 May 30  2023 timer.c
drwxrwxr-x   0 ouyangjun  staff   1760 May 30  2023 unix
-rwxrwxr-x   0 ouyangjun  staff  23323 May 30  2023 uv-common.c
-rwxrwxr-x   0 ouyangjun  staff  17118 May 30  2023 uv-common.h
-rwxrwxr-x   0 ouyangjun  staff   3126 May 30  2023 uv-data-getter-setters.c
-rwxrwxr-x   0 ouyangjun  staff   1751 May 30  2023 version.c
drwxrwxr-x   0 ouyangjun  staff   1120 May 30  2023 win
╭─ouyangjun@ouyangs-air ~/code/opendal/bin/ofs ‹feat/owl/ofs-macos●›
╰─$ ls -al ~/code/opendal/bin/ofs/exampless/
total 288
drwxrwxr-x   0 ouyangjun  staff      0 Apr  3 01:15 .
drwxr-xr-x  10 ouyangjun  staff    320 Apr  2 16:30 ..
-rwxrwxr-x   0 ouyangjun  staff      0 Apr  3 01:14 .aaa.swp
-rwxrwxr-x   0 ouyangjun  staff      0 Apr  3 01:14 aaa
-rwxrwxr-x   0 ouyangjun  staff   7607 May 30  2023 fs-poll.c
-rwxrwxr-x   0 ouyangjun  staff   7053 May 30  2023 heap-inl.h
-rwxrwxr-x   0 ouyangjun  staff   6393 May 30  2023 idna.c
-rwxrwxr-x   0 ouyangjun  staff   1455 May 30  2023 idna.h
-rwxrwxr-x   0 ouyangjun  staff   8068 May 30  2023 inet.c
-rwxrwxr-x   0 ouyangjun  staff   2671 May 30  2023 queue.h
-rwxrwxr-x   0 ouyangjun  staff   3423 May 30  2023 random.c
-rwxrwxr-x   0 ouyangjun  staff   1449 May 30  2023 strscpy.c
-rwxrwxr-x   0 ouyangjun  staff   1748 May 30  2023 strscpy.h
-rwxrwxr-x   0 ouyangjun  staff   1656 May 30  2023 strtok.c
-rwxrwxr-x   0 ouyangjun  staff   1271 May 30  2023 strtok.h
-rwxrwxr-x   0 ouyangjun  staff   3941 May 30  2023 thread-common.c
-rwxrwxr-x   0 ouyangjun  staff  11089 May 30  2023 threadpool.c
-rwxrwxr-x   0 ouyangjun  staff   4731 May 30  2023 timer.c
drwxrwxr-x   0 ouyangjun  staff   1760 May 30  2023 unix
-rwxrwxr-x   0 ouyangjun  staff  23323 May 30  2023 uv-common.c
-rwxrwxr-x   0 ouyangjun  staff  17118 May 30  2023 uv-common.h
-rwxrwxr-x   0 ouyangjun  staff   3126 May 30  2023 uv-data-getter-setters.c
-rwxrwxr-x   0 ouyangjun  staff   1751 May 30  2023 version.c
drwxrwxr-x   0 ouyangjun  staff   1120 May 30  2023 win
╭─ouyangjun@ouyangs-air ~/code/opendal/bin/ofs ‹feat/owl/ofs-macos●›
╰─$ cat ~/code/opendal/bin/ofs/exampless/
cat: /Users/ouyangjun/code/opendal/bin/ofs/exampless/: Is a directory
╭─ouyangjun@ouyangs-air ~/code/opendal/bin/ofs ‹feat/owl/ofs-macos●›
╰─$ cat ~/code/opendal/bin/ofs/exampless/idna.h                                                                                                                                                                                          1 ↵
/* Copyright (c) 2011, 2018 Ben Noordhuis <[email protected]>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef UV_SRC_IDNA_H_
#define UV_SRC_IDNA_H_

/* Decode a single codepoint. Returns the codepoint or UINT32_MAX on error.
 * |p| is updated on success _and_ error, i.e., bad multi-byte sequences are
 * skipped in their entirety, not just the first bad byte.
 */
unsigned uv__utf8_decode1(const char** p, const char* pe);

/* Convert a UTF-8 domain name to IDNA 2008 / Punycode. A return value >= 0
 * is the number of bytes written to |d|, including the trailing nul byte.
 * A return value < 0 is a libuv error code. |s| and |d| can not overlap.
 */
long uv__idna_toascii(const char* s, const char* se, char* d, char* de);

#endif  /* UV_SRC_IDNA_H_ */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant