Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_sm.h File Reference

Go to the source code of this file.

Detailed Description

Generic state machine framework declarations

Definition in file ocs_sm.h.

Data Structures

struct  ocs_sm_ctx_t
 State machine context header. More...
 

Macros

#define OCS_SM_EVENT_SHIFT   24
 
#define OCS_SM_EVENT_START(id)   ((id) << OCS_SM_EVENT_SHIFT)
 
#define smtrace(...)
 

Typedefs

typedef void *(* ocs_sm_function_t )(ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 

Enumerations

enum  { OCS_SM_COMMON = 0, OCS_SM_DOMAIN, OCS_SM_CXN, OCS_SM_LAST }
 State Machine (SM) ID's. More...
 
enum  ocs_sm_event_t {
  OCS_EVT_ENTER = OCS_SM_EVENT_START(OCS_SM_COMMON), OCS_EVT_REENTER, OCS_EVT_EXIT, OCS_EVT_SHUTDOWN,
  OCS_EVT_COMMON_MAX, OCS_EVT_RESPONSE = OCS_SM_EVENT_START(OCS_SM_DOMAIN), OCS_EVT_ERROR, OCS_EVT_DOMAIN_MAX,
  OCS_EVT_CXN_CONNECT = OCS_SM_EVENT_START(OCS_SM_CXN), OCS_EVT_CXN_CONNECT_CMPL, OCS_EVT_CXN_INCOMING_REQ, OCS_EVT_CXN_GET_INFO_CMPL,
  OCS_EVT_CXN_OFFLOAD_CMPL, OCS_EVT_CXN_REJECT_CMPL, OCS_EVT_CXN_SW_REQ_CLOSE_NO_RST, OCS_EVT_CXN_SW_REQ_CLOSE_WITH_RST,
  OCS_EVT_CXN_CLOSE_CMPL, OCS_EVT_CXN_UPLOAD_CMPL, OCS_EVT_CXN_RETRY_TIMER_EXPIRED, OCS_EVT_ABORT_IO,
  OCS_EVT_ABORT_IO_NO_RESP, OCS_EVT_IO_CMPL, OCS_EVT_IO_CMPL_ERRORS, OCS_EVT_RESP_CMPL,
  OCS_EVT_ABORT_CMPL, OCS_EVT_ABORT_RESP_CMPL, OCS_EVT_IO_ABORTED_BY_TMF, OCS_EVT_IO_ABORT_IGNORED,
  OCS_EVT_IO_FIRST_BURST, OCS_EVT_IO_FIRST_BURST_ERR, OCS_EVT_IO_FIRST_BURST_ABORTED, OCS_EVT_LAST
}
 State Machine Events. More...
 

Functions

int ocs_sm_post_event (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 Post an event to a context. More...
 
void ocs_sm_transition (ocs_sm_ctx_t *, ocs_sm_function_t, void *)
 Transition to a new state. More...
 
void ocs_sm_disable (ocs_sm_ctx_t *ctx)
 Disable further state machine processing. More...
 
const char * ocs_sm_event_name (ocs_sm_event_t evt)
 

Variables

const char * ocs_sm_id []
 

Macro Details

#define OCS_SM_EVENT_SHIFT   24

Definition at line 51 of file ocs_sm.h.

#define OCS_SM_EVENT_START (   id)    ((id) << OCS_SM_EVENT_SHIFT)

Definition at line 52 of file ocs_sm.h.

#define smtrace (   ...)

Definition at line 125 of file ocs_sm.h.

Type Details

typedef void*(* ocs_sm_function_t)(ocs_sm_ctx_t *, ocs_sm_event_t, void *)

Definition at line 107 of file ocs_sm.h.

Enumeration Details

anonymous enum

State Machine (SM) ID's.

Enumerator
OCS_SM_COMMON 
OCS_SM_DOMAIN 
OCS_SM_CXN 
OCS_SM_LAST 

Definition at line 44 of file ocs_sm.h.

State Machine Events.

string format of above enums

Enumerator
OCS_EVT_ENTER 
OCS_EVT_REENTER 
OCS_EVT_EXIT 
OCS_EVT_SHUTDOWN 
OCS_EVT_COMMON_MAX 
OCS_EVT_RESPONSE 
OCS_EVT_ERROR 
OCS_EVT_DOMAIN_MAX 
OCS_EVT_CXN_CONNECT 
OCS_EVT_CXN_CONNECT_CMPL 
OCS_EVT_CXN_INCOMING_REQ 
OCS_EVT_CXN_GET_INFO_CMPL 
OCS_EVT_CXN_OFFLOAD_CMPL 
OCS_EVT_CXN_REJECT_CMPL 
OCS_EVT_CXN_SW_REQ_CLOSE_NO_RST 
OCS_EVT_CXN_SW_REQ_CLOSE_WITH_RST 
OCS_EVT_CXN_CLOSE_CMPL 
OCS_EVT_CXN_UPLOAD_CMPL 
OCS_EVT_CXN_RETRY_TIMER_EXPIRED 
OCS_EVT_ABORT_IO 
OCS_EVT_ABORT_IO_NO_RESP 
OCS_EVT_IO_CMPL 
OCS_EVT_IO_CMPL_ERRORS 
OCS_EVT_RESP_CMPL 
OCS_EVT_ABORT_CMPL 
OCS_EVT_ABORT_RESP_CMPL 
OCS_EVT_IO_ABORTED_BY_TMF 
OCS_EVT_IO_ABORT_IGNORED 
OCS_EVT_IO_FIRST_BURST 
OCS_EVT_IO_FIRST_BURST_ERR 
OCS_EVT_IO_FIRST_BURST_ABORTED 
OCS_EVT_LAST 

Definition at line 59 of file ocs_sm.h.

Function Details

void ocs_sm_disable ( ocs_sm_ctx_t *  ctx)

Disable further state machine processing.

Definition at line 88 of file ocs_sm.c.

const char* ocs_sm_event_name ( ocs_sm_event_t  evt)

Definition at line 93 of file ocs_sm.c.

int ocs_sm_post_event ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)

Post an event to a context.

Parameters
ctxState machine context
evtEvent to post
dataEvent-specific data (if any)
Returns
0 if successfully posted event; -1 if state machine is disabled

Definition at line 59 of file ocs_sm.c.

void ocs_sm_transition ( ocs_sm_ctx_t *  ,
ocs_sm_function_t  ,
void *   
)

Transition to a new state.

Definition at line 73 of file ocs_sm.c.

Variable Details

const char* ocs_sm_id[]

Definition at line 41 of file ocs_sm.c.