A toy FUSE filesystem.
You will need autotool to generate the Makefiles.
To compile, you need libfuse
installed. On debian-based distributions:
sudo apt install -y libfuse-dev
Then compile with make
:
./configure
make
Execute tests with:
make check
The FUSE implementation.
int _mkdir(struct inode *parent, const char *name);
int _read(struct inode *inode, char *buf, size_t size, off_t offset);
int _getattr(struct inode* inode, struct stat *st);
Parses paths, split them into fragments, etc.
struct Path {
size_t fragments;
char **fragbuf;
};
int parse(const char* path, struct Path *result);
char *dirname(const struct Path *path);
char *filename(const struct Path *path);
Use AES (provided by OpenSSL) to encrypt and decrypt file content. The initialization vector is randomly generated at inode creation and stored in the inode itself.
#define IV_SIZE 16
/**
* Generates a random initialization vector.
*/
int create_iv(char *dst);
/**
* Encrypts the buffer in place. Note: the buffer size must be a
* multiple of the AES block size (16 byte).
*/
int encrypt(const char *iv, const char* key, char *buf, size_t bufsize);
/**
* Decrypts the buffer in place. Note: the buffer size must be a
* multiple of the AES block size (16 byte).
*/
int decrypt(const char *iv, const char *key, char *buf, size_t bufsize);
int write_blocks(
blno_t *blocks,
size_t count,
const char *buf,
size_t bufsize);
int read_blocks(
blno_t *blocks,
size_t count,
const char *buf,
size_t bufsize);