GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LCFG / V1-2-3

Constituent: lcfg     Tag: mv2304


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>

Include dependency graph for LCFG_consume.c:


Data Structures

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

Typedefs

typedef _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.4 2009/01/29 23:54:51 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

unsigned fileKey fileParm fParm  )  [static]
 

Return the key for a file.

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

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

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

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

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

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


Generated on Wed Apr 22 01:15:25 2009 by  doxygen 1.4.4