GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LHK / dev > lhk / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

LHK_callback.c File Reference

Everything mechanistic to service the CTDB housekeeping callback. More...

#include <stdlib.h>
#include <string.h>
#include <CDM/CDM_pubdefs.h>
#include <FBS/FBS_pubrtos.h>
#include <LHK/LHK_msgs.h>
#include <LHK_DB/LHK_DB_pktdefs.h>
#include <LHK_DB/LHK_DB_schedule.h>
#include <MDB/MDB_pubdefs.h>
#include <PBI/PTR.h>
#include <PBS/FFS.ih>
#include <PBS/INT.ih>
#include <LHK_prvdefs.h>

Functions

static unsigned int scheduleReplace (const LHK_DB_Packet *tbl, unsigned int len, LHK_cb_FreeSchedule *rtn, void *prm)
 Request a new housekeeping schedule.
static unsigned int scheduleScan (CDM_Database *cdm, LHK_Control *lcb)
 Scan CDMs for housekeeping schedules.
static unsigned int scheduleValidate (const LHK_DB_Packet *tbl, unsigned int len)
 Validate a housekeeping schedule.
unsigned int LHK_ctdbCallback (void *out, void *prm)
 Service a request for a housekeeping packet.
void LHK_scheduleGet (unsigned int *fil, unsigned int *ins)
 Identify the schedule file in use.
unsigned int LHK_scheduleInitialize (LHK_Control *lcb)
 Service a request for a housekeeping packet.
unsigned int LHK_scheduleReplaceByFile (unsigned int fil)
 Request a new housekeeping schedule by file ID.
unsigned int LHK_scheduleReplaceByInstance (int instance)
 Request a new housekeeping schedule by file ID.

Variables

const LHK_DB_Packet LHK_defaultPacketList []
 Should no schedules be loaded...
const LHK_DB_Schedule LHK_defaultSchedule
 Should no schedules be loaded...


Detailed Description

Everything mechanistic to service the CTDB housekeeping callback.

CVS $Id: LHK_callback.c,v 1.4 2011/03/29 01:45:00 apw Exp $
Author:
A.P.Waite
LHK_callback.c provides all the mechanism for delivering housekeeping packets to the CTDB (the individual packets have to provide the logic for filling in the packets before they are delivered).

Function Documentation

unsigned int LHK_ctdbCallback ( void *  out,
void *  prm 
)

Service a request for a housekeeping packet.

Parameters:
out (in) Output buffer (where the packet should be placed)
prm (in) User parameter
Return values:
LHK_GENERROR Generic error
LHK_SUCCESS Success
LHK_ctdbCallback() is the routine that runs in the CTDB callback context to provide a housekeeping packet.

References _LHK_ScheduleControl::cur, _LHK_Packet::hsk, _LHK_Schedule::len, LHK_lcb, LHK_packet, LHK_PKT_SUCCESS, LHK_PKT_TIMEOUT, _LHK_ScheduleControl::nxt, _LHK_Schedule::prm, _LHK_ScheduleControl::req, _LHK_Packet::rtn, _LHK_Schedule::rtn, _LHK_Control::scb, _LHK_Packet::seq, and _LHK_Schedule::tbl.

Referenced by LHK_start().

void LHK_scheduleGet ( unsigned int *  fil,
unsigned int *  ins 
)

Identify the schedule file in use.

Parameters:
fil (in) File ID
ins (in) CDM instance ID
LHK_scheduleGet() returns the file ID for the schedule file currently in use (or zero if the internal default schedule is in use).

References _LHK_ScheduleTable::cdm, _LHK_ScheduleTable::fil, LHK_lcb, _LHK_Control::table, and _LHK_Control::tused.

unsigned int LHK_scheduleInitialize ( LHK_Control lcb  ) 

Service a request for a housekeeping packet.

Parameters:
lcb (in) LHK control block
Return values:
LHK_GENERROR Generic error
LHK_SUCCESS Success
LHK_scheduleInitialize() sets up controls for housekeeping schedules.

References _LHK_ScheduleTable::cdm, scheduleReplace(), scheduleScan(), scheduleValidate(), _LHK_Control::table, _LHK_Control::tmask, and _LHK_Control::tused.

