IDZEBRA  2.2.7
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

◆ CFILE_STATE_FLAT

#define CFILE_STATE_FLAT   2

state of CFile is a flat file file

Definition at line 54 of file cfile.h.

◆ CFILE_STATE_HASH

#define CFILE_STATE_HASH   1

state of CFile is a hash structure

Definition at line 51 of file cfile.h.

◆ HASH_BSIZE

#define HASH_BSIZE   sizeof(struct CFile_ph_bucket)

Definition at line 48 of file cfile.h.

◆ HASH_BUCKET

#define HASH_BUCKET   15

number of blocks in hash bucket

Definition at line 30 of file cfile.h.

Typedef Documentation

◆ CFile

typedef struct CFile_struct * CFile

All in-memory information per CFile.

Function Documentation

◆ cf_close()

int cf_close ( CFile  cf)

◆ cf_commit()

int cf_commit ( CFile  cf)

◆ cf_open()

CFile cf_open ( MFile  mf,
MFile_area  area,
const char *  fname,
int  block_size,
int  wflag,
int *  firstp 
)

◆ cf_read()

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 542 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().

◆ cf_write()

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 579 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().