libjf API reference guide

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

jf_journal_file.c File Reference

#include <jf/jf_config.h>
#include <jf/jf_errors.h>
#include <jf/jf_journal_file.h>

Go to the source code of this file.

Defines

#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_JOURNAL_FILE

Functions

void jf_journal_file_create (jf_journal_file_t *jf)
void jf_journal_file_destroy (jf_journal_file_t *jf)
int jf_journal_file_init (jf_journal_file_t *jf, const char *path, FILE *stream, uint32_t open_mode, const struct jf_journal_file_opts_s *options)
void jf_journal_file_reset (jf_journal_file_t *jf)
int jf_journal_file_set_cache_file (jf_journal_file_t *jf, const jf_cache_file_t *cf)
int jf_journal_file_set_options (jf_journal_file_t *jf, const struct jf_journal_file_opts_s *options)
int jf_journal_file_set_path (jf_journal_file_t *jf, const char *new_path)


Define Documentation

#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_JOURNAL_FILE
 

Definition at line 43 of file jf_journal_file.c.


Function Documentation

void jf_journal_file_create jf_journal_file_t jf  ) 
 

Create a journaled file object: this is the FIRST method should be invoked before using a journaled file object Definition at line 57 of file jf_journal_file.c.

References jf_journal_file_t::cache_file, and jf_cache_file_create().

Referenced by jf_journal_create(), and jf_journal_open_attach_file().

void jf_journal_file_destroy jf_journal_file_t jf  ) 
 

Destroy a journaled file object: this is the LAST method should be invoked on a journaled file object; memory leak may happen if destruction is not performed Definition at line 64 of file jf_journal_file.c.

References jf_journal_file_t::cache_file, jf_journal_file_t::file_path, and jf_cache_file_destroy().

Referenced by jf_journal_file_tab_destroy().

int jf_journal_file_init jf_journal_file_t jf,
const char *  path,
FILE *  stream,
uint32_t  open_mode,
const struct jf_journal_file_opts_s options
 

Initialize a journaled file object

Parameters:
jf OUT journaled file object
path IN journaled file path name
stream IN standard I/O stream associated to journaled file "path"
open_mode IN open mode stream flags
options IN stuff may be passed to tune specific values; it can be a NULL pointer (default options used)
Returns:
a reason code
Definition at line 73 of file jf_journal_file.c.

References jf_journal_file_t::all_in_cache, jf_journal_file_t::cache_file, jf_journal_file_opts_s::cache_size_limit, CATCH, jf_journal_file_t::file_path, jf_cache_file_init(), jf_journal_file_set_path(), JF_JOURNAL_FILE_ST_RESET, jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_OK, JF_TRACE, jf_journal_file_t::last_pos, jf_journal_file_t::last_size, jf_journal_file_t::last_uc_pos, jf_journal_file_t::last_uc_size, jf_journal_file_t::open_mode, jf_journal_file_t::status, jf_journal_file_t::stream, THROW, and TRUE.

Referenced by jf_journal_create(), and jf_journal_open_attach_file().

void jf_journal_file_reset jf_journal_file_t jf  ) 
 

Reset a journaled file object; NOTE: this is a PRIVATE method must NOT be used by end user application

Parameters:
jf OUT journaled file object
Definition at line 47 of file jf_journal_file.c.

References jf_journal_file_t::all_in_cache, jf_journal_file_t::cache_file, jf_journal_file_t::file_path, jf_cache_file_reset(), and TRUE.

int jf_journal_file_set_cache_file jf_journal_file_t jf,
const jf_cache_file_t cf
 

Set the cache file associated to a journaled file object

Parameters:
jf IN/OUT journaled file object
cf IN cache file object must be associated to journaled file; NOTE: the cache file object (cf) must NOT be destroyed after this method because a bit oriented copy is performed (no reallocation)
Returns:
a reason code
Definition at line 225 of file jf_journal_file.c.

References jf_journal_file_t::cache_file, CATCH, JF_RC_INTERNAL_ERROR, JF_RC_NULL_OBJECT, JF_RC_OK, JF_TRACE, and THROW.

Referenced by jf_journal_attach_file().

int jf_journal_file_set_options jf_journal_file_t jf,
const struct jf_journal_file_opts_s options
 

Set the options of a journaled file object

Parameters:
jf IN/OUT journaled file object
options IN new options for journaled file
Returns:
a reason code
Definition at line 190 of file jf_journal_file.c.

References jf_journal_file_t::cache_file, jf_journal_file_opts_s::cache_size_limit, CATCH, jf_cache_file_set_limit(), JF_RC_INTERNAL_ERROR, JF_RC_NULL_OBJECT, JF_RC_OK, JF_TRACE, and THROW.

int jf_journal_file_set_path jf_journal_file_t jf,
const char *  new_path
 

Set (new) path for a journaled file object

Parameters:
jf IN/OUT journaled file object
new_path IN (new) path must be assigned to journaled file
Returns:
a reason code
Definition at line 142 of file jf_journal_file.c.

References CATCH, jf_journal_file_t::file_path, JF_JOURNAL_FILE_MAX_PATH_SIZE, JF_RC_INTERNAL_ERROR, JF_RC_NULL_OBJECT, JF_RC_OK, JF_RC_REALLOC_ERROR, JF_TRACE, and THROW.

Referenced by jf_journal_file_init(), and jf_journal_util_rename().


Copyright 2005 © Tiian