Referenced by LHK_initialize().

unsigned int LHK_scheduleReplaceByFile ( unsigned int  fil  ) 

Request a new housekeeping schedule by file ID.

Parameters:
fil (in) File ID of file/CDM providing the new schedule
Return values:
LHK_GENERROR Generic error
LHK_SUCCESS Success
LHK_scheduleReplace() requests that the CTDB housekeeping callback change the housekeeping schedule in use with the one defined in the file/CDM with file ID fil.

References _LHK_ScheduleTable::cdm, _LHK_ScheduleTable::fil, LHK_lcb, scheduleReplace(), scheduleValidate(), _LHK_Control::table, _LHK_Control::tmask, and _LHK_Control::tused.

Referenced by LHK_NewSchedFile(), and LHK_SysReset().

unsigned int LHK_scheduleReplaceByInstance ( int  instance  ) 

Request a new housekeeping schedule by file ID.

Parameters:
instance (in) CMD instance number
Return values:
LHK_GENERROR Generic error
LHK_SUCCESS Success
LHK_scheduleReplaceByInstance() requests that the CTDB housekeeping callback change the housekeeping schedule in use with the one defined in the file/CDM with CDM instance number instance.

References _LHK_ScheduleTable::cdm, LHK_lcb, scheduleReplace(), _LHK_Control::table, _LHK_Control::tmask, and _LHK_Control::tused.

Referenced by LHK_NewSchedInst(), and LHK_SysReset().

static unsigned int scheduleReplace ( const LHK_DB_Packet *  tbl,
unsigned int  len,
LHK_cb_FreeSchedule rtn,
void *  prm 
) [static]

Request a new housekeeping schedule.

Parameters:
tbl (in) Pointer to new table (simple list of APIDs)
len (in) Length of table
rtn (in) Routine to call when switch complete (can be NULL)
prm (in) User parameter to callback routine
Return values:
LHK_GENERROR Generic error
LHK_SUCCESS Success
scheduleReplace() requests that the CTDB housekeeping callback change the housekeeping schedule in use. To ensure thread safety, the table is not switched immediately, but will be switched the next time that the CTDB callback runs. Due to this asynchronicity, a callback (called in the CTDB callback context) is provided to dispose of the old housekeeping schedule, should that be necessary. Note the corollary: the schedule table (as defined by tbl and len) is not copied. The caller of this routine must ensure that the memory persists until rtn is called.

References _LHK_Schedule::len, LHK_lcb, _LHK_Schedule::prm, _LHK_ScheduleControl::req, _LHK_Schedule::rtn, _LHK_Control::scb, scheduleValidate(), and _LHK_Schedule::tbl.

Referenced by LHK_scheduleInitialize(), LHK_scheduleReplaceByFile(), and LHK_scheduleReplaceByInstance().

static unsigned int scheduleScan ( CDM_Database *  cdm,
LHK_Control lcb 
) [static]

Scan CDMs for housekeeping schedules.

Parameters:
cdm (in) CDM handle
lcb (in) LHK control block

References _LHK_ScheduleTable::cdm, _LHK_ScheduleTable::fil, scheduleValidate(), _LHK_Control::table, and _LHK_Control::tmask.

Referenced by LHK_scheduleInitialize().

static unsigned int scheduleValidate ( const LHK_DB_Packet *  tbl,
unsigned int  len 
) [static]

Validate a housekeeping schedule.

Parameters:
tbl (in) Pointer to new table (simple list of APIDs)
len (in) Length of table
Return values:
LHK_GENERROR Generic error
LHK_SUCCESS Success

Referenced by LHK_scheduleInitialize(), LHK_scheduleReplaceByFile(), scheduleReplace(), and scheduleScan().


Variable Documentation

const LHK_DB_Schedule LHK_defaultSchedule

Initial value:

{
    sizeof( LHK_defaultPacketList ) / sizeof( LHK_DB_Packet ),
    &LHK_defaultPacketList[0]
}
Should no schedules be loaded...


Generated on Mon Mar 28 18:48:39 2011 by  doxygen 1.5.8