Skip to content

Commit

Permalink
Update vendored fuser to 9c11ad3
Browse files Browse the repository at this point in the history
Signed-off-by: James Bornholt <[email protected]>
  • Loading branch information
jamesbornholt committed Mar 13, 2023
1 parent 869811c commit cdc757a
Show file tree
Hide file tree
Showing 19 changed files with 274 additions and 334 deletions.
6 changes: 5 additions & 1 deletion vendor/fuser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# FUSE for Rust - Changelog

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

## 0.11.1 - 2022-08-24
* Improve an error message when using libfuse2

## 0.11.0 - 2022-03-05
* Add `spawn_mount2()`
Expand Down
10 changes: 2 additions & 8 deletions vendor/fuser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "fuser"
edition = "2021"
version = "0.11.0"
edition = "2018"
version = "0.12.0"
authors = ["Christopher Berner <[email protected]>"]
description = "Filesystem in Userspace (FUSE) for Rust"
documentation = "https://docs.rs/fuser"
Expand All @@ -17,13 +17,10 @@ license = "MIT"
travis-ci = { repository = "cberner/fuser" }

[dependencies]
async-trait = "0.1.56"
crossbeam = "*"
libc = "0.2.51"
log = "0.4.6"
memchr = "2"
users = "0.11.0"
futures = "0.3.23"
page_size = "0.4.2"
serde = { version = "1.0.102", features = ["std", "derive"], optional = true }
smallvec = "1.6.1"
Expand Down Expand Up @@ -66,6 +63,3 @@ abi-7-28 = ["abi-7-27"]
abi-7-29 = ["abi-7-28"]
abi-7-30 = ["abi-7-29"]
abi-7-31 = ["abi-7-30"]

[lib]
bench = false
4 changes: 4 additions & 0 deletions vendor/fuser/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
This is a fork of the excellent [`fuser`](https://github.com/cberner/fuser) Rust crate for FUSE bindings, with some Mountpoint-specific changes to improve performance of concurrent operations. We'll be working to upstream these changes soon.

---

# FUSE (Filesystem in Userspace) for Rust

![CI](https://github.com/cberner/fuser/actions/workflows/ci.yml/badge.svg)
Expand Down
1 change: 1 addition & 0 deletions vendor/fuser/deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ allow = [
"BSD-2-Clause",
"BSD-3-Clause",
"MIT",
"Unicode-DFS-2016",
]
# List of explictly disallowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
Expand Down
19 changes: 12 additions & 7 deletions vendor/fuser/examples/hello.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use async_trait::async_trait;
use clap::{crate_version, Arg, Command};
use fuser::{
FileAttr, FileType, Filesystem, MountOption, ReplyAttr, ReplyData, ReplyDirectory, ReplyEntry,
Expand Down Expand Up @@ -50,27 +49,26 @@ const HELLO_TXT_ATTR: FileAttr = FileAttr {

struct HelloFS;

#[async_trait]
impl Filesystem for HelloFS {
async fn lookup(&self, _req: &Request<'_>, parent: u64, name: &OsStr, reply: ReplyEntry) {
fn lookup(&self, _req: &Request, parent: u64, name: &OsStr, reply: ReplyEntry) {
if parent == 1 && name.to_str() == Some("hello.txt") {
reply.entry(&TTL, &HELLO_TXT_ATTR, 0);
} else {
reply.error(ENOENT);
}
}

async fn getattr(&self, _req: &Request<'_>, ino: u64, reply: ReplyAttr) {
fn getattr(&self, _req: &Request, ino: u64, reply: ReplyAttr) {
match ino {
1 => reply.attr(&TTL, &HELLO_DIR_ATTR),
2 => reply.attr(&TTL, &HELLO_TXT_ATTR),
_ => reply.error(ENOENT),
}
}

async fn read(
fn read(
&self,
_req: &Request<'_>,
_req: &Request,
ino: u64,
_fh: u64,
offset: i64,
Expand All @@ -86,7 +84,14 @@ impl Filesystem for HelloFS {
}
}

async fn readdir(&self, _req: &Request<'_>, ino: u64, _fh: u64, offset: i64, mut reply: ReplyDirectory) {
fn readdir(
&self,
_req: &Request,
ino: u64,
_fh: u64,
offset: i64,
mut reply: ReplyDirectory,
) {
if ino != 1 {
reply.error(ENOENT);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,14 @@ impl Filesystem for SimpleFS {
reply.ok();
}

fn symlink(&self, req: &Request, parent: u64, name: &OsStr, link: &Path, reply: ReplyEntry) {
fn symlink(
&self,
req: &Request,
parent: u64,
name: &OsStr,
link: &Path,
reply: ReplyEntry,
) {
debug!("symlink() called with {:?} {:?} {:?}", parent, name, link);
let mut parent_attrs = match self.get_inode(parent) {
Ok(attrs) => attrs,
Expand Down Expand Up @@ -1076,7 +1083,6 @@ impl Filesystem for SimpleFS {
reply.entry(&Duration::new(0, 0), &attrs.into(), 0);
}

#[allow(unused_variables)]
fn rename(
&self,
req: &Request,
Expand Down Expand Up @@ -1536,7 +1542,14 @@ impl Filesystem for SimpleFS {
reply.ok();
}

fn releasedir(&self, _req: &Request<'_>, inode: u64, _fh: u64, _flags: i32, reply: ReplyEmpty) {
fn releasedir(
&self,
_req: &Request<'_>,
inode: u64,
_fh: u64,
_flags: i32,
reply: ReplyEmpty,
) {
if let Ok(mut attrs) = self.get_inode(inode) {
attrs.open_file_handles -= 1;
}
Expand Down Expand Up @@ -1903,7 +1916,6 @@ fn as_file_kind(mut mode: u32) -> FileKind {
}
}

#[allow(unused_variables)]
fn get_groups(pid: u32) -> Vec<u32> {
#[cfg(not(target_os = "macos"))]
{
Expand Down
4 changes: 3 additions & 1 deletion vendor/fuser/osx_mount_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ function run_test {
}

run_test --features=libfuse 'with libfuse'
run_test --features=libfuse 'with libfuse' --auto_unmount

# TODO: re-enable this test. It seems to hang on OSX
#run_test --features=libfuse 'with libfuse' --auto_unmount

export TEST_EXIT_STATUS=0
Empty file removed vendor/fuser/src/async_runtime.rs
Empty file.
3 changes: 1 addition & 2 deletions vendor/fuser/src/channel.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::mem::MaybeUninit;
use std::{fs::File, io, os::unix::prelude::AsRawFd, sync::Arc};

use libc::{c_int, c_void, size_t};
Expand All @@ -18,7 +17,7 @@ impl Channel {
}

/// Receives data up to the capacity of the given buffer (can block).
pub fn receive(&self, buffer: &mut [MaybeUninit<u8>]) -> io::Result<usize> {
pub fn receive(&self, buffer: &mut [u8]) -> io::Result<usize> {
let rc = unsafe {
libc::read(
self.0.as_raw_fd(),
Expand Down
Loading

0 comments on commit cdc757a

Please sign in to comment.