Giter Club home page Giter Club logo

bento's Introduction

Bento enables fast development of Linux kernel file systems. File systems are written in safe Rust by implementing a safe API and using safe wrappers around kernel functions. These safe interfaces are as close as possible to existing userspace (primarily standard library) interfaces, so a file system can be recompiled as a FUSE file system by only changing the bento includes to userspace Rust library and/or bento_utils includes. File systems register themselves with the BentoFS module when inserted and can be dynamically upgraded with only 10ms of service interruption by having the upgrade version reregister with the BentoFS module. More information about the system design can be found in our paper at FAST 2021. Please also check out our video from FAST for an introduction to the framework.

Before Running the Code

To pull bentofs and datablack-rs, run: git submodule update --init --recursive in the root directory. To update, run git submodule update --recursive --remote.

Rust Version

Newer versions of the Rust compiler have changed how kernel code is compiled. If you're using a recent version of Rust and run into issues, try the following steps, which can be seen in the tcp_support branch for the bento and xv6fs directories.

  • Use the bento/rust/build.rs file from the tcp_support branch.
  • In the KBuild files, replace x86_64-linux-kernel with x86_64-unknown-none-linuxkernel.
  • In bento/rust/src/lib.rs, remove #![feature(const_fn)] and add #![feature(rustc_private)].
  • In the bento directory and the file system kernel directories, remove rlibc from the Cargo.toml files and the rlibc import from the src/lib.rs files.
  • In bento/bento/rust/src/kernel/mem.rs, remove the use rlibc line and replace rlibc::memcpy and rlibc::memset with compiler_builtins::mem::memcpy and compiler_builtins::mem::memset.
  • If you see and error saying .{FILE_NAME}.rust.o.cmd: No such file or directory, touch the file to create it.
  • If you still have problems, reach out to me.

Directories

BentoFS module

BentoFS is a C kernel module that interfaces between the VFS layer and the file system and exposes a safer API for Bento file systems. It's implemented as a VFS file system, handling calls from VFS and forwarding them to the appropriate file system. File systems register themselves with the BentoFS module, so the BentoFS module must be inserted before any file system module.

Bento library

The bento Rust library exposes Safe Rust interfaces to Bento file systems. Bento file systems implement the BentoFileSystem trait provided in the library. The bento library receives calls from BentoFS and translates these into safe calls to BentoFileSystem methods. The bento library also exposes safe wrappers around kernel types and functions, such as the RwLock for the kernel read-write semaphore and TcpStream and TcpListener for the kernel TCP bindings. Additionally, bento implements the Rust global allocator, so Bento file systems can use Rust’s alloc crate.

Bento Utils library

The bento_utils library exposes functionality needed for userspace Bento file systems. For the most part, interfaces provided in the bento library mirror existing userspace Rust libraries, most often the standard library, so a Bento file system can be compiled as a FUSE file system just by changing bento include statements to Rust library include statements. The bento_utils library provides userspace implementations of the remaining interfaces that aren't based on existing Rust libraries.

Example file systems are provided. Instructions for compiling each module are included in the READMEs in each subdirectory.

Project Structure

Libraries

  • bentofs: Module to enable file systems written using the FUSE low-level interface in the kernel. Compiled and inserted as a separate kernel module.
  • bento: Rust library that exposes safe Rust bindings to a kernel file system. Included by the file systems, so not compiled separately.
  • bento_utils: Rust library to expose kernel-specific implementations to userspace Bento file systems.
  • datablock-rs: Rust library that enables safe, efficient reading of basic data structures from byte arrays. Included by the file systems, so not compiled separately.

File Systems

  • hello_ll: Basic file system. Compiled and inserted as a separate kernel module.
  • hello_ll2: Redeployable version of hello_ll. Nearly identical to hello_ll except for changes in kernel/lib.rs.
  • hello_client and hello_srv: Networked version of hello_ll.
  • xv6fs: Rust reimplementation of the xv6 file system. Compiled and inserted as a separate kernel module.
  • xv6fs2: Redeployable version of xv6fs. Nearly identical to xv6fs except for changes in kernel/lib.rs.
  • xv6fs_prov: Version of xv6fs with file provenance tracking.

bento's People

Contributors

smiller123 avatar danyangz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.