aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 1a90a2fd1a1c6411a98334d362bf333a4ab0a5d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# tabfs

## Setup

You need to both install the Chrome extension and run the native
filesystem.

### Run the C filesystem

First, make sure you `git submodule update --init` to get the
`fs/cJSON` and `fs/base64` dependencies.

And make sure you have FUSE. On Linux, for example, `sudo apt install
libfuse-dev`. On macOS, get FUSE for macOS.

```
$ cd fs
$ mkdir mnt
$ make
```

### Install the Chrome extension

Go to the [Chrome extensions page](chrome://extensions).

Enable Developer mode. Load-unpacked the `extension/` folder in this repo.

Now your browser tabs should be mounted in `fs/mnt`!

## Design

- `extension/`: Browser extension, written in JS
- `fs/`: Native FUSE filesystem, written in C
  - `tabfs.c`: Talks to FUSE, implements fs operations, talks to browser.

When you, say, `cat` a file in the tab filesystem:

1. `cat` makes something like a `read` syscall,

2. which goes to the FUSE kernel module which backs that filesystem,

3. FUSE forwards it to the `tabfs_read` implementation in our
   userspace filesystem in `fs/tabfs.c`,

4. then `tabfs_read` rephrases the request as a JSON string and
   forwards it to the browser extension over 'native messaging',

6. our browser extension in `extension/background.js` handles the
   incoming message and calls the browser APIs to construct the data
   for that synthetic file;

7. then the data gets sent back in a JSON native message to `tabfs.c`
   and and finally back to FUSE and the kernel and `cat`.

(very little actual work happened here, tbh. it's all just
marshalling)

TODO: make diagrams?