| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| source | 2016-04-19 | ||
| README | 2016-04-19 | 5.2 kB | |
| Totals: 2 Items | 5.2 kB | 0 |
Liblolfs - Little Object List (LOL) filesystem - by Niko Kiiskinen
Please see file 'INSTALL' for detailed installation instructions
Manifesto
I enjoy (re-)inventing wheels, here is another excr.. example.
Lolfs is a container file. It means that it is a file (stored
in your computer somewhere) which has other files inside it.
Once you create a lol container file (using the included
'mkfs.lolfs' utility for example), you can then use the
lolfs API explained in <lolfs.h> to create, modify and delete
files in this container.
The installation package also includes a couple of programs
which you may use to do some of the common file operations:
mkfs.lolfs program:
-------------------
"mkfs.lolfs" creates a container file.
It takes 3 parameters:
- block size: the number of bytes a "block" has
(this is a number which you can choose
freely. Try to choose it as average file size
to gain best performance).
- number of blocks: the number of data blocks. This depends
on how big container you want.
Try like 50000 first and try it
- filename: this is just the name which you like to use
as the name of the container file. Ex:
'mycontainer'
Use like: "mkfs.lolfs 1000 50000 mycontainer"
( This creates a container file 'mycontainer' which
has 1000 * 50000 bytes of storage capacity ).
( In Linux, lolfs may be used directly with removable storage,
without warranty of course!
So, you may actually insert an SDHC card to your Linux
and create a lol storage directly there. In that case the
"filename" parameter is just the name of the device,
for example "mkfs.lolfs 512 4000000 /dev/sdb"
You MUST know what you are doing then, and of course
you must be root to do that - or anything similar.
You have been warned! :)
lol_ls program:
---------------
lol_ls lists the files inside your container file.
Use it like "lol_ls mycontainer", where "mycontainer"
is the name of the container file
lol_cp program:
---------------
lol_cp copies files to (and from) your container file.
If you want to copy a file /home/you/readme.txt to your
container file 'mycontainer', use:
lol_cp /home/you/readme.txt mycontainer
If you want to copy a file which is inside the container
back to somewhere, use:
lol_cp mycontainer:/readme.txt /some/directory
NOTE: When accessing files inside your container, you must
separate the path with ':' like in above example.
lol_rm program:
---------------
lol_rm deletes a file from your container file.
Use like: "lol_rm mycontainer:/readme.txt"
NOTE: Note also here (this is common feature when accessing
files inside a container), that you must separate
the file with a ':' from it's container.
lol_df program:
---------------
lol_df Shows how much space is used in container file.
Use like: "lol_df mycontainer"
lol_cat program:
----------------
lol_cat Prints the contents of a file (inside a container)
to standard output.
Use like: "lol_cat mycontainer:/readme.txt"
Or like: "lol_cat mycontainer:/somefile > somefile.bak"
lolfs API:
The API functions in <lolfs.h> are as much identical to their standard C
counterparts.
DIFFERENCES ARE:
- they are all prefixed with "lol_", for example fopen <-> lol_fopen
fread <-> lol_fread, stat <-> lol_stat, etc..
- when you lol_fopen a file (or otherwise manipulate files inside
a container file, you must separate the filesystem path from the
file inside a container with a ':'
Example: Create a file "test.txt" inside container called 'mycontainer'.
#include <string.h>
#include <lolfs.h>
int main() {
lol_FILE *fp;
char text[] = "Hello World!\n";
fp = lol_fopen("mycontainer:/test.txt", "w");
lol_fwrite((char *)text, strlen(text), 1, fp);
lol_fclose(fp);
return 0;
}
How to compile and link a lolfs enabled program:
gcc program.c -o program -llolfs
Questions, Bug reports, etc..
Niko Kiiskinen
nkiiskin {at} yahoo com
http://swagfile.com