GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QCFG / V1-1-3 > qcfg / sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

QCFG_fio.c File Reference

Wrapper functions to FBS calls for opening/creating a file. More...

#include <QCFG_p.h>
#include <QCFG/QCFG_msgs.h>
#include <MSG/MSG_pubdefs.h>
#include <FBS/FBS_pubrtos.h>
#include <PBS/BSWP.h>
#include <fcntl.h>
#include <unistd.h>

Functions

unsigned QCFG_fioCreate (QCFG_fileParm *fParm, const char *name)
 Create a file.
unsigned QCFG_fioOpen (QCFG_fileParm *fParm, const char *name)
 Open a file for reading.
unsigned QCFG_fioClose (QCFG_fileParm *fParm)
 Close a file.
unsigned QCFG_fioReadRecd (void *parm, unsigned *type, int *leng)
 Read a record header.
unsigned QCFG_fioReadData (void *parm, int iShrt, void *data, int leng, int *rLeng)
 Read record data.
unsigned QCFG_fioWriteRecd (void *parm, unsigned type, int leng)
 Write a record header.
unsigned QCFG_fioWriteData (void *parm, void *data, int leng)
 Write record data.


Detailed Description

Wrapper functions to FBS calls for opening/creating a file.

Author:
James Swain & Owen Saxton
$Id: QCFG_fio.c,v 1.6 2011/03/29 21:47:53 saxton Exp $

Function Documentation

unsigned QCFG_fioClose ( QCFG_fileParm fParm  ) 

Close a file.

Parameters:
fParm The address of the file parameter block
Return values:
QCFG_SUCCESS Success
QCFG_BADCLOSE The file close failed

References _QCFG_fileParm::fd, and _QCFG_fileParm::name.

Referenced by QCFG_consume(), QCFG_consumeMap(), QCFG_create(), and QCFG_createMap().

unsigned QCFG_fioCreate ( QCFG_fileParm fParm,
const char *  name 
)

Create a file.

This routine creates a new file and writes version information. If the file already exists, it is overwritten.

Parameters:
fParm Pointer to the file parameter block
name Full pathname of the file to open
Return values:
QCFG_SUCCESS Success
QCFG_BADFOPEN The file failed to open
QCFG_BADWRITE Writing the version information failed

References _QCFG_fileParm::fd, _QCFG_fileParm::leng, _QCFG_fileParm::name, _QCFG_fileParm::status, and _QCFG_fileParm::versn.

Referenced by QCFG_create(), and QCFG_createMap().

unsigned QCFG_fioOpen ( QCFG_fileParm fParm,
const char *  name 
)

Open a file for reading.

This routine opens a file for reading and verifies the version information.

Parameters:
fParm Pointer to the file parameter block
name Full pathname of the file to open
Return values:
QCFG_SUCCESS Success
QCFG_BADFOPEN File couldn't be opened
QCFG_FILESHRT Partial or no version header was read
QCFG_BADREAD An error occurred while reading the version

References _QCFG_fileParm::fd, _QCFG_fileParm::leng, _QCFG_fileParm::name, _QCFG_fileParm::status, and _QCFG_fileParm::versn.

Referenced by QCFG_consume(), and QCFG_consumeMap().

unsigned QCFG_fioReadData ( void *  parm,
int  iShrt,
void *  data,
int  leng,
int *  rLeng 
)

Read record data.

This routine, designed to work in conjunction with RIM_import, reads data from an open file, making sure that it will not overflow the current record.

Parameters:
parm The address of the file parameter block
iShrt If TRUE, ignore any short record error.
data The address of the area to receive the data read.
leng The number of bytes of data to read.
rLeng The address of an integer to receive the number of bytes actually read.
Return values:
QCFG_SUCCESS Success
QCFG_RECDSHRT Requested read extends beyond end of record
QCFG_FILESHRT Requested read extends beyond EOF
QCFG_BADREAD A read error occurred

References _QCFG_fileParm::fd, _QCFG_fileParm::leng, _QCFG_fileParm::name, and _QCFG_fileParm::status.

Referenced by QCFG_consume(), and QCFG_consumeMap().

unsigned QCFG_fioReadRecd ( void *  parm,
unsigned *  type,
int *  leng 
)

Read a record header.

This routine, designed to work in conjunction with RIM_import, reads the next record header from an open file.

Parameters:
parm The address of the file parameter block
type The address of an integer to receive the record type.
leng The address of an integer to receive the record length, in bytes. This is set to 0 if EOF was reached, or to -1 for other error conditions.
Return values:
QCFG_SUCCESS Success
QCFG_EOFREAD End of file was reached
QCFG_FILESHRT Partial header was read
QCFG_BADREAD A read error occurred

References _QCFG_fileParm::fd, _QCFG_fileParm::leng, _QCFG_fileParm::name, and _QCFG_fileParm::status.

Referenced by QCFG_consume(), and QCFG_consumeMap().

unsigned QCFG_fioWriteData ( void *  parm,
void *  data,
int  leng 
)

Write record data.

This routine, designed to work in conjunction with RIM_export, writes data to an open file, checking that it will not overflow the current record.

Parameters:
parm The address of the file parameter block
data The address of the data to write.
leng The number of bytes of data to write.
Return values:
QCFG_SUCCESS Success
QCFG_RECDOFL Requested export overflows record
QCFG_BADWRITE A write error occurred

References _QCFG_fileParm::fd, _QCFG_fileParm::leng, _QCFG_fileParm::name, and _QCFG_fileParm::status.

Referenced by QCFG_create(), and QCFG_createMap().

unsigned QCFG_fioWriteRecd ( void *  parm,
unsigned  type,
int  leng 
)

Write a record header.

This routine, designed to work in conjunction with RIM_export, writes a new record header to an open file, checking that the previous record was completely filled.

Parameters:
parm The address of the file parameter block
type The record type (must be < 256).
leng The record length, in bytes (must be < 2 ** 24).
Return values:
QCFG_SUCCESS Success
QCFG_BADWRITE A write error occurred

References _QCFG_fileParm::fd, _QCFG_fileParm::leng, _QCFG_fileParm::name, and _QCFG_fileParm::status.

Referenced by QCFG_create(), and QCFG_createMap().


Generated on Wed Nov 21 22:35:53 2012 by  doxygen 1.5.8