Fuse Extension. version Erick Gallesio Université de Nice - Sophia Antipolis 930 route des Colles, BP 145 F Sophia Antipolis, Cedex France

Similar documents
POSIX Extension. version 0.90

1 / 22. CS 135: File Systems. General Filesystem Design

1 / 23. CS 137: File Systems. General Filesystem Design

Directory. File. Chunk. Disk

CptS 360 (System Programming) Unit 6: Files and Directories

Fusepy Documentation. Release Giorgos Verigakis

Systems Programming. 09. Filesystem in USErspace (FUSE) Alexander Holupirek

rfs Remote File System Softwarepraktikum für Fortgeschrittene

COS 318: Operating Systems. NSF, Snapshot, Dedup and Review

COS 318: Operating Systems. Journaling, NFS and WAFL

The UNIX File System

rpaths Documentation Release 0.13 Remi Rampin

SOAPED UP. Most Linux users have had some. Building a web service filesystem with SOAP and Fuse SYSADMIN. Table 1: Filesystem Functions

Files and Directories

HelenOS VFS-FUSE connector

File Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Case study: ext2 FS 1

The UNIX File System

Filesystem Hierarchy and Permissions

OPERATING SYSTEMS OVERVIEW. Operating Systems 2015 Spring by Euiseong Seo

Virtual File System. Don Porter CSE 506

CASTORFS - A filesystem to access CASTOR

Secure Software Programming and Vulnerability Analysis

Case study: ext2 FS 1

Status of the Linux NFS client

Filesystem Hierarchy and Permissions

OCFS2: Evolution from OCFS. Mark Fasheh Senior Software Developer Oracle Corporation

UNIT I Linux Utilities

rpaths Documentation Release 0.2 Remi Rampin

Virtual File System. Don Porter CSE 306

CSE 265: System and Network Administration

Today: Distributed File Systems. File System Basics

Today: Distributed File Systems

Introduction to the Network File System (NFS)

CS 1550 Project 3: File Systems Directories Due: Sunday, July 22, 2012, 11:59pm Completed Due: Sunday, July 29, 2012, 11:59pm

Operating System Labs. Yuanbin Wu

Building blocks for Unix power tools

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

RCU. ò Dozens of supported file systems. ò Independent layer from backing storage. ò And, of course, networked file system support

Introduction to the Network File System (NFS)

Overview. Over the next four weeks, we will look at these topics: Building Blocks. Advanced Authentication Issues.

Input & Output 1: File systems

File Systems: Naming

RCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry:

VFS, Continued. Don Porter CSE 506

11/3/71 SYS BREAK (II)

Project 4: File System Implementation 1

File System User API

Container Library and FUSE Container File System Softwarepraktikum für Fortgeschrittene

UNIT I Linux Utilities and Working with Bash

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission

File handling is an important part of any web application. You often need to open and process a file for different tasks.

for Operating Systems Computer Systems Laboratory Sungkyunkwan University

Porting ZFS file system to FreeBSD. Paweł Jakub Dawidek

Files (review) and Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

ECE 598 Advanced Operating Systems Lecture 18

RTEMS Filesystem Design Guide

Lab 4 File System. CS140 February 27, Slides adapted from previous quarters

Tricky issues in file systems

Files and File System

Project 5 File System Protection

CSE 333 SECTION 3. POSIX I/O Functions

Last Week: ! Efficiency read/write. ! The File. ! File pointer. ! File control/access. This Week: ! How to program with directories

Architectural Support for Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

The Journalling Flash File System

FreeBSD/ZFS last word in operating/file systems. BSDConTR Paweł Jakub Dawidek

TOCTTOU Vulnerabilities in UNIX-Style File Systems: An Anatomical Study

Exercise 4: Access Control and Filesystem Security

Porting ZFS 1) file system to FreeBSD 2)

A network file system over HTTP: remote access and modification of files and files

Project 5 File System Protection

