Fuse.Problem
Macros | Functions | Variables
problemFuse.h File Reference

The file contains all the fuse callbacks implemented. More...

#include <errno.h>
#include <fcntl.h>
#include <fuse.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
Include dependency graph for problemFuse.h:

Go to the source code of this file.

Macros

#define _FILE_OFFSET_BITS   64
 
#define FUSE_USE_VERSION   30
 
#define _XOPEN_SOURCE   500
 

Functions

void fpr_init (const char *path)
 initializer for the fuse.problem filesystem More...
 
void fpr_destroy ()
 destroyer for the fuse.problem filesystem. More...
 
int fpr_getattr (const char *path, struct stat *stbuf)
 getattr callback for fuse.problem More...
 
int fpr_readdir (const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi)
 fill the stat struct for the filesystem More...
 
int fpr_open (const char *path, struct fuse_file_info *fi)
 open file operation More...
 
int fpr_read (const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi)
 read callback for getting file content More...
 
int fpr_write (const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fi)
 write callback More...
 
int fpr_truncate (const char *path, off_t size)
 truncate a file (fix it to zero when overwritten) More...
 

Variables

void * problem
 

Detailed Description

The file contains all the fuse callbacks implemented.

The file contains all the fuse callbacks implemented

Function Documentation

◆ fpr_destroy()

void fpr_destroy ( )

destroyer for the fuse.problem filesystem.

Destroys the fuse Problem class

◆ fpr_getattr()

int fpr_getattr ( const char *  path,
struct stat *  stbuf 
)

getattr callback for fuse.problem

The getattr callback should fill a stat struct that contains the times for the different files and access attributes. This is a callback. This function is exported in C

Parameters
paththe path of the inode that is stat
stbufthe struct stat that must be filled
Returns
a 0 int when succeed, and a -ENOENT on error (path unknown)

◆ fpr_init()

void fpr_init ( const char *  path)

initializer for the fuse.problem filesystem

This function creates a new pointer for the fuse problem that will be used throughout the library. This function is exported in C

Parameters
pathpath of the shared library that contains the shared object

◆ fpr_open()

int fpr_open ( const char *  path,
struct fuse_file_info *  fi 
)

open file operation

The function sets the direct_io flag to one. This changes the behaviour in reading for the filesystem. Return 0 if the file exists, while -ENOENT when file does not exist. This function is exported in C

Parameters
paththe path of the file to be opened
fithe fuse struct that contains info for the file
Returns
zero or -ENOENT

◆ fpr_read()

int fpr_read ( const char *  path,
char *  buf,
size_t  size,
off_t  offset,
struct fuse_file_info *  fi 
)

read callback for getting file content

This callback calls the Problem<FP>::read method and returns exactly the data into buf. Theread operation guarantees the direct I/O flag set to true. This function is exported in C

Parameters
paththe path of the file
bufthe buffer in which data will be called
sizemaximum size writable
offsetoffset for reading
fistruct of the file from fuse
Returns
number of bytes written

◆ fpr_readdir()

int fpr_readdir ( const char *  path,
void *  buf,
fuse_fill_dir_t  filler,
off_t  offset,
struct fuse_file_info *  fi 
)

fill the stat struct for the filesystem

Fills recursively the stat struct that contains the access informations and the contained file system. This is a callback. This function is exported in C

Parameters
paththe current file path
bufan internal buffer required by the callback
filler
offset
fi
Returns
a 0 on success, -ENOENT if not found

◆ fpr_truncate()

int fpr_truncate ( const char *  path,
off_t  size 
)

truncate a file (fix it to zero when overwritten)

Function called before a write. It is necessary to guarantee that write operation will be performed. It is almost a dummy function that returns zero when succeed and -ENOENT when the file does not exist. This function is exported in C

Parameters
pathfile to be truncated
offsetsize (unused) return 0 or -ENOENT

◆ fpr_write()

int fpr_write ( const char *  path,
const char *  buf,
size_t  size,
off_t  offset,
struct fuse_file_info *  fi 
)

write callback

The write callback calls the problem write opeation and it is used to get the data to be parsed. When a write is called, it also fires an update operation with a re-evaluation of all functions. This function is exported in C

Parameters
paththe path of the file to be written
bufthe buffer that will be written
sizethe size of data to be written (unused)
offsetoffset of the data to be written (unused)
fistruct of fuse filesystem
Returns
number of byte written in the filesystem

Variable Documentation

◆ problem

void* problem

external global variable that contains the problem lib path