ASF docs  3.1.3
Some important library documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
fsaccess.c File Reference
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "fsaccess.h"
#include "compiler.h"
#include "file.h"
#include "navigation.h"
#include "ctrl_access.h"
+ Include dependency graph for fsaccess.c:

Go to the source code of this file.

Functions

int open (const char *pathname, int flags,...)
 Mutex to access the File System.
size_t fsaccess_file_get_size (int fd)
 This function returns the opened file size.
ssize_t read (int fd, void *buf, size_t count)
 This function reads from a file.
ssize_t write (int fd, const void *buf, size_t count)
 This function writes to a file.
int close (int fd)
 This function closes a file.
long fsaccess_alloc_nav_id (void)
 This function returns a free navigator id.
void fsaccess_free_nav_id (int fd)
 This function frees a navigator id.
bool b_fsaccess_init (void)
 This function initializes mutex and navigators.
void fsaccess_take_mutex (void)
 This function gives the mutex to the caller.
void fsaccess_give_mutex (void)
 This function frees the mutex.
int8_t fsaccess_IsDirPresent (const char *pcStringDirName)
 Is a directory present?

Variables

static unsigned int pvNavUsed = 0
 bitfield for navigator currently used. bit[0..31] is 1 if used, 0 if not.

Function Documentation

bool b_fsaccess_init ( void  )

Definition at line 333 of file fsaccess.c.

int close ( int  fd)
Parameters:
fdfile descriptor.
Returns:
int : -1 if error, 0 otherwise

Definition at line 273 of file fsaccess.c.

long fsaccess_alloc_nav_id ( void  )
Returns:
long : Id navigator allocated or -1 if none free

Definition at line 300 of file fsaccess.c.

size_t fsaccess_file_get_size ( int  fd)
Parameters:
fdfile descriptor.
Returns:
size_t : size of the file pointed to by the descriptor

Definition at line 181 of file fsaccess.c.

void fsaccess_free_nav_id ( int  fd)
Parameters:
fdfile descriptor.

Definition at line 324 of file fsaccess.c.

void fsaccess_give_mutex ( void  )

Definition at line 364 of file fsaccess.c.

int8_t fsaccess_IsDirPresent ( const char *  pcStringDirName)
Parameters:
pcStringDirNameInput. Directory name string.
Returns:
1 if the directory exists, 0 if the directory doesn't exist, else -1

Definition at line 380 of file fsaccess.c.

void fsaccess_take_mutex ( void  )

Definition at line 353 of file fsaccess.c.

int open ( const char *  pathname,
int  flags,
  ... 
)

This function opens a file.

This function opens a file.

Parameters:
pathnamepath of the file to open.
flagsflags to give file access rights should be O_CREAT : create file if not exist O_APPEND : add data to the end of file O_RDONLY : Read Only O_WRONLY : Write Only O_RDWR : Read/Write
Returns:
int : file descriptor (>= 0 if OK (NavID), -1 otherwise)

Definition at line 106 of file fsaccess.c.

ssize_t read ( int  fd,
void *  buf,
size_t  count 
)
Parameters:
fdfile descriptor.
bufpointer for data that are read.
countamount of bytes to read
Returns:
ssize_t : amount of data read (-1 if error)

Definition at line 209 of file fsaccess.c.

ssize_t write ( int  fd,
const void *  buf,
size_t  count 
)
Parameters:
fdfile descriptor.
bufpointer from where data are written.
countamount of bytes to write
Returns:
ssize_t : amount of data written (-1 if error)

Definition at line 246 of file fsaccess.c.


Variable Documentation

unsigned int pvNavUsed = 0
static

Definition at line 86 of file fsaccess.c.