mirror of
https://github.com/osnr/TabFS.git
synced 2024-06-08 00:42:16 +02:00
Tweak README and Makefile for new deps, Linux support.
This commit is contained in:
parent
281e0a3d8c
commit
2426e9f7a5
48
README.md
48
README.md
|
@ -5,41 +5,33 @@
|
||||||
You need to both install the Chrome extension and run the native
|
You need to both install the Chrome extension and run the native
|
||||||
filesystem.
|
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
|
### Install the Chrome extension
|
||||||
|
|
||||||
Go to the [Chrome extensions page](chrome://extensions).
|
Go to the [Chrome extensions page](chrome://extensions).
|
||||||
|
|
||||||
Enable Developer mode. Load-unpacked the `extension/` folder in this repo.
|
Enable Developer mode. Load-unpacked the `extension/` folder in this repo.
|
||||||
|
|
||||||
### Run the C filesystem
|
|
||||||
|
|
||||||
First, make sure you `git submodule update --init` to get the `mmx`
|
|
||||||
and `cJSON` dependencies. And make sure you have FUSE.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cd fs
|
|
||||||
$ mkdir mnt
|
|
||||||
$ make [unmount] mount
|
|
||||||
```
|
|
||||||
|
|
||||||
### Connect the browser extension to the filesystem
|
|
||||||
|
|
||||||
Once the filesystem is running and awaiting a WebSocket connection,
|
|
||||||
you need to tell the browser extension to connect to it.
|
|
||||||
|
|
||||||
Click the 'T' icon the extension put in your browser toolbar. The icon
|
|
||||||
badge should change from red to blue, and the filesystem program
|
|
||||||
should print that it's connected in the terminal.
|
|
||||||
|
|
||||||
Now your browser tabs should be mounted in `fs/mnt`!
|
Now your browser tabs should be mounted in `fs/mnt`!
|
||||||
|
|
||||||
## Design
|
## Design
|
||||||
|
|
||||||
- `extension/`: Browser extension, written in JS
|
- `extension/`: Browser extension, written in JS
|
||||||
- `fs/`: Native FUSE filesystem, written in C
|
- `fs/`: Native FUSE filesystem, written in C
|
||||||
- `tabfs.c`: Main thread. Talks to FUSE, implements fs operations.
|
- `tabfs.c`: Talks to FUSE, implements fs operations, talks to browser.
|
||||||
- `ws.c`: Side thread. Runs WebSocket server. Talks to browser.
|
|
||||||
- `common.c`: Communications interface between tabfs and ws.
|
|
||||||
|
|
||||||
When you, say, `cat` a file in the tab filesystem:
|
When you, say, `cat` a file in the tab filesystem:
|
||||||
|
|
||||||
|
@ -51,18 +43,14 @@ When you, say, `cat` a file in the tab filesystem:
|
||||||
userspace filesystem in `fs/tabfs.c`,
|
userspace filesystem in `fs/tabfs.c`,
|
||||||
|
|
||||||
4. then `tabfs_read` rephrases the request as a JSON string and
|
4. then `tabfs_read` rephrases the request as a JSON string and
|
||||||
forwards it using `common_send_tabfs_to_ws` to `fs/ws.c`,
|
forwards it to the browser extension over 'native messaging',
|
||||||
|
|
||||||
5. and `fs/ws.c` forwards it to our browser extension over WebSocket
|
|
||||||
connection;
|
|
||||||
|
|
||||||
6. our browser extension in `extension/background.js` handles the
|
6. our browser extension in `extension/background.js` handles the
|
||||||
incoming message and calls the browser APIs to construct the data
|
incoming message and calls the browser APIs to construct the data
|
||||||
for that synthetic file;
|
for that synthetic file;
|
||||||
|
|
||||||
7. then the data gets sent back in a JSON message to `ws.c` and then
|
7. then the data gets sent back in a JSON native message to `tabfs.c`
|
||||||
back to `tabfs.c` and finally back to FUSE and the kernel and
|
and and finally back to FUSE and the kernel and `cat`.
|
||||||
`cat`.
|
|
||||||
|
|
||||||
(very little actual work happened here, tbh. it's all just
|
(very little actual work happened here, tbh. it's all just
|
||||||
marshalling)
|
marshalling)
|
||||||
|
|
29
fs/Makefile
29
fs/Makefile
|
@ -4,24 +4,21 @@ TARGETS = tabfs
|
||||||
OSXFUSE_ROOT = /usr/local
|
OSXFUSE_ROOT = /usr/local
|
||||||
#OSXFUSE_ROOT = /opt/local
|
#OSXFUSE_ROOT = /opt/local
|
||||||
|
|
||||||
INCLUDE_DIR = $(OSXFUSE_ROOT)/include/osxfuse/fuse
|
CFLAGS_EXTRA = -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -Wall -Wno-unused-function -g
|
||||||
LIBRARY_DIR = $(OSXFUSE_ROOT)/lib
|
|
||||||
|
|
||||||
CC ?= gcc
|
ifeq ($(shell uname -s),Linux)
|
||||||
|
CFLAGS = $(CFLAGS_EXTRA)
|
||||||
CFLAGS_OSXFUSE = -I$(INCLUDE_DIR) -L$(LIBRARY_DIR)
|
LIBS = -lfuse
|
||||||
CFLAGS_OSXFUSE += -DFUSE_USE_VERSION=26
|
endif
|
||||||
CFLAGS_OSXFUSE += -D_FILE_OFFSET_BITS=64
|
ifeq ($(shell uname -s),Darwin)
|
||||||
CFLAGS_OSXFUSE += -D_DARWIN_USE_64_BIT_INODE
|
CFLAGS = -I$(OSXFUSE_ROOT)/include/osxfuse/fuse -L$(OSXFUSE_ROOT)/lib -D_DARWIN_USE_64_BIT_INODE $(CFLAGS_EXTRA)
|
||||||
|
LIBS = -losxfuse
|
||||||
CFLAGS_EXTRA = -Wall -Wno-unused-function -g $(CFLAGS)
|
endif
|
||||||
|
|
||||||
LIBS = -losxfuse
|
|
||||||
|
|
||||||
all: $(TARGETS)
|
all: $(TARGETS)
|
||||||
|
|
||||||
tabfs: tabfs.c
|
tabfs: tabfs.c
|
||||||
$(CC) $(CFLAGS_OSXFUSE) $(CFLAGS_EXTRA) -o $@ $^ $(LIBS)
|
cc $(CFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGETS) *.o
|
rm -f $(TARGETS) *.o
|
||||||
|
@ -30,9 +27,3 @@ clean:
|
||||||
unmount:
|
unmount:
|
||||||
killall -9 tabfs || true
|
killall -9 tabfs || true
|
||||||
diskutil unmount force mnt || true
|
diskutil unmount force mnt || true
|
||||||
|
|
||||||
mount: tabfs
|
|
||||||
./tabfs -odirect_io -s -f mnt
|
|
||||||
|
|
||||||
debugmount: tabfs
|
|
||||||
lldb -- ./tabfs -odirect_io -s -f mnt
|
|
||||||
|
|
Loading…
Reference in a new issue