GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCFG / V1-2-5 > lcfg / rhel6-64


Interface   Data Structures   File List   Data Fields   Globals  

LCFG_consume.c File Reference

Functions for populating RIM structures from files. More...

#include <LCFG_p.h>
#include <LCFG/LCFG_msgs.h>
#include <RIM/RIM.h>
#include <RIM/RIM_msgs.h>
#include <FBS/FBS_pubrtos.h>
#include <MSG/MSG_pubdefs.h>
#include <PBS/BSWP.h>
#include <fcntl.h>
#include <unistd.h>

Classes

struct  _fileParm
 Parameter block for file operations. More...

Typedefs

typedef struct _fileParm fileParm
 Parameter block for file operations.

Enumerations

enum  { FIO_NAME_SIZE = FILE_PATH_STR_SIZE_USR }

Functions

static unsigned fileOpen (fileParm *fParm, const char *name)
 Open a file for reading.
static unsigned fileClose (fileParm *fParm)
 Close a file.
static unsigned fileKey (fileParm *fParm)
 Return the key for a file.
static unsigned fileReadData (void *parm, int iShrt, void *data, int leng, int *rLeng)
 Read record data.
static unsigned fileReadRecd (void *parm, unsigned *type, int *leng)
 Read a record header.
unsigned LCFG_consumeMap (RIM_map *map, unsigned fid, unsigned *key)
 Read map data.
unsigned LCFG_consume (RIM *rim, unsigned lcm, unsigned *key)
 Read configuration data.


Detailed Description

Functions for populating RIM structures from files.

Author:
James Swain & Owen Saxton
Id
LCFG_consume.c,v 1.5 2011/03/27 17:13:33 saxton Exp

Function Documentation

unsigned fileClose ( fileParm fParm  )  [static]

Close a file.

Parameters:
fParm The address of the file parameter block
Return values:
LCFG_SUCCESS Success
LCFG_BADCLOSE The file close failed

References _fileParm::fd, and _fileParm::name.

Referenced by LCFG_consume(), and LCFG_consumeMap().

unsigned fileKey ( fileParm fParm  )  [static]

Return the key for a file.

Parameters:
fParm Address of file parameter block
Returns:
The key for this file

References _fileParm::fd.

Referenced by LCFG_consumeMap().

unsigned fileOpen ( fileParm fParm,
const char *  name 
) [static]

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:
LCFG_SUCCESS Success
LCFG_BADFOPEN File couldn't be opened
LCFG_FILESHRT Partial or no version header was read
LCFG_BADREAD An error occurred while reading the version

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

Referenced by LCFG_consume(), and LCFG_consumeMap().

unsigned fileReadData ( void *  parm,
int  iShrt,
void *  data,
int  leng,
int *  rLeng 
) [static]

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:
LCFG_SUCCESS Success
LCFG_RECDSHRT Requested read extends beyond end of record
LCFG_FILESHRT Requested read extends beyond EOF
LCFG_BADREAD A read error occurred

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

Referenced by LCFG_consume(), and LCFG_consumeMap().

unsigned fileReadRecd ( void *  parm,
unsigned *  type,
int *  leng 
) [static]

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:
LCFG_SUCCESS Success
LCFG_EOFREAD End of file was reached
LCFG_FILESHRT Partial header was read
LCFG_BADREAD A read error occurred

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

Referenced by LCFG_consume(), and LCFG_consumeMap().

unsigned LCFG_consume ( RIM *  rim,
unsigned  lcm,
unsigned *  key 
)

Read configuration data.

This routine reads a configuration master file then reads each file in the master file into a RIM structure.

Parameters:
rim Pointer to the RIM to repopulate with the configuration information
lcm File ID of the LAT configuration master file
key Pointer to location to place the key of file lcm
Return values:
LCFG_SUCCESS if all goes well
LCFG_BADFOPEN if the fid, or any of the names the configuration master file contains, does not match a valid file.
LCFG_BADTYPE if the file contains a bad type identifier
LCFG_BADREAD if an error occurs whilst the file is being read

References fileClose(), fileOpen(), fileReadData(), fileReadRecd(), _fileParm::name, and _fileParm::versn.

Referenced by LCFG_cache().

unsigned LCFG_consumeMap ( RIM_map *  map,
unsigned  fid,
unsigned *  key 
)

Read map data.

This routine reads a map data file into a map structure.

Parameters:
map Map structure to populate from file
fid ID of the file containing the data to use
key Pointer to location to place the key of file fid
Return values:
LCFG_SUCCESS if all goes well
LCFG_BADFOPEN if the fid does not match a valid file
LCFG_BADREAD if an error occurs whilst the file is being read

References fileClose(), fileKey(), fileOpen(), fileReadData(), fileReadRecd(), _fileParm::name, and _fileParm::versn.

Referenced by LCFG_ignore().


Generated on Tue Nov 29 16:48:09 2011 by  doxygen 1.5.8