libjf API reference guide

Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

jf_journal_file_tab.c File Reference

#include <jf/jf_config.h>
#include <jf/jf_errors.h>
#include <jf/jf_journal_file_tab.h>
#include <jf/jf_crash_simul.h>
#include <jf_journal.h>

Go to the source code of this file.

Defines

#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_JOURNAL_FILE_TAB

Functions

int jf_journal_file_tab_add (jf_journal_file_tab_t *jft, const jf_journal_file_t *jf, jf_word_t *id)
void jf_journal_file_tab_create (jf_journal_file_tab_t *jft)
int jf_journal_file_tab_del (jf_journal_file_tab_t *jft, jf_word_t id)
void jf_journal_file_tab_destroy (jf_journal_file_tab_t *jft)
int jf_journal_file_tab_dump (const jf_journal_file_tab_t *jft, FILE *stream, jf_word_t flags, jf_word_t id)
int jf_journal_file_tab_init (jf_journal_file_tab_t *jft, jf_word_t max_files)
int jf_journal_file_tab_restore (jf_journal_file_tab_t *jft, FILE *stream)
int jf_journal_file_tab_search (const jf_journal_file_tab_t *jft, const char *path, jf_word_t *pos)
int jf_journal_file_tab_trace (const jf_journal_file_tab_t *jft, const char *method, FILE *out_stream)


Define Documentation

#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_JOURNAL_FILE_TAB
 

Definition at line 45 of file jf_journal_file_tab.c.


Function Documentation

int jf_journal_file_tab_add jf_journal_file_tab_t jft,
const jf_journal_file_t jf,
jf_word_t id
 

Add a new file path to journaled file table

Parameters:
jft IN/OUT journaled file table object
jf IN the journaled file must be added to table; NOTE: the journaled file added must NOT be destroyed after this method because it will automatically destroyed by jf_journal_file_tab_destroy
id OUT the identificator of the added file (meaningless if return code is NOT JF_RC_OK )
Returns:
a reason code
Definition at line 111 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_tab_t::files, JF_RC_CONTAINER_FULL, JF_RC_INTERNAL_ERROR, JF_RC_OK, JF_TRACE, jf_word_t, jf_journal_file_tab_t::max_files, jf_journal_file_tab_t::number_of_files, and THROW.

Referenced by jf_journal_attach_file(), and jf_journal_create().

void jf_journal_file_tab_create jf_journal_file_tab_t jft  ) 
 

Reset a journaled file table

Parameters:
jft OUT journaled file table object
Definition at line 49 of file jf_journal_file_tab.c.

References jf_journal_file_tab_t::files, jf_journal_file_tab_t::max_files, and jf_journal_file_tab_t::number_of_files.

Referenced by jf_journal_create(), and jf_journal_load().

int jf_journal_file_tab_del jf_journal_file_tab_t jft,
jf_word_t  id
 

Remove a journaled file from table

Parameters:
jft IN/OUT journaled file table object
id IN identificator of the journaled file must be removed
Returns:
a reason code
Definition at line 149 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_tab_t::files, JF_RC_INTERNAL_ERROR, JF_RC_NULL_OBJECT, JF_RC_OK, JF_RC_OUT_OF_RANGE, JF_TRACE, jf_word_t, jf_journal_file_tab_t::number_of_files, and THROW.

Referenced by jf_journal_util_leave().

void jf_journal_file_tab_destroy jf_journal_file_tab_t jft  ) 
 

Release a journaled file table

Parameters:
jft OUT journaled file table object
Definition at line 58 of file jf_journal_file_tab.c.

References jf_journal_file_tab_t::files, jf_journal_file_destroy(), jf_word_t, jf_journal_file_tab_t::max_files, and jf_journal_file_tab_t::number_of_files.

Referenced by jf_journal_close(), jf_journal_create(), and jf_journal_load().

int jf_journal_file_tab_dump const jf_journal_file_tab_t jft,
FILE *  stream,
jf_word_t  flags,
jf_word_t  id
 

Dump the content of a journaled file table to a valid stream

