GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSD / dev > qsu / linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

QFR_file.c File Reference

Facilty to resolve and manage dynamically mapped files. More...

#include <QSD/QFR_file.h>
#include <LSE/LFR_key.h>
#include <FMX/FMX_pubdefs.h>
#include <MSG/MSG_macdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Classes

struct  _QFR_fileRoots
 Holds onto the production, development and user file roots. More...
struct  _QFR_fileCtx
 The context for the file resolution facility. More...
struct  _QFR_scanConditions
 The specification of the conditions to be met to satisfy a file scan. More...
struct  _QFR_scanResults
 The specification of the results of the scan scan. More...
struct  _QFR_scanCtx
 The context to resolve a FMX_scanFilesByKey scan. More...

Typedefs

typedef struct _QFR_fileRoots QFR_fileRoots
 Typedef for struct _QFR_fileRoots.
typedef struct _QFR_fileCtx QFR_fileCtx
typedef struct _QFR_scanConditions QFR_scanConditions
 Typedef for struct _QFR_scanConditions.
typedef struct _QFR_scanResults QFR_scanResults
 Typedef for struct _QFR_scanResults.
typedef struct _QFR_scanCtx QFR_scanCtx
 Typedef for struct _QFR_scanCtx.

Functions

static const char * translate (const char *facility, const char *area)
 Translates the environment variable whose name looks like <facility>_<area>.
static unsigned int size (const char *root, const char *facility, const char *area)
 Gets the size, in bytes of the file root.
static const char * translatem (const char *def, const char *const *facilities, const char *area)
 Translates the environment variable whose name looks like <facility>_<area>.
static unsigned int sizem (const char *root, const char *def, const char *const *facilities, const char *area)
 Gets the size, in bytes of the file root.
int QFR_fileCtxSizeof (const QFR_fileCfg *cfg)
 Returns the size in bytes need to hold the file resolution context.
static int connect (FMX_Connection **fmx)
 Performs the one-time initialization and connection.
static int cmx_resolve (QFR_fileCtx *ctx, unsigned int key, const char *dirName, const char *fileName, char *name, unsigned int nameLen)
static unsigned int scan (QFR_scanCtx *ctx, unsigned int key, const char *dir, FMX_FileGroup group, unsigned int flight, unsigned int visible, const char *tag, unsigned int index, unsigned int size, const char *date, const char *fname, const char *pkg, const char *ver, const char *con, FMX_CaptureModule captured, unsigned int contents, unsigned int count, const unsigned int *dat)
static unsigned int resolve (QFR_fileCtx *ctx, unsigned int key, const char *dirName, const char *fileName, char *name, unsigned int nameLen, FMX_FileGroup group)
void * QFR_fileCtxConstruct (QFR_fileCtx *ctx, const QFR_fileCfg *cfg)
 Constructs the file resolution translation context.
int QFR_fileResolve (QFR_fileCtx *ctx, unsigned int key, const char *dirName, const char *fileName, char *name, unsigned int nameLen)
int QFR_cdmResolve (QFR_fileCtx *ctx, unsigned int key, const char *dirName, const char *fileName, char *name, unsigned int nameLen)
 Resolves a CDM file key.
int QFR_fofResolve (QFR_fileCtx *ctx, unsigned int key, const char *dirName, const char *fileName, char *name, unsigned int nameLen)
 Resolves a FOF (file of file) file key.
int QFR_latcResolve (QFR_fileCtx *ctx, unsigned int key, const char *dirName, const char *fileName, char *name, unsigned int nameLen)
 Resolves a LATc file key.
int QFR_sbsResolve (QFR_fileCtx *ctx, unsigned int key, const char *dirName, const char *fileName, char *name, unsigned int nameLen)
 Resolves a SBS (secondary boot script) file key.
const char * QFR_rootGet (const QFR_fileCtx *ctx, QFR_fileRoot which)
 Returns the requested root.
int QFR_compose (const QFR_fileCtx *ctx, char *name, int namelen, QFR_fileRoot which, const char *nam, const char *prj, const char *pkg, const char *ver, const char *cons)

Variables

static const char Host [] = CMX_TAG
static const char Suffixes [4][8]
 The suffix of the environment variables.
static const char DefaultRoot [] = "GFSROOT"
static const char TestRoot [] = "GFSUROOT"
static const char * Facilities [] = { "QSD", NULL }
static const QFR_fileCfg CfgDefault


Detailed Description

Facilty to resolve and manage dynamically mapped files.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: QFR_file.c,v 1.6 2011/03/26 21:06:58 russell Exp $

Function Documentation

static int connect ( FMX_Connection **  fmx  )  [static]

Performs the one-time initialization and connection.

Returns:
Status
Parameters:
fmx The FMX connection handle

Referenced by QFR_cdmResolve().

int QFR_cdmResolve ( QFR_fileCtx ctx,
unsigned int  key,
const char *  dirName,
const char *  fileName,
char *  name,
unsigned int  nameLen 
)

Resolves a CDM file key.

Returns:
Status
Parameters:
ctx The QFR context handle
key The LFR file key
dirName The directory root, used if and only if the key is a CMX-style key.
fileName The file name, used if and only if the key is a CMX-style key.
name Buffer to receive the fully resolved file name
nameLen The size of the name buffer

References connect(), and _QFR_fileCtx::fmx.

