Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
nightly: nightly

jobs:
# This represents the minimum Rust version supported by
# fs4. Updating this should be done in a dedicated PR.
# AsterFs. Updating this should be done in a dedicated PR.
#
# Tests are not run as tests may require newer versions of
# rust.
Expand Down Expand Up @@ -80,7 +79,7 @@ jobs:
steps:
- uses: actions/checkout@v6
- name: Install Rust
run: rustup update stable && rustup default stable && rustup component add rustfmt
run: rustup toolchain install 1.95.0 --profile minimal --component rustfmt && rustup default 1.95.0
- name: Check formatting
run: cargo fmt --all -- --check

Expand All @@ -98,7 +97,7 @@ jobs:
- uses: actions/checkout@v6
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update stable --no-self-update && rustup default stable && rustup component add clippy
run: rustup toolchain install 1.95.0 --profile minimal --component clippy && rustup default 1.95.0
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Apply clippy lints
Expand Down Expand Up @@ -134,7 +133,7 @@ jobs:
restore-keys: |
${{ runner.os }}-cross-
- name: Install Rust
run: rustup update stable && rustup default stable
run: rustup toolchain install 1.95.0 --profile minimal && rustup default 1.95.0
- name: Install MinGW toolchain for Windows GNU cross targets
# windows-sys >= 0.61 generates import libraries via `dlltool`
# when building for *-pc-windows-gnu. ubuntu-latest ships the
Expand Down Expand Up @@ -171,7 +170,7 @@ jobs:
${{ runner.os }}-build-
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update stable --no-self-update && rustup default stable
run: rustup toolchain install 1.95.0 --profile minimal && rustup default 1.95.0
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Run build
Expand Down Expand Up @@ -200,8 +199,18 @@ jobs:
${{ runner.os }}-test-
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update stable --no-self-update && rustup default stable
run: rustup toolchain install 1.95.0 --profile minimal && rustup default 1.95.0
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Run test
run: cargo hack test --each-feature -- --test-threads 1

apple-preallocation:
name: apple preallocation contract
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
- name: Install pinned Rust toolchain
run: rustup toolchain install 1.95.0 --profile minimal && rustup default 1.95.0
- name: Verify APFS allocation and ENOSPC behavior
run: scripts/test-apple-preallocation.sh
13 changes: 6 additions & 7 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ env:
CARGO_TERM_COLOR: always

# Matrix dimensions covered for Codecov to reflect the per-OS split of
# fs4's platform code:
# AsterFs platform code:
#
# - linux-x86_64: src/unix.rs + src/unix/**, exercising rustix's
# Linux `fallocate` path and `statvfs`.
# - macos-aarch64: src/unix.rs + src/unix/**, exercising rustix's
# macOS `F_PREALLOCATE` path (different enough from
# Linux that issue #15 was macOS-specific).
# - macos-aarch64: src/unix.rs + src/unix/**, exercising AsterFs's
# all-or-nothing macOS `F_PREALLOCATE` backend.
# - windows-x86_64: src/windows.rs + src/windows/**, exercising the
# Win32 lock + `FILE_ALLOCATION_INFO` APIs.
#
Expand Down Expand Up @@ -70,14 +69,14 @@ jobs:
steps:
- uses: actions/checkout@v6

- name: Install Rust stable
- name: Install pinned Rust toolchain
# `llvm-tools-preview` is required by `cargo tarpaulin --engine
# llvm`, which is the only tarpaulin engine that works
# uniformly on Linux + macOS + Windows.
shell: bash
run: |
rustup toolchain install stable --component llvm-tools-preview --profile minimal
rustup default stable
rustup toolchain install 1.95.0 --component llvm-tools-preview --profile minimal
rustup default 1.95.0

- name: Install cargo-tarpaulin
uses: taiki-e/install-action@v2
Expand Down
58 changes: 0 additions & 58 deletions .github/workflows/loc.yml

This file was deleted.

20 changes: 20 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# AsterFs

AsterFs is AsterCommunity's maintained fork of `fs4`. It provides small, auditable filesystem primitives for sync and async Rust without importing product-domain behavior.

## Working contract

- Inspect the current branch, HEAD, worktree, applicable OS backend, and adjacent tests before editing.
- Preserve upstream API and feature compatibility unless a breaking change is explicitly approved.
- Keep platform syscalls in `src/unix/` or `src/windows/`; sync and async traits must share the same platform semantics.
- `allocate(len)` means physical space is reserved so later writes within `len` do not fail for lack of disk space. Logical `set_len` alone does not satisfy this contract.
- Native error codes must be preserved. Capacity exhaustion must not be converted into success or an unrelated error.
- Changes to platform behavior require native runtime evidence on every affected OS. Cross-compilation proves cfg and linking only.
- Keep tests bounded and clean up temporary volumes, images, files, and mounts even on failure.
- Run formatting, focused tests, the applicable feature matrix, cross-target checks, and `git diff --check` before delivery.

## Ownership

- Upstream history and copyright remain intact.
- AsterCommunity-specific fixes are recorded in the current changelog and linked to an issue.
- Do not publish, tag, force-push, delete branches, or rewrite upstream history without explicit authorization.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Releases

## Unreleased

### Changes

- Fork `fs4` 1.1.0 as `aster-fs` under AsterCommunity while preserving its public sync and async filesystem APIs and upstream history.

### Fixes

- Make Apple file preallocation all-or-nothing with `F_ALLOCATEALL`, validate the kernel-reported allocated byte count before extending logical EOF, recover missing blocks in existing sparse files, and preserve native `ENOSPC` errors without leaving a new partial allocation ([#1](https://github.com/AsterCommunity/AsterFs/issues/1), [AsterDrive #623](https://github.com/AsterCommunity/AsterDrive/issues/623)).

## 1.1.0

### Changes
Expand Down
24 changes: 16 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
[package]
name = "fs4"
# NB: When modifying, also modify html_root_url in lib.rs
version = "1.1.0"
name = "aster-fs"
version = "0.1.0"
rust-version = "1.75.0"
authors = ["Dan Burkert <dan@danburkert.com>", "Al Liu <scygliu1@gmail.com>"]
authors = [
"AsterCommunity Contributors <contributors@astercosm.com>",
"Dan Burkert <dan@danburkert.com>",
"Al Liu <scygliu1@gmail.com>",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/al8n/fs4"
documentation = "https://docs.rs/fs4"
description = "No libc, pure Rust cross-platform file locks. Original fs2, now supports async and replace libc by rustix."
keywords = ["file", "fs2", "lock", "duplicate", "flock"]
repository = "https://github.com/AsterCommunity/AsterFs"
documentation = "https://docs.rs/aster-fs"
description = "Auditable cross-platform file locking, allocation, and filesystem utilities for sync and async Rust."
keywords = ["file", "filesystem", "lock", "preallocate", "async"]
categories = ["filesystem", "external-ffi-bindings", "asynchronous"]
edition = "2021"

Expand All @@ -27,6 +30,9 @@ fs-err3-tokio = ["fs-err3", "fs-err3/tokio"]
[target.'cfg(not(windows))'.dependencies]
rustix = { version = "1", features = ["fs"] }

[target.'cfg(target_vendor = "apple")'.dependencies]
libc = "0.2"

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.61"
features = ["Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_IO"]
Expand All @@ -52,3 +58,5 @@ tokio = { version = "1", features = ["full"] }
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[workspace]
Loading
Loading