Distributed File System 1
Distributed file system in C
Loading...
Searching...
No Matches
inode.h File Reference
#include "lib.h"
#include "list.h"
#include "uuid.h"

Go to the source code of this file.

Classes

struct  INode
 Gives a file name an ID. More...

Macros

#define INODE_TABLE   "data/inode.bin"

Functions

 DefList (INode) Buffer INode_serialize(INode inode)
 Serialize an INode into a Buffer.
INode INode_deserialize (Buffer buf)
 Deserialize a Buffer into an INode Caller must free memory in Block.cid.
Buffer ListINode_serialize (ListINode list)
 Serialize a List of INode's into a Buffer.
ListINode ListINode_deserialize (Buffer buf)
 Deserialize a Buffer into a List of INode's.
void ListINode_print (ListINode list)
 Prints a List of INode's.
void insert_into_inode (SafeStr fname, size_t size)
 INSERT into the INode table.
ListINode select_from_inode (UUID *fid, SafeStr *fname, size_t *size)
 SELECT from the INode table.
ListINode INode_get_db (void)
 Get the INode table from the database.
void INode_set_db (ListINode inodes)
 Write the database with the List of INode's.
void print_inode (INode inode)
 Print an INode's data as a tuple.

Macro Definition Documentation

◆ INODE_TABLE

#define INODE_TABLE   "data/inode.bin"

Function Documentation

◆ DefList()

DefList ( INode )

Serialize an INode into a Buffer.

Caller must free memory in Buffer.buf.

Parameters
inodethe INode you want to serialize
Returns
the Buffer that the Block represents

◆ INode_deserialize()

INode INode_deserialize ( Buffer buf)

Deserialize a Buffer into an INode Caller must free memory in Block.cid.

Parameters
bufferThe Buffer you want to deserialize
Returns
The INode that the Buffer represents

◆ INode_get_db()

ListINode INode_get_db ( void )

Get the INode table from the database.

Returns
a List of INode's

◆ INode_set_db()

void INode_set_db ( ListINode inodes)

Write the database with the List of INode's.

Parameters
inodesthe List of INode's that you want to overwrite the database with

◆ insert_into_inode()

void insert_into_inode ( SafeStr fname,
size_t size )

INSERT into the INode table.

Parameters
fnamethe name of the file
sizethe size of the file in Byte's

◆ ListINode_deserialize()

ListINode ListINode_deserialize ( Buffer buf)

Deserialize a Buffer into a List of INode's.

Caller must free memory in Block.cid.

Parameters
bufferThe Buffer you want to deserialize
Returns
The List of INode's that the Buffer represents

◆ ListINode_print()

void ListINode_print ( ListINode list)

Prints a List of INode's.

Parameters
listthe List of INode's that you want to print

◆ ListINode_serialize()

Buffer ListINode_serialize ( ListINode list)

Serialize a List of INode's into a Buffer.

Caller must free memory in Buffer.buf.

Parameters
listthe List of INode's that you want to serialize
Returns
the Buffer that the ListINode represents

◆ print_inode()

void print_inode ( INode inode)

Print an INode's data as a tuple.

Parameters
inodethe INode to be printed

◆ select_from_inode()

ListINode select_from_inode ( UUID * fid,
SafeStr * fname,
size_t * size )

SELECT from the INode table.

Parameters
fidthe INode's UUID or NULL
fnamethe INode's file's name or NULL @praam size the size of the file or NULL
Returns
a ListINode of the possible matches