GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LFS / V1-12-0

Constituent: lfs_lcp     Tag: mv2304


Interface   Data Structures   File List   Data Fields   Globals  

LFS_lcp_command.c File Reference

Routines associated with CCSDS commands to subsystem LFS. More...

#include "unistd.h"
#include "fcntl.h"
#include "errno.h"
#include "stdio.h"
#include "string.h"
#include "dirent.h"
#include "sys/stat.h"
#include "PBI/Endianness.h"
#include "PBS/WCT.h"
#include "PBS/SEM.h"
#include "PBS/WUT.h"
#include "MSG/MSG_pubdefs.h"
#include "CCSDS/CCSDS_pkt.h"
#include "ITC/ITC_pubdefs.h"
#include "LSF/LSF.h"
#include "LSF/LSF_ids.h"
#include "FBS/FBS_pubrtos.h"
#include "LFS/LFS_cmddefs.h"
#include "LFS/LFS_cmdxtrn.h"
#include "LFS/LFS_tlmdefs.h"
#include "LFS/LFS_msg.h"
#include "QLFS/QLFS.h"
#include "LFS_lcp_private.h"

Include dependency graph for LFS_lcp_command.c:


Defines

#define CREAT(_path, _mode)   creat((_path), 0666)
#define MKDIR(_path)   mkdir((_path), 0777)
#define STATFS(_path, _buf)   statfs((_path), (_buf))
#define DIR_EXISTS   (EEXIST)

Typedefs

typedef statfs STATFS_T

Functions

