persist: don't crash on empty tree

When the root of the tree does not exist, simply return.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
fuse: create .git/loose

This removes an additional step in the setup of having to create
`.git/loose` directory.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
test-pack: rewrite

The previous version of test-pack wasn't working anyway.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Squelch some compiler warnings

Most of them are about the return value of `fread` not being used.
Additionally, struct'ify dr_tree and vfr_tree in persist.c.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
pack, loose: add offsets to dbg messages

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Merge branch 'master' of https://github.com/artagnon/phoenixfs
Squelch some compiler warnings

Most of them are about the return value of `fread` not being used.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
loose: fix code to update idx

Update idx used to re-add existing entries in idx into looseroot, but
forgot to set the corresponding offsets.  Fix this.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
pack: make unmap_write_idx emit a dbg message

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
pack: check if an fseek fails

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
fuse: create .git/

This removes an additional step in the setup of having to `git int`
the gitdir.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
README: update

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Merge branch 'master' of https://github.com/artagnon/phoenixfs

Conflicts:
	fuse.c
	loose.c
	main.c
	pack.c
	persist.c
README.md: convert to Markdown and update

Add usage information and technical documentation.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
loose: don't rewrite idx unnecessarily

As a minor optimization, don't rewrite the idx when there are no new
entries.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
persist: handle writing empty vfr_tree

Fix a bug: phoneixfs used to crash on empty filesystem.  Don't assume
that are always vfr entries to write; when there are no entries to
write, write num_keys = 0.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Makefile: compile with -O0

Since phoenixfs is in its early stages of development, compile with
-O0 to aid debugging.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
fuse: fix getattr/ open for files missing in backing FS

Don't assume that the latest version of a file will always be
available in the backing FS; try the fstree.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
persist: handle writing empty dr_tree

Fix a bug: phoneixfs used to read error (num_keys) on empty
filesystem.  Don't assume that are always dr entries to write; when
there are no entries to write, write num_keys = 0.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
fuse: fix getattr/ opendir for dirs missing in backing FS

Don't assume that directories will always be available in the backing
FS; try the fstree.  This doesn't fix readdir, so missing directories
won't be shown in the 'ls' output, but can be opened.  Unfortunately,
drs are inserted directly into the fsroot -- this needs to be changed
to some recursive format to ease lookups.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>