Parameters:
jft IN journaled file table object
stream IN/OUT output file stream
flags IN what must be dumped (bitwise or) of JF_JOURNAL_FILE_TAB_SIZE, JF_JOURNAL_FILE_TAB_PATH, JF_JOURNAL_FILE_TAB_CTRL
id IN the identificator of the journaled file must be dumped, the special value JF_JOURNAL_GLOBAL_FILE_ID should be used for a complete dump (all entries)
Returns:
a reason code
Definition at line 193 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_t::file_path, jf_journal_file_tab_t::files, fseeko, JF_JOURNAL_FILE_MAX_PATH_SIZE, JF_JOURNAL_FILE_TAB_CTRL, JF_JOURNAL_FILE_TAB_PATH, JF_JOURNAL_FILE_TAB_SIZE, JF_JOURNAL_GLOBAL_FILE_ID, JF_RC_FPUTC_ERROR, JF_RC_FSEEK_ERROR, JF_RC_FWRITE_ERROR, JF_RC_INTERNAL_ERROR, JF_RC_OK, JF_TRACE, jf_word_t, JF_WORD_T_FORMAT, jf_journal_file_t::last_pos, jf_journal_file_t::last_size, jf_journal_file_tab_t::max_files, jf_journal_file_tab_t::number_of_files, jf_journal_file_t::status, and THROW.

Referenced by jf_journal_create(), and jf_journal_update_file_table().

int jf_journal_file_tab_init jf_journal_file_tab_t jft,
jf_word_t  max_files
 

Initialize a journaled file table for usage

Parameters:
jft OUT journaled file table object
max_files IN max number of files can be stored in the table
Returns:
a reason code
Definition at line 73 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_tab_t::files, JF_RC_INTERNAL_ERROR, JF_RC_MALLOC_ERROR, JF_RC_OK, JF_TRACE, jf_word_t, jf_journal_file_tab_t::max_files, and THROW.

Referenced by jf_journal_create(), and jf_journal_file_tab_restore().

int jf_journal_file_tab_restore jf_journal_file_tab_t jft,
FILE *  stream
 

Restore the content of a journaled file table from a valid stream

Parameters:
jft IN/OUT journaled file table object
stream IN input file stream
Returns:
a reason code
Definition at line 339 of file jf_journal_file_tab.c.

References jf_journal_file_t::cache_file, CATCH, jf_journal_file_t::file_path, jf_journal_file_tab_t::files, jf_cache_file_create(), JF_JOURNAL_FILE_MAX_PATH_SIZE, jf_journal_file_set_stream(), jf_journal_file_tab_init(), jf_journal_file_tab_is_void(), JF_JOURNAL_JOURNAL_FILE_ID, JF_RC_FREAD_ERROR, JF_RC_INTERNAL_ERROR, JF_RC_MALLOC_ERROR, JF_RC_OBJ_NOT_VOID, JF_RC_OK, JF_TRACE, jf_word_t, jf_journal_file_t::last_pos, jf_journal_file_t::last_size, jf_journal_file_tab_t::max_files, jf_journal_file_tab_t::number_of_files, jf_journal_file_t::status, and THROW.

Referenced by jf_journal_load().

int jf_journal_file_tab_search const jf_journal_file_tab_t jft,
const char *  path,
jf_word_t pos
 

Look for a path in a file table: if found, the position will be stored in "pos", else a JF_RC_OBJ_NOT_FOUND reason code is returned

Parameters:
jft IN journaled file table object
path IN file name must be searched in the journaled file table
pos OUT file name position in the file table (meaningless if returned reason code is not JF_RC_OK)
Returns:
a reason code ( JF_RC_OBJ_NOT_FOUND if "path" is not in "jft")
Definition at line 453 of file jf_journal_file_tab.c.

References CATCH, jf_journal_file_t::file_path, jf_journal_file_tab_t::files, JF_JOURNAL_FIRST_FILE_ID, JF_RC_INTERNAL_ERROR, JF_RC_OBJ_NOT_FOUND, JF_RC_OK, JF_TRACE, jf_word_t, jf_journal_file_tab_t::number_of_files, and THROW.

Referenced by jf_journal_attach_file(), jf_journal_open_attach_file(), jf_journal_util_leave(), and jf_journal_util_rename().

int jf_journal_file_tab_trace const jf_journal_file_tab_t jft,
const char *  method,
FILE *  out_stream
 

Trace journal file table content to stream

Parameters:
jft IN journal file table object
method IN method name
out_stream IN output stream (i.e. stderr)
Returns:
0
Definition at line 493 of file jf_journal_file_tab.c.

References jf_journal_file_tab_t::files, jf_journal_file_get_path(), JF_OFFSET_T_FORMAT, jf_word_t, jf_journal_file_tab_t::max_files, and jf_journal_file_tab_t::number_of_files.

Referenced by jf_journal_trace().


Copyright 2005 © Tiian