github.com/hanwen/go-fuse@v1.0.0/README.md (about)

     1  # GO-FUSE
     2  
     3  [![Build Status](https://travis-ci.org/hanwen/go-fuse.svg?branch=master)](https://travis-ci.org/hanwen/go-fuse)
     4  [![GoDoc](https://godoc.org/github.com/hanwen/go-fuse?status.svg)](https://godoc.org/github.com/hanwen/go-fuse)
     5  
     6  native bindings for the FUSE kernel module.
     7  
     8  ## Highlights
     9  
    10  * High speed: as fast as libfuse using the gc compiler for single
    11  threaded loads.
    12  
    13  * Supports in-process mounting of different FileSystems onto
    14  subdirectories of the FUSE mount.
    15  
    16  * Supports 3 interfaces for writing filesystems:
    17    - `PathFileSystem`: define filesystems in terms path names.
    18    - `NodeFileSystem`: define filesystems in terms of inodes.
    19    - `RawFileSystem`: define filesystems in terms of FUSE's raw
    20    wire protocol.
    21  
    22  * Both NodeFileSystem and PathFileSystem support manipulation of true
    23    hardlinks.
    24  
    25  * Includes two fleshed out examples, zipfs and unionfs.
    26  
    27  
    28  ## Examples
    29  
    30  * `example/hello/main.go` contains a 60-line "hello world" filesystem
    31  
    32  * `zipfs/zipfs.go` contains a small and simple read-only filesystem for
    33    zip and tar files. The corresponding command is in example/zipfs/
    34    For example,
    35  
    36    ```shell
    37    mkdir /tmp/mountpoint
    38    example/zipfs/zipfs /tmp/mountpoint file.zip &
    39    ls /tmp/mountpoint
    40    fusermount -u /tmp/mountpoint
    41    ````
    42  
    43  * `zipfs/multizipfs.go` shows how to use in-process mounts to
    44    combine multiple Go-FUSE filesystems into a larger filesystem.
    45  
    46  * `fuse/loopback.go` mounts another piece of the filesystem.
    47    Functionally, it is similar to a symlink.  A binary to run is in
    48    example/loopback/ . For example
    49  
    50    ```shell
    51    mkdir /tmp/mountpoint
    52    example/loopback/loopback -debug /tmp/mountpoint /some/other/directory &
    53    ls /tmp/mountpoint
    54    fusermount -u /tmp/mountpoint
    55    ```
    56  
    57  * `unionfs/unionfs.go`: implements a union mount using 1 R/W branch, and
    58    multiple R/O branches.
    59  
    60    ```shell
    61    mkdir -p  /tmp/mountpoint /tmp/writable
    62    example/unionfs/unionfs /tmp/mountpoint /tmp/writable /usr &
    63    ls /tmp/mountpoint
    64    ls -l /tmp/mountpoint/bin/vi
    65    rm /tmp/mountpoint/bin/vi
    66    ls -l /tmp/mountpoint/bin/vi
    67    cat /tmp/writable/DELETION/*
    68    ```
    69  
    70  * `union/autounionfs.go`: creates UnionFs mounts automatically based on
    71    existence of READONLY symlinks.
    72  
    73  
    74  Tested on:
    75  
    76  - x86 32bits (Fedora 14).
    77  - x86 64bits (Ubuntu Lucid).
    78  
    79  
    80  ## Benchmarks
    81  
    82  We use threaded stats over a read-only filesystem for benchmarking.
    83  Automated code is under benchmark/ directory. A simple C version of
    84  the same FS gives a FUSE baseline
    85  
    86  Data points (Go-FUSE version May 2012), 1000 files, high level
    87  interface, all kernel caching turned off, median stat time:
    88  
    89  platform                    libfuse     Go-FUSE      difference (%)
    90  
    91  Lenovo T60/Fedora16 (1cpu)  349us       355us        2% slower
    92  Lenovo T400/Lucid   (1cpu)  138us       140us        5% slower
    93  Dell T3500/Lucid    (1cpu)   72us        76us        5% slower
    94  
    95  On T60, for each file we have
    96  - Client side latency is 360us
    97  - 106us of this is server side latency (4.5x lookup 23us, 1x getattr 4us)
    98  - 16.5us is due to latency measurements.
    99  - 3us is due to garbage collection.
   100  
   101  ## macOS Support
   102  
   103  go-fuse works somewhat on OSX. Known limitations:
   104  
   105  * All of the limitations of OSXFUSE, including lack of support for
   106    NOTIFY.
   107  
   108  * OSX issues STATFS calls continuously (leading to performance
   109    concerns).
   110  
   111  * OSX has trouble with concurrent reads from the FUSE device, leading
   112    to performance concerns.
   113  
   114  * Tests are expected to pass; report any failure as a bug!
   115  
   116  ## Credits
   117  
   118  * Inspired by Taru Karttunen's package, https://bitbucket.org/taruti/go-extra.
   119  
   120  * Originally based on Ivan Krasin's https://github.com/krasin/go-fuse-zip
   121  
   122  ## Bugs
   123  
   124  Yes, probably.  Report them through
   125  https://github.com/hanwen/go-fuse/issues
   126  
   127  ## Disclaimer
   128  
   129  This is not an official Google product.
   130  
   131  ## Known Problems
   132  
   133  Grep source code for TODO.  Major topics:
   134  
   135  * Missing support for network FS file locking: `FUSE_GETLK`, `FUSE_SETLK`,
   136    `FUSE_SETLKW`
   137  
   138  * Missing support for `FUSE_INTERRUPT`, `CUSE`, `BMAP`, `IOCTL`
   139  
   140  * In the path API, renames are racy; See also:
   141  
   142      http://sourceforge.net/mailarchive/message.php?msg_id=27550667
   143  
   144    Don't use the path API if you care about correctness.
   145  
   146  ## License
   147  
   148  Like Go, this library is distributed under the new BSD license.  See
   149  accompanying LICENSE file.
   150  
   151  --------
   152  
   153  ## Appendix I. Go-FUSE log format
   154  
   155  To increase signal/noise ratio Go-FUSE uses abbreviations in its debug log
   156  output. Here is how to read it:
   157  
   158  - `iX` means `inode X`;
   159  - `gX` means `generation X`;
   160  - `tA` and `tE` means timeout for attributes and directory entry correspondingly;
   161  - `[<off> +<size>)` means data range from `<off>` inclusive till `<off>+<size>` exclusive;
   162  - `Xb` means `X bytes`.
   163  
   164  Every line is prefixed with either `rx <unique>` or `tx <unique>` to denote
   165  whether it was for kernel request, which Go-FUSE received, or reply, which
   166  Go-FUSE sent back to kernel.
   167  
   168  Example debug log output:
   169  
   170  ```
   171  rx 2: LOOKUP i1 [".wcfs"] 6b
   172  tx 2:     OK, {i3 g2 tE=1s tA=1s {M040755 SZ=0 L=0 1000:1000 B0*0 i0:3 A 0.000000 M 0.000000 C 0.000000}}
   173  rx 3: LOOKUP i3 ["zurl"] 5b
   174  tx 3:     OK, {i4 g3 tE=1s tA=1s {M0100644 SZ=33 L=1 1000:1000 B0*0 i0:4 A 0.000000 M 0.000000 C 0.000000}}
   175  rx 4: OPEN i4 {O_RDONLY,0x8000}
   176  tx 4:     38=function not implemented, {Fh 0 }
   177  rx 5: READ i4 {Fh 0 [0 +4096)  L 0 RDONLY,0x8000}
   178  tx 5:     OK,  33b data "file:///"...
   179  rx 6: GETATTR i4 {Fh 0}
   180  tx 6:     OK, {tA=1s {M0100644 SZ=33 L=1 1000:1000 B0*0 i0:4 A 0.000000 M 0.000000 C 0.000000}}
   181  rx 7: FLUSH i4 {Fh 0}
   182  tx 7:     OK
   183  rx 8: LOOKUP i1 ["head"] 5b
   184  tx 8:     OK, {i5 g4 tE=1s tA=1s {M040755 SZ=0 L=0 1000:1000 B0*0 i0:5 A 0.000000 M 0.000000 C 0.000000}}
   185  rx 9: LOOKUP i5 ["bigfile"] 8b
   186  tx 9:     OK, {i6 g5 tE=1s tA=1s {M040755 SZ=0 L=0 1000:1000 B0*0 i0:6 A 0.000000 M 0.000000 C 0.000000}}
   187  rx 10: FLUSH i4 {Fh 0}
   188  tx 10:     OK
   189  rx 11: GETATTR i1 {Fh 0}
   190  tx 11:     OK, {tA=1s {M040755 SZ=0 L=1 1000:1000 B0*0 i0:1 A 0.000000 M 0.000000 C 0.000000}}
   191  ```