Introduction to Unix. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Department of Computer Science and Technology, UTU 2014

File Systems. File Examples. Carsten Griwodz University of Oslo. (includes slides from Pål Halvorsen, Kai Li, A. Tanenbaum and M.

CS Lab 2: fs. Vedant Kumar, Palmer Dabbelt. February 27, Getting Started 2

PESIT Bangalore South Campus

To FUSE or not to FUSE? Analysis and Performance Characterization of the FUSE User-Space File System Framework

The Journalling Flash File System

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Overlayfs And Containers. Miklos Szeredi, Red Hat Vivek Goyal, Red Hat

Advanced Programming in the UNIX Environment W. Richard Stevens

Operating System Labs. Yuanbin Wu

CST8207: GNU/Linux Operating Systems I Lab Six Linux File System Permissions. Linux File System Permissions (modes) - Part 1

Architectural Support for Operating Systems. Jinkyu Jeong ( Computer Systems Laboratory Sungkyunkwan University

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Operating Systems. Copyleft 2005, Binnur Kurt

The UNIX Time- Sharing System

Pintos Project 4 File Systems. November 14, 2016

Files and the Filesystems. Linux Files

The TokuFS Streaming File System

OCFS2 Mark Fasheh Oracle

Network File System (NFS)

Dynamic Detection and Prevention of Race Conditions in File Accesses

File Systems. What do we need to know?

NFS Design Goals. Network File System - NFS

Logical disks. Bach 2.2.1

Introduction to Linux

CS 380S. TOCTTOU Attacks. Don Porter. Some slides courtesy Vitaly Shmatikov and Emmett Witchel. slide 1

Unix Introduction to UNIX

The Network File System

Transcription:

Fuse Extension version 0.90 Erick Gallesio Université de Nice - Sophia Antipolis 930 route des Colles, BP 145 F-06903 Sophia Antipolis, Cedex France

This document was produced using the Skribe Programming Language and its ConTEXt engine. For further information on Skribe, see http://www-sop.inria.fr/mimosa/fp/skribe/. Document created on June 12, 2007.

1 Introduction This extension permits the implementation of virtual file systems in Scheme thanks to the FUSE library. Here is an excerpt of the FUSE site: With FUSE it is possible to implement a fully functional filesystem in a userspace program. Features include: Simple library API Simple installation (no need to patch or recompile the kernel) Secure implementation Userspace - kernel interface is very efficient Usable by non privileged users Runs on Linux kernels 2.4.X and 2.6.X Has proven very stable over time 2 Using the fuse extension To use this extension you need to include the following form in your program: (begin (require "stklos-fuse") (import "stklos-fuse")) This library provides only one entry point called fuse-mount. This function takes a first parameter which is the list of the program arguments and key-list of functions used to implement the file system. The arguments recognized by the version 2.6.5 fuse-mount are given below:

STklos Reference Manual usage: <filesystem> mountpoint (options) general options: -o opt, (opt...) mount options -h --help print help -V --version print version FUSE options: -d -o debug enable debug output (implies -f) -f foreground operation -s disable multi-threaded operation -o allow_other allow access to other users -o allow_root allow access to root -o nonempty allow mounts over non-empty file/dir -o default_permissions enable permission checking by kernel -o fsname=name set filesystem name -o large_read issue large read requests (2.4 only) -o max_read=n set maximum size of read requests -o hard_remove immediate removal (don t hide files) -o use_ino let filesystem set inode numbers -o readdir_ino try to fill in d_ino in readdir -o direct_io use direct I/O -o kernel_cache cache files in kernel -o (no)auto_cache enable caching based on modification times -o umask=m set file permissions (octal) -o uid=n set file owner -o gid=n set file group -o entry_timeout=t cache timeout for names (1.0s) -o negative_timeout=t cache timeout for deleted names (0.0s) -o attr_timeout=t cache timeout for attributes (1.0s) -o ac_attr_timeout=t auto cache timeout for attributes (attr_timeout) -o intr allow requests to be interrupted -o intr_signal=num signal to send on interrupt (10) -o max_write=n set maximum size of write requests -o max_readahead=n set maximum readahead -o async_read perform reads asynchronously (default) -o sync_read perform reads synchronously The list of functions used to implement the file system is given in the next section 3 File system primitives The following functions are available to implement a Scheme file system: :getattr path returns a vector of 8 elements containing: mode bits, number of links, size, uid, gid, atime, mtime, ctime 2

STklos Reference Manual :opendir path this is a hook for controlling directory access, returns 0 if no error :readdir path returns a list of the files in the firectorry path :releasedir path This is a hook called after readdir, returns 0 if no error :mknod path mode creates the file named path with given mode :open path mode fd opens file named path with given mode (O = RDONLY, 1 = WRONLY, 2 = RDWR). The value fd is an unique integer associated by the system to this file :read fd size offset returns a string of size bytes starting at offset on fd :write fd buffer size offset writes the first size characters of buffer at offset on fd. The offset can be after the actual end of file :release fd This function is called when there are no more references to the open file fd. The return value of this function is ignored :rename from to renames file from with name to :unlink path removes the file with given path :link old new creates a link from file old to file to :symlink old new creates a symbolic link from file old to file to :readlink path returns the file that the symbolic link path point to :mkdir path creates directory path :rmdir path removes directory path :chmod path mode change the mode of file path to mode :chown path uid gid changes the owner of path to uid and gid :utime path atime mtime changes the access and modification time of file path to atime and mtime :truncate path size changes the size of path to size :flush path fd flushes cached data on file fd :fsync path datasync fd if the datasync parameter is non-zero, then only the user data should be flushed, not the meta data 3

STklos Reference Manual :fsyncdir path datasync if the datasync parameter is non-zero, then only the user data should be flushed, not the meta data :init This is a hook called when the file system is mounted. It can return a value which will be used when the file systeme is unmounted :destroy data This is a hook called when the file system is unmounted. Its parameter is the return value of the init call. 4 The hellofs filesystem The following example is a very simple (even simplistic) file system written in STklos. This is a file system which contains only a file named hello. You cannot do a lot with this file system and most actions produce errors. To mount the file system you can for instance type: $ hellofs -f ~/fuse This will mount the hellofs on the (already existing and empty) ~/fuse directory. unmount this file system, you can do: To $ fusermount -u ~/fuse A more complete and realistic example is provided in the examples directory. 4

STklos Reference Manual (require "stklos-fuse") (define-module HELLOFS (import stklos-posix stklos-fuse) (define content "Hello, world!\n") (define (hellofs-main args) (fuse-mount args :getattr (lambda (path) (let ((tm (current-seconds))) (cond ((equal? path "/") (vector (+ posix/ifdir #o755) ;; mode 2 ;; links 123 ;; size (why not this one?) (posix-user-id) ;; uid (posix-group-id) ;; gid tm tm tm)) ;; atime, mtime, ctime ((equal? path "/hello") (vector (+ posix/ifreg #o440) ;; mode 1 ;; links (string-length content) ;; size (posix-user-id) ;; uid (posix-group-id) ;; gid tm tm tm)) ;; atime, mtime, ctime (else (- posix/enoent))))) :readdir (lambda (path) (if (equal? path "/") ("." ".." "hello") (- posix/enoent))) :open (lambda (path mode fd) (cond ((not (equal? path "/hello")) (- posix/enoent)) ((not (equal? mode 0)) (- posix/eaccess)) (else 0))) :read (lambda (fd size offset) (let ((len (string-length content))) (if (< offset len) (begin (if (> (+ offset size) len) (set! size (- len offset))) (substring content offset size)) 0))))) ) ;; End of module HELLOFS ;; ====================================================================== ;; HELLOFS... ;; ====================================================================== (define main (in-module HELLOFS hellofs-main)) 5