Skip to content

Latest commit

 

History

History
121 lines (81 loc) · 3.93 KB

File metadata and controls

121 lines (81 loc) · 3.93 KB
title GNULUG Oct 5 meeting: FUSE!
author Samuel Grayson

First, projects

Monolithic, modular, or microkernel?

Monolothic

  • All important operations implemented in kernelspace and at install time.
  • Possibly layered
  • E.g. Windows, FreeBSD

Modular

  • All important operations implemented in kernelspace, but you can add/remove modules from the kernel.
  • More similar to monolothic, just with module load/unload.
  • E.g. Linux

Microkernel

  • Most important operations implemented in userspace, installed/removed like users programs.
  • E.g. MINIX, GNU HURD

Kernel- vs user-space

  • In userspace, a CPU register makes certain assembly instructions illegal.
  • In kernelspace, that register is off => direct control over hardware.
  • Kernelspace > root user > normal user

Kernel- vs user-space

  • Kernelspace requires a greater degree of trust. Becomes attack surface for hackers.
  • Why not implement operation in userspace? Direct hw access and performance. For file systems, mostly performance.
    • Kernel please read this big file into my memory space.

Linus vs Tanenbaum debate


FUSE

  • Filesystem in User SpacE
  • Inspired by GNU HURD
  • For FS that isn't performance critical or system critical

Examples

  • Autotier FUSE that automatically moves files into tiered storage based on access.
  • SSHFS mounts a directory on a remote over SSH. Needs a maintainer!
  • rclone mount lets you mount Google Drive (!)

Our FUSE

$ mkdir test
$ # install by system package manager and call "make" or use Nix to install and compile
$ nix build .
$ ./result/bin/vanilla_fs test
<lots of output>
$ # in another terminal
$ ls -l test
total 0
-rwxrwxrwx 0 root root 29 Dec 31  1969 every_path_resolves_to_a_file
-rwxrwxrwx 0 root root 29 Dec 31  1969 welcome_to_bbfs

asciicast

<script id="asciicast-1SYKFtKmWS3nJVqmsEdqyZ76c" src="https://asciinema.org/a/1SYKFtKmWS3nJVqmsEdqyZ76c.js" async></script>

Our FUSE

  • Trial-by-error: you need getattr for anything else to work.
  • getattr must set st_mode = S_IFDIR for files and st_mode = S_IFREG for anything else to work.
  • getattr must set st_size to the real size of the file. GLIBC read will truncate the result to this size!
  • write returns the number of bytes written. This must equal the number of bytes requested (third arg) or else GLIBC will think that write failed.

Our FUSE (continued)

  • read takes an optional offset, which begins reading from that point.
  • read must return the number of bytes read. If this is less than the amount requested, GLIBC interprets this as the end-of-file.
  • readdir calls filler(...) to return results

Your FUSE