static unsigned int LFS_dumpDir (LFS_Control *ctl, DIR *directory, unsigned int cpu, unsigned int devNum, unsigned int dirNum, unsigned int xactId)
static unsigned int LFS_dumpRoot (LFS_Control *ctl, DIR *directory, unsigned int cpu, unsigned int devNum, unsigned int xactId)
static unsigned int LFS_dirEmpty (LFS_Control *ctl, unsigned int cpu, unsigned int devNum, unsigned int dirNum, unsigned int xactId)
unsigned int LFS_FileDelete (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSFILEDELETE command.
unsigned int LFS_FileCopy (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSFILECOPY command.
unsigned int LFS_DirCreate (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSDIRCREATE command.
unsigned int LFS_DirDelete (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSDIRDELETE command.
unsigned int LFS_FileDumpCTDB (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSFILEDUMPC command.
unsigned int LFS_FileDumpSSR (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSFILEDUMPS command.
unsigned int LFS_DirDump (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSDIRDUMP command.
unsigned int LFS_SysStatus (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSSYSSTATUS command.
unsigned int LFS_SysFormat (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSSYSFORMAT command.
unsigned int LFS_SysCheck (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSSYSCHECK command.
unsigned int LFS_SysRepair (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSSYSREPAIR command.
unsigned int LFS_SysMount (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSSYSMOUNT command.
unsigned int LFS_Noop (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Callback function for the LFSNOOP command.

Detailed Description

Routines associated with CCSDS commands to subsystem LFS.

Author:
D.L. Wood

Define Documentation

#define CREAT _path,
_mode   )     creat((_path), 0666)
 

Portable macro for creat() system call.

#define DIR_EXISTS   (EEXIST)
 

Portable errno value for directory overwrite protection.

#define MKDIR _path   )     mkdir((_path), 0777)
 

Portable macro for mkdir() system call.

#define STATFS _path,
_buf   )     statfs((_path), (_buf))
 

Portable call to statfs()/statvfs() system call.


Typedef Documentation

STATFS_T
 

Portable definition for statfs/statvfs structure.


Function Documentation

unsigned int LFS_DirCreate void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSDIRCREATE command.

After translating the target directory path, the directory is created.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_DirDelete void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSDIRDELETE command.

After translating the target directory path, the directory is deleted.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_DirDump void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSDIRDUMP command.

The target directory is opened for reading, and either LFS_dumpDir() or LFS_dumpRoot() is called to generate the telemetry response diagnostic packets.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

static unsigned int LFS_dirEmpty LFS_Control ctl,
unsigned int  cpu,
unsigned int  devNum,
unsigned int  dirNum,
unsigned int  xactId
[static]
 

Sends a single LLFSDIREMPTY telemetry packet to positively acknowledge a LFSDIRDUMP telecommand when the target root or sub directory is empty.

Parameters:
ctl LFS control structure.
cpu The LAT CPU unit number.
devNum The device number.
dirNum The directory number.
xactId The transaction ID.
Returns:
A LFS MSG code.

static unsigned int LFS_dumpDir LFS_Control ctl,
DIR *  directory,
unsigned int  cpu,
unsigned int  devNum,
unsigned int  dirNum,
unsigned int  xactId
[static]
 

Dumps the contents of a sub-directory into directory dump telemetry packets. The function is called in response to a LFSDIRDUMP telecommand when the directory number is not '127' (regular subdirectory). A series of LLFSDIRLIST telemetry packets is generated, one for each entry in the directory. Only regular files should be stored here.

Parameters:
ctl LFS control structure.
directory The directory stream pointer.
cpu The LAT CPU unit number.
devNum The device number.
dirNum The directory number.
xactId The transaction ID.
Returns:
A LFS MSG code.

static unsigned int LFS_dumpRoot LFS_Control ctl,
DIR *  directory,
unsigned int  cpu,
unsigned int  devNum,
unsigned int  xactId
[static]
 

Dumps the contents of the root directory into directory dump telemetry packets. The function is called in response to a LFSDIRDUMP telecommand when the directory number is specified as '127'. A series of LLFSROOTLIST telemetry packets is generated, one for each entry in the device root directory. Only sub-directories should be stored here.

Parameters:
ctl LFS control structure.
directory The directory stream pointer.
cpu The LAT CPU unit number.
devNum The device number.
xactId The trasaction ID.
Returns:
A LFS MSG code.

unsigned int LFS_FileCopy void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSFILECOPY command.

After translating the file system paths, the source file contents are copied to the destination file.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_FileDelete void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSFILEDELETE command.

After translating the target file path, the file is deleted.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_FileDumpCTDB void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSFILEDUMPC command.

After translating the file ID to a path, the file is opened for reading and a series of LLFSDUMPCTDB telemetry packets is generated. Each telemetry packet contains a portion of the file data, and the offset and size members provide the attributes of the data contained in each packet. These telemetry packets are delivered to the CTDB interface.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_FileDumpSSR void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSFILEDUMPS command.

After translating the file ID to a path, the file is opened for reading and a series of LLFSDUMPSSR telemetry packets is generated. Each telemetry packet contains a portion of the file data, and the offset and size members provide the attributes of the data contained in each packet. These telemetry packets are delivered to the SSR interface. Each telemetry packet contains one QLFS datagram.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_Noop void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSNOOP command.

Do nothing except generate command confirm reply.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_SysCheck void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSSYSCHECK command.

Consistency check an on-board file system by running the 'chkdsk' utility.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_SysFormat void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSSYSFORMAT command.

Re-format an on-board file system. This is potentially dangerous.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_SysMount void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSSYSMOUNT command.

Manually mount an on-board file system.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_SysRepair void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSSYSREPAIR command.

Repair an on-board file system by running the 'chkdsk' utility with the repair flag set to true.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.

unsigned int LFS_SysStatus void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Callback function for the LFSSYSSTATUS command.

After the target file system status is obtained from the system, a single LLFSSYSREPORT telemetry packet is generated to report the results.

Parameters:
prm User context parameter
qitem Queue item
pay Payload pointer
len Payload length
Returns:
A LFS MSG code.


Generated on Thu Dec 14 01:55:12 2006 by  doxygen 1.4.4