Skip to content

Commit

Permalink
Update vendored fuser to sync with upstream fuser (awslabs#538)
Browse files Browse the repository at this point in the history
* Update vendored fuser to 174a807

Signed-off-by: Ankit Saurabh <[email protected]>

* Updated the version of fuser

Signed-off-by: Ankit Saurabh <[email protected]>

* Corrected the updated mountpoint-s3-client and mountpoint-s3-crt versions

Signed-off-by: Ankit Saurabh <[email protected]>

* Reverting abi change

Signed-off-by: Ankit Saurabh <[email protected]>

---------

Signed-off-by: Ankit Saurabh <[email protected]>
  • Loading branch information
Ankit Saurabh authored Sep 27, 2023
1 parent 9d141b1 commit 502ea10
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 164 deletions.
17 changes: 3 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mountpoint-s3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "Apache-2.0"
publish = false

[dependencies]
fuser = { path = "../vendor/fuser", version = "0.12.0", features = ["abi-7-28"] }
fuser = { path = "../vendor/fuser", version = "0.13.0", features = ["abi-7-28"] }
mountpoint-s3-client = { path = "../mountpoint-s3-client", version = "0.4.0" }
mountpoint-s3-crt = { path = "../mountpoint-s3-crt", version = "0.3.0" }

Expand Down
2 changes: 1 addition & 1 deletion vendor/fuser/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

- name: Install cargo-deny
run: cargo install --force cargo-deny --locked
run: cargo install --force --version 0.12.2 cargo-deny --locked

- name: Run tests
run: INTERACTIVE="" make ${{ matrix.test_group }}
86 changes: 0 additions & 86 deletions vendor/fuser/.github/workflows/macos_ci.yml

This file was deleted.

4 changes: 4 additions & 0 deletions vendor/fuser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# FUSE for Rust - Changelog

## 0.13.0 - 2023-08-16
* Remove dependency on `users` crate
* Performance optimizations

## 0.12.0 - 2022-12-13
* Add method to `Session` to unmount non-`Send` `Filesystem`s

Expand Down
5 changes: 2 additions & 3 deletions vendor/fuser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "fuser"
edition = "2018"
version = "0.12.0"
version = "0.13.0"
authors = ["Christopher Berner <[email protected]>"]
description = "Filesystem in Userspace (FUSE) for Rust"
documentation = "https://docs.rs/fuser"
Expand All @@ -20,8 +20,7 @@ travis-ci = { repository = "cberner/fuser" }
libc = "0.2.51"
log = "0.4.6"
memchr = "2"
users = "0.11.0"
page_size = "0.4.2"
page_size = "0.5.0"
serde = { version = "1.0.102", features = ["std", "derive"], optional = true }
smallvec = "1.6.1"
zerocopy = "0.6"
Expand Down
6 changes: 3 additions & 3 deletions vendor/fuser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ To build FUSE-Rust or any program that depends on it, `pkg-config` needs to be i
[FUSE for Linux] is available in most Linux distributions and usually called `fuse` or `fuse3` (this crate is compatible with both). To install on a Debian based system:

```sh
sudo apt-get install fuse
sudo apt-get install fuse3 libfuse3-dev
```

Install on CentOS:
Expand All @@ -65,7 +65,7 @@ sudo apt-get install libfuse-dev pkg-config
sudo yum install fuse-devel pkgconfig
```

### macOS
### macOS (untested)

Installer packages can be downloaded from the [FUSE for macOS homepage][FUSE for macOS]. This is the *kernel* part that needs to be installed always.

Expand Down Expand Up @@ -118,7 +118,7 @@ Most features of libfuse up to 3.10.3 are implemented. Feel free to contribute.

## Compatibility

Developed and tested on Linux. Tested under [Linux][FUSE for Linux], [macOS][FUSE for macOS] (up to ABI 7.19) and [FreeBSD][FUSE for FreeBSD] using stable [Rust] (see CI for details).
Developed and tested on Linux. Tested under [Linux][FUSE for Linux] and [FreeBSD][FUSE for FreeBSD] using stable [Rust] (see CI for details).

## Contribution

Expand Down
4 changes: 2 additions & 2 deletions vendor/fuser/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() {
if pkg_config::Config::new()
.atleast_version("3.0.0")
.probe("fuse3")
.map_err(|e| eprintln!("{}", e))
.map_err(|e| eprintln!("{e}"))
.is_ok()
{
println!("cargo:rustc-cfg=feature=\"libfuse3\"");
Expand All @@ -37,7 +37,7 @@ fn main() {
pkg_config::Config::new()
.atleast_version("2.6.0")
.probe("fuse")
.map_err(|e| eprintln!("{}", e))
.map_err(|e| eprintln!("{e}"))
.unwrap();
println!("cargo:rustc-cfg=feature=\"libfuse2\"");
}
Expand Down
43 changes: 24 additions & 19 deletions vendor/fuser/examples/simple.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::needless_return)]
#![allow(clippy::unnecessary_cast)] // libc::S_* are u16 or u32 depending on the platform

use clap::{crate_version, Arg, Command};
use fuser::consts::FOPEN_DIRECT_IO;
Expand Down Expand Up @@ -334,7 +335,7 @@ impl SimpleFS {
let path = Path::new(&self.data_dir)
.join("contents")
.join(inode.to_string());
if let Ok(file) = File::open(&path) {
if let Ok(file) = File::open(path) {
Ok(bincode::deserialize_from(file).unwrap())
} else {
Err(libc::ENOENT)
Expand All @@ -349,7 +350,7 @@ impl SimpleFS {
.write(true)
.create(true)
.truncate(true)
.open(&path)
.open(path)
.unwrap();
bincode::serialize_into(file, &entries).unwrap();
}
Expand All @@ -358,7 +359,7 @@ impl SimpleFS {
let path = Path::new(&self.data_dir)
.join("inodes")
.join(inode.to_string());
if let Ok(file) = File::open(&path) {
if let Ok(file) = File::open(path) {
Ok(bincode::deserialize_from(file).unwrap())
} else {
Err(libc::ENOENT)
Expand All @@ -373,7 +374,7 @@ impl SimpleFS {
.write(true)
.create(true)
.truncate(true)
.open(&path)
.open(path)
.unwrap();
bincode::serialize_into(file, inode).unwrap();
}
Expand Down Expand Up @@ -415,7 +416,7 @@ impl SimpleFS {
}

let path = self.content_path(inode);
let file = OpenOptions::new().write(true).open(&path).unwrap();
let file = OpenOptions::new().write(true).open(path).unwrap();
file.set_len(new_length).unwrap();

attrs.size = new_length;
Expand Down Expand Up @@ -728,7 +729,7 @@ impl Filesystem for SimpleFS {
fn readlink(&self, _req: &Request, inode: u64, reply: ReplyData) {
debug!("readlink() called on {:?}", inode);
let path = self.content_path(inode);
if let Ok(mut file) = File::open(&path) {
if let Ok(mut file) = File::open(path) {
let file_size = file.metadata().unwrap().len();
let mut buffer = vec![0; file_size as usize];
file.read_exact(&mut buffer).unwrap();
Expand Down Expand Up @@ -1021,11 +1022,14 @@ impl Filesystem for SimpleFS {
&self,
req: &Request,
parent: u64,
name: &OsStr,
link: &Path,
link_name: &OsStr,
target: &Path,
reply: ReplyEntry,
) {
debug!("symlink() called with {:?} {:?} {:?}", parent, name, link);
debug!(
"symlink() called with {:?} {:?} {:?}",
parent, link_name, target
);
let mut parent_attrs = match self.get_inode(parent) {
Ok(attrs) => attrs,
Err(error_code) => {
Expand Down Expand Up @@ -1053,7 +1057,7 @@ impl Filesystem for SimpleFS {
let attrs = InodeAttributes {
inode,
open_file_handles: 0,
size: link.as_os_str().as_bytes().len() as u64,
size: target.as_os_str().as_bytes().len() as u64,
last_accessed: time_now(),
last_modified: time_now(),
last_metadata_changed: time_now(),
Expand All @@ -1065,7 +1069,8 @@ impl Filesystem for SimpleFS {
xattrs: Default::default(),
};

if let Err(error_code) = self.insert_link(req, parent, name, inode, FileKind::Symlink) {
if let Err(error_code) = self.insert_link(req, parent, link_name, inode, FileKind::Symlink)
{
reply.error(error_code);
return;
}
Expand All @@ -1076,9 +1081,9 @@ impl Filesystem for SimpleFS {
.write(true)
.create(true)
.truncate(true)
.open(&path)
.open(path)
.unwrap();
file.write_all(link.as_os_str().as_bytes()).unwrap();
file.write_all(target.as_os_str().as_bytes()).unwrap();

reply.entry(&Duration::new(0, 0), &attrs.into(), 0);
}
Expand Down Expand Up @@ -1389,7 +1394,7 @@ impl Filesystem for SimpleFS {
}

let path = self.content_path(inode);
if let Ok(file) = File::open(&path) {
if let Ok(file) = File::open(path) {
let file_size = file.metadata().unwrap().len();
// Could underflow if file length is less than local_start
let read_size = min(size, file_size.saturating_sub(offset as u64) as u32);
Expand Down Expand Up @@ -1422,7 +1427,7 @@ impl Filesystem for SimpleFS {
}

let path = self.content_path(inode);
if let Ok(mut file) = OpenOptions::new().write(true).open(&path) {
if let Ok(mut file) = OpenOptions::new().write(true).open(path) {
file.seek(SeekFrom::Start(offset as u64)).unwrap();
file.write_all(data).unwrap();

Expand Down Expand Up @@ -1790,7 +1795,7 @@ impl Filesystem for SimpleFS {
reply: ReplyEmpty,
) {
let path = self.content_path(inode);
if let Ok(file) = OpenOptions::new().write(true).open(&path) {
if let Ok(file) = OpenOptions::new().write(true).open(path) {
unsafe {
libc::fallocate64(file.into_raw_fd(), mode, offset, length);
}
Expand Down Expand Up @@ -1836,7 +1841,7 @@ impl Filesystem for SimpleFS {
}

let src_path = self.content_path(src_inode);
if let Ok(file) = File::open(&src_path) {
if let Ok(file) = File::open(src_path) {
let file_size = file.metadata().unwrap().len();
// Could underflow if file length is less than local_start
let read_size = min(size, file_size.saturating_sub(src_offset as u64));
Expand All @@ -1845,7 +1850,7 @@ impl Filesystem for SimpleFS {
file.read_exact_at(&mut data, src_offset as u64).unwrap();

let dest_path = self.content_path(dest_inode);
if let Ok(mut file) = OpenOptions::new().write(true).open(&dest_path) {
if let Ok(mut file) = OpenOptions::new().write(true).open(dest_path) {
file.seek(SeekFrom::Start(dest_offset as u64)).unwrap();
file.write_all(&data).unwrap();

Expand Down Expand Up @@ -1919,7 +1924,7 @@ fn as_file_kind(mut mode: u32) -> FileKind {
fn get_groups(pid: u32) -> Vec<u32> {
#[cfg(not(target_os = "macos"))]
{
let path = format!("/proc/{}/task/{}/status", pid, pid);
let path = format!("/proc/{pid}/task/{pid}/status");
let file = File::open(path).unwrap();
for line in BufReader::new(file).lines() {
let line = line.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion vendor/fuser/mount_tests.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install -y build-essential curl

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.57.0
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.67.0

ENV PATH=/root/.cargo/bin:$PATH

Expand Down
Loading

0 comments on commit 502ea10

Please sign in to comment.