コード例 #1
0
ファイル: smdsv_sci.c プロジェクト: alban/OpenExanodes
// TODO : faire ça un peu mieux.. notamment desallouer correctement les ressources en cas d'erreur (voir bouquin sur les drivers pour faire ça bien)
int sci_init(void) {
  sci_query_adapter_t query;
  sci_error_t retval;
  
  // initialize the SCI environment 
  SCIInitialize(NO_FLAGS, &retval);
  if (retval != SCI_ERR_OK) {
    log_message("erreur SCIInitialize\n");
    log_message("%s\n",Sci_error(retval));
    return ERROR;
  }

  // détermine le node_id SCI du PC sur lequel s'exécute ce démon
  query.localAdapterNo = 0;
  query.subcommand = SCI_Q_ADAPTER_NODEID;
  query.data = &smdsv.THIS_NODE_ID;
  SCIQuery(SCI_Q_ADAPTER,&query,NO_FLAGS,&retval);
  if (retval != SCI_ERR_OK) {
    log_message("erreur SCIQuery\n");
    log_message("%s\n",Sci_error(retval));
    return ERROR;
  }  

  log_message("n° SCI du noeud local (THIS_NODE) = %d\n", smdsv.THIS_NODE_ID);
  
    
  return SUCCESS;
}
コード例 #2
0
Uint32 SCI_Transporter::getLocalNodeId(Uint32 adapterNo) 
{ 
  sci_query_adapter_t queryAdapter; 
  sci_error_t  error; 
  Uint32 _localNodeId; 
   
  queryAdapter.subcommand = SCI_Q_ADAPTER_NODEID; 
  queryAdapter.localAdapterNo = adapterNo; 
  queryAdapter.data = &_localNodeId; 
   
  SCIQuery(SCI_Q_ADAPTER,(void*)(&queryAdapter),(Uint32)NULL,&error); 
   
  if(error != SCI_ERR_OK) 
    return 0; 
  return _localNodeId;  
} 
コード例 #3
0
ファイル: failoverSCI.cpp プロジェクト: SunguckLee/MariaDB
sci_error_t GetLocalNodeId(Uint32 localAdapterNo, Uint32* localNodeId)
{
  sci_query_adapter_t queryAdapter;
  sci_error_t  error;
  unsigned int _localNodeId;
  
  queryAdapter.subcommand = SCI_Q_ADAPTER_NODEID;
  queryAdapter.localAdapterNo = localAdapterNo;
  queryAdapter.data = &_localNodeId;

  SCIQuery(SCI_Q_ADAPTER,&queryAdapter,NO_FLAGS,&error);
  
  *localNodeId=_localNodeId;
  
  return error;
}
コード例 #4
0
bool SCI_Transporter::getLinkStatus(Uint32 adapterNo) 
{ 
  sci_query_adapter_t queryAdapter; 
  sci_error_t  error; 
  int linkstatus; 
  queryAdapter.subcommand = SCI_Q_ADAPTER_LINK_OPERATIONAL; 
   
  queryAdapter.localAdapterNo = adapterNo; 
  queryAdapter.data = &linkstatus; 
   
  SCIQuery(SCI_Q_ADAPTER,(void*)(&queryAdapter),(Uint32)NULL,&error); 
   
  if(error != SCI_ERR_OK) { 
    DBUG_PRINT("error", ("error %d querying adapter", error)); 
    return false; 
  } 
  if(linkstatus<=0) 
    return false; 
  return true; 
}