IDZEBRA  2.1.2
Data Structures | Macros | Typedefs | Functions
cfile.h File Reference
#include <yaz/yconfig.h>

Go to the source code of this file.

Data Structures

struct  CFile_ph_bucket
 CFile hash structure on disc. More...
 
struct  CFile_hash_bucket
 CFile hash structure info in memory. More...
 
struct  CFile_head
 CFile file header. More...
 
struct  CFile_struct
 All in-memory information per CFile. More...
 

Macros

#define HASH_BUCKET   15
 number of blocks in hash bucket More...
 
#define HASH_BSIZE   sizeof(struct CFile_ph_bucket)
 
#define CFILE_STATE_HASH   1
 state of CFile is a hash structure More...
 
#define CFILE_STATE_FLAT   2
 state of CFile is a flat file file More...
 

Typedefs

typedef struct CFile_structCFile
 All in-memory information per CFile. More...
 

Functions

int cf_close (CFile cf)
 
CFile cf_open (MFile mf, MFile_area area, const char *fname, int block_size, int wflag, int *firstp)
 
int cf_read (CFile cf, zint no, int offset, int nbytes, void *buf)
 reads block from commit area More...
 
int cf_write (CFile cf, zint no, int offset, int nbytes, const void *buf)
 writes block to commit area More...
 
int cf_commit (CFile cf) ZEBRA_GCC_ATTR((warn_unused_result))
 

Macro Definition Documentation

#define CFILE_STATE_FLAT   2

state of CFile is a flat file file

Definition at line 54 of file cfile.h.

Referenced by cf_commit(), and cf_moveto_flat().

#define CFILE_STATE_HASH   1

state of CFile is a hash structure

Definition at line 51 of file cfile.h.

Referenced by cf_commit(), cf_moveto_flat(), and cf_open().

#define HASH_BSIZE   sizeof(struct CFile_ph_bucket)

Definition at line 48 of file cfile.h.

Referenced by cf_commit_flat(), cf_lookup_flat(), cf_open(), cf_write_flat(), read_head(), and write_head().

#define HASH_BUCKET   15

number of blocks in hash bucket

Definition at line 30 of file cfile.h.

Referenced by cf_commit_hash(), cf_lookup_hash(), cf_moveto_flat(), cf_new_hash(), and new_bucket().

Typedef Documentation

typedef struct CFile_struct * CFile

All in-memory information per CFile.

Function Documentation

int cf_close ( CFile  cf)
int cf_commit ( CFile  cf)
CFile cf_open ( MFile  mf,
MFile_area  area,
const char *  fname,
int  block_size,
int  wflag,
int *  firstp 
)
int cf_read ( CFile  cf,
zint  no,
int  offset,
int  nbytes,
void *  buf 
)

reads block from commit area

Parameters
cfcommit file
noblock number
offsetoffset in block
nbytesnumber of bytes to read
bufbuffer for content (if read was succesful)
Return values
0block could not be fully read
1block could be read
-1error

Definition at line 541 of file cfile.c.

References CFile_struct::block_mf, cf_lookup(), mf_read(), CFile_struct::mutex, zebra_mutex_lock(), zebra_mutex_unlock(), and ZINT_FORMAT.

Referenced by bf_read2().

int cf_write ( CFile  cf,
zint  no,
int  offset,
int  nbytes,
const void *  buf 
)

writes block to commit area

Parameters
cfcommit file
noblock number
offsetoffset in block
nbytesnumber of bytes to be written
bufbuffer to be written
Return values
0block written
-1error

Definition at line 578 of file cfile.c.

References CFile_struct::block_mf, cf_lookup(), cf_new(), CFile_struct::iobuf, mf_read(), mf_write(), CFile_struct::mutex, CFile_struct::rmf, zebra_mutex_lock(), and zebra_mutex_unlock().

Referenced by bf_write2().