Skip to content

Commit

Permalink
Fuser 0.9.1 (#49), in anticipation of ffs 0.1.2
Browse files Browse the repository at this point in the history
Update to fuser=0.9 (i.e., 0.9.1). Update websites, version numbers, etc. for new release.

Finally use `destroy` properly, got rid of the `Drop` impl for `FS`. Drop `AutoUnmount` which wasn't doing anything anyway.

Fixes and improvements to CI, docs, and logging.
  • Loading branch information
mgree authored Sep 26, 2021
1 parent da6811a commit 35f6bf8
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 33 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# ffs - Changelog

## 0.?.? - UNRELEASED
## 0.1.2 - 2021-09-26

* Handle failed mounts better, with an appropriate message and error
code.
* Revise exit codes: 0 means success, 1 means FS error, 2 means CLI
error.
* `--time` flag for emitting timing information on STDERR.
* Basic startup/shutdown benchmarking, with microbenchmarks.
* Upgrade to fuser 0.9.1. Concomitant bugfixes turn off AutoUnmount.
* Improvements/bugfixes in regression tests.

## 0.1.1 - 2021-07-15

Expand Down
14 changes: 7 additions & 7 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ffs"
version = "0.1.1"
version = "0.1.2"
authors = ["Michael Greenberg <[email protected]>"]
license = "GPL-3.0"
description = "ffs---the File FileSystem---lets you mount semi-structured data (like JSON) as a filesystem, letting you work with modern formats using your familiar shell tools."
Expand All @@ -27,7 +27,7 @@ exclude = [
[dependencies]
base64 = "0.13.0"
clap = "2.0"
fuser = "0.8"
fuser = "0.9"
libc = "0.2.51"
serde_json = "1.0"
toml = "0.5"
Expand Down
5 changes: 3 additions & 2 deletions docs/ffs.1.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% FFS(1) Version 0.1.1 | File Filesystem Documentation
% FFS(1) Version 0.1.2 | File Filesystem Documentation
% Michael Greenberg

# NAME
Expand Down Expand Up @@ -240,7 +240,8 @@ RUST_LOG
should probably be *ffs* and *level* should be one of *error*,
*warn*, *info*, *debug*, or *trace*. The default is
*ffs=warn*. Setting *-q* turns off all output; setting *-d* sets
*ffs=debug*.
*ffs=debug*. To get more information from FUSE bindings, add *fuser*, e.g.,
*ffs=debug,fuser=info*.

# EXIT STATUS

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ download a single executable. These are the [latest development builds](https://
- [macOS]({{ site.github.macos_url }})

See the [release page](https://github.com/mgree/ffs/releases) for
particular releases; the current version is 0.1.1. You can also build
particular releases; the current version is 0.1.2. You can also build
ffs from [source](https://github.com/mgree/ffs).

# Related tools
Expand Down
4 changes: 3 additions & 1 deletion man/ffs.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 2.9.1.1
.\"
.TH "FFS" "1" "" "Version 0.1.1" "File Filesystem Documentation"
.TH "FFS" "1" "" "Version 0.1.2" "File Filesystem Documentation"
.hy
.SH NAME
.PP
Expand Down Expand Up @@ -237,6 +237,8 @@ probably be \f[I]ffs\f[R] and \f[I]level\f[R] should be one of
The default is \f[I]ffs=warn\f[R].
Setting \f[I]-q\f[R] turns off all output; setting \f[I]-d\f[R] sets
\f[I]ffs=debug\f[R].
To get more information from FUSE bindings, add \f[I]fuser\f[R], e.g.,
\f[I]ffs=debug,fuser=info\f[R].
.SH EXIT STATUS
.TP
0
Expand Down
9 changes: 7 additions & 2 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ for test in *.sh
do
tname="$(basename ${test%*.sh})"
printf "========== STARTING TEST: $tname\n"
(RUST_LOG="ffs=debug"; export RUST_LOG; ./${test} >$LOG/$tname.out 2>$LOG/$tname.nerr; echo $?>$LOG/$tname.ec) &
(RUST_LOG="ffs=debug,fuser=debug"; export RUST_LOG; ./${test} >$LOG/$tname.out 2>$LOG/$tname.err; echo $?>$LOG/$tname.ec) &
: $((TOTAL += 1))

# don't slam 'em
Expand All @@ -43,12 +43,17 @@ do
printf "========== PASSED: $tname\n"
else
printf "========== FAILED: $tname (ec=$(cat $LOG/$tname.ec))\n"
: $((FAILED += 1))
fi

# just always capture output in the CI logs
if [ "$(cat $LOG/$tname.ec)" -ne 0 ] || [ "$CI" ]
then
printf "<<<<<<<<<< STDOUT\n"
cat $LOG/$tname.out
printf "<<<<<<<<<< STDERR\n"
cat $LOG/$tname.err
printf "\n"
: $((FAILED += 1))
fi
done

Expand Down
21 changes: 5 additions & 16 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl FS {
///
/// - if `self.config.output == Output::Stdout` and `last_sync == false`,
/// nothing will happen (to prevent redundant writes to STDOUT)
#[instrument(level = "debug", skip(self), fields(synced = self.dirty.get(), dirty = self.dirty.get()))]
#[instrument(level = "debug", skip(self), fields(synced = self.synced.get(), dirty = self.dirty.get()))]
pub fn sync(&self, last_sync: bool) {
info!("called");
trace!("{:?}", self.inodes);
Expand Down Expand Up @@ -347,29 +347,18 @@ impl FromStr for DirType {
}
}

impl Drop for FS {
/// Synchronizes the `FS`, calling `FS::sync` with `last_sync == true`.
#[instrument(level = "debug", skip(self), fields(dirty = self.dirty.get()))]
fn drop(&mut self) {
self.sync(true); // last sync
}
}

// ENOATTR is deprecated on Linux, so we should use ENODATA
#[cfg(target_os = "linux")]
const ENOATTR: i32 = libc::ENODATA;
#[cfg(target_os = "macos")]
const ENOATTR: i32 = libc::ENOATTR;

impl Filesystem for FS {
#[instrument(level = "debug", skip(self, _req), fields(dirty = self.dirty.get()))]
fn destroy(&mut self, _req: &Request) {
/// Synchronizes the `FS`, calling `FS::sync` with `last_sync == true`.
#[instrument(level = "debug", skip(self), fields(dirty = self.dirty.get()))]
fn destroy(&mut self) {
info!("called");
// It WOULD make sense to call `sync` here, but this function doesn't
// seem to be called on Linux... so we call `self.sync(true)` in
// `Drop::drop`, instead.
//
// See https://github.com/cberner/fuser/issues/153
self.sync(true);
}

#[instrument(level = "debug", skip(self, _req, reply))]
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use fuser::MountOption;
fn main() {
let config = Config::from_args();
let mut options = vec![
MountOption::AutoUnmount,
MountOption::FSName(format!("{}", config.input)),
];
if config.read_only {
Expand Down

0 comments on commit 35f6bf8

Please sign in to comment.