void * QFR_fileCtxConstruct ( QFR_fileCtx ctx,
const QFR_fileCfg cfg 
)

Constructs the file resolution translation context.

Returns:
Pointer to the next location
Parameters:
ctx The context to construct
cfg The configuration

References _QFR_fileCfg::facilities, _QFR_fileCtx::fmx, _QFR_fileRoots::len, _QFR_fileRoots::nam, _QFR_fileCfgStems::prd, QFR_FILEROOT_K_FMX, QFR_FILEROOT_K_PROD, QFR_FILEROOT_K_TEST, _QFR_fileCtx::roots, _QFR_fileCfg::stems, Suffixes, and translatem().

int QFR_fileCtxSizeof ( const QFR_fileCfg cfg  ) 

Returns the size in bytes need to hold the file resolution context.

Parameters:
cfg The file resolution configuration

References _QFR_fileCfgStems::dev, _QFR_fileCfg::facilities, _QFR_fileCfgStems::prd, size(), sizem(), _QFR_fileCfg::stems, Suffixes, and _QFR_fileCfgStems::tst.

int QFR_fofResolve ( QFR_fileCtx ctx,
unsigned int  key,
const char *  dirName,
const char *  fileName,
char *  name,
unsigned int  nameLen 
)

Resolves a FOF (file of file) file key.

Returns:
Status
Parameters:
ctx The QFR context handle
key The LFR file key
dirName The directory root, used if and only if the key is a CMX-style key.
fileName The file name, used if and only if the key is a CMX-style key.
name Buffer to receive the fully resolved file name
nameLen The size of the name buffer

int QFR_latcResolve ( QFR_fileCtx ctx,
unsigned int  key,
const char *  dirName,
const char *  fileName,
char *  name,
unsigned int  nameLen 
)

Resolves a LATc file key.

Returns:
Status
Parameters:
ctx The QFR context handle
key The LFR file key
dirName The directory root, used if and only if the key is a CMX-style key.
fileName The file name, used if and only if the key is a CMX-style key.
name Buffer to receive the fully resolved file name
nameLen The size of the name buffer

const char * QFR_rootGet ( const QFR_fileCtx ctx,
QFR_fileRoot  which 
)

Returns the requested root.

Returns:
Pointer to the requested root or NULL if either an invalid root is requested or the root is non-existent
Parameters:
ctx The file resolution context
which Which root

References _QFR_fileRoots::nam, QFR_FILEROOT_K_TEST, and _QFR_fileCtx::roots.

int QFR_sbsResolve ( QFR_fileCtx ctx,
unsigned int  key,
const char *  dirName,
const char *  fileName,
char *  name,
unsigned int  nameLen 
)

Resolves a SBS (secondary boot script) file key.

Returns:
Status
Parameters:
ctx The QFR context handle
key The LFR file key
dirName The directory root, used if and only if the key is a CMX-style key.
fileName The file name, used if and only if the key is a CMX-style key.
name Buffer to receive the fully resolved file name
nameLen The size of the name buffer

static unsigned int size ( const char *  root,
const char *  facility,
const char *  area 
) [static]

Gets the size, in bytes of the file root.

Returns:
The size, in bytes, of the file root
Parameters:
root User specified root
facility If root is NULL, then an environment variable of the form <facility><area> is constructed and a translation on it is attempted.
area The area (_F_PROD, _F_DEV, _F_TEST)

References translate().

Referenced by QFR_fileCtxSizeof(), and sizem().

static unsigned int sizem ( const char *  root,
const char *  def,
const char *const *  facilities,
const char *  area 
) [static]

Gets the size, in bytes of the file root.

Returns:
The size, in bytes, of the file root
Parameters:
root User specified root
def The name of environment variable giving the root To be used if the other translation fails.
facilities If root is NULL, then an environment variable of the form <facility><area> is constructed and a translation on it is attempted. Facilities contains an array of N facility names that are search for a translation. This array must be NULL-terminated
area The area (_F_PROD, _F_DEV, _F_TEST)

References size().

Referenced by QFR_fileCtxSizeof().

static const char * translate ( const char *  facility,
const char *  area 
) [static]

Translates the environment variable whose name looks like <facility>_<area>.

Returns:
Pointer to the translated environment variable

Referenced by size(), and translatem().

static const char * translatem ( const char *  def,
const char *const *  facilities,
const char *  area 
) [static]

Translates the environment variable whose name looks like <facility>_<area>.

Returns:
Pointer to the translated environment variable
Parameters:
def The name of an environment variable giving the default root.
facilities A NULL-terminated array ofstring pointers giving the search list
area The area (PROD, DEV, or TEST)

References translate().

Referenced by QFR_fileCtxConstruct().


Variable Documentation

const QFR_fileCfg CfgDefault [static]

Initial value:

 
{ 
    Facilities,
    {NULL, NULL, NULL }
}

const char Suffixes[3] [static]

Initial value:

 
{ 
    "_C_FDB",
    "_F_PROD",
    "_F_DEV",
    "_F_TEST"
}
The suffix of the environment variables.

The full name of the environment variable is formed by appending the suffix to the facility name.

Referenced by QFR_fileCtxConstruct(), and QFR_fileCtxSizeof().


Generated on Sat Mar 26 14:08:24 2011 by  doxygen 1.5.8