static int proc_trigger_stack_reset(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { int rc = 0; int i = 1; kgn_device_t *dev; ENTRY; if (!write) { /* read */ rc = proc_dointvec(table, write, buffer, lenp, ppos); RETURN(rc); } /* only device 0 gets the handle, see kgnilnd_dev_init */ dev = &kgnilnd_data.kgn_devices[0]; LASSERTF(dev != NULL, "dev 0 is NULL\n"); kgnilnd_critical_error(dev->gnd_err_handle); /* Wait for the reset to complete. This prevents any races in testing * where we'd immediately try to send traffic again */ while (kgnilnd_data.kgn_needs_reset != 0) { i++; LCONSOLE((((i) & (-i)) == i) ? D_WARNING : D_NET, "Waiting for stack reset request to clear\n"); cfs_pause(cfs_time_seconds(1 * i)); } RETURN(rc); }
int libcfs_debug_mark_buffer(const char *text) { CDEBUG(D_TRACE,"***************************************************\n"); LCONSOLE(D_WARNING, "DEBUG MARKER: %s\n", text); CDEBUG(D_TRACE,"***************************************************\n"); return 0; }
int lnet_acceptor(void *arg) { socket_t *newsock; int rc; __u32 magic; __u32 peer_ip; int peer_port; int secure = (int)((long_ptr_t)arg); LASSERT(lnet_acceptor_state.pta_sock == NULL); cfs_block_allsigs(); rc = libcfs_sock_listen(&lnet_acceptor_state.pta_sock, 0, accept_port, accept_backlog); if (rc != 0) { if (rc == -EADDRINUSE) LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port %d: port already in use\n", accept_port); else LCONSOLE_ERROR_MSG(0x123, "Can't start acceptor on port %d: unexpected error %d\n", accept_port, rc); lnet_acceptor_state.pta_sock = NULL; } else { LCONSOLE(0, "Accept %s, port %d\n", accept_type, accept_port); } /* set init status and unblock parent */ lnet_acceptor_state.pta_shutdown = rc; complete(&lnet_acceptor_state.pta_signal); if (rc != 0) return rc; while (!lnet_acceptor_state.pta_shutdown) { rc = libcfs_sock_accept(&newsock, lnet_acceptor_state.pta_sock); if (rc != 0) { if (rc != -EAGAIN) { CWARN("Accept error %d: pausing...\n", rc); cfs_pause(cfs_time_seconds(1)); } continue; } /* maybe we're waken up with libcfs_sock_abort_accept() */ if (lnet_acceptor_state.pta_shutdown) { libcfs_sock_release(newsock); break; } rc = libcfs_sock_getaddr(newsock, 1, &peer_ip, &peer_port); if (rc != 0) { CERROR("Can't determine new connection's address\n"); goto failed; } if (secure && peer_port > LNET_ACCEPTOR_MAX_RESERVED_PORT) { CERROR("Refusing connection from %pI4h: insecure port %d\n", &peer_ip, peer_port); goto failed; } rc = libcfs_sock_read(newsock, &magic, sizeof(magic), accept_timeout); if (rc != 0) { CERROR("Error %d reading connection request from %pI4h\n", rc, &peer_ip); goto failed; } rc = lnet_accept(newsock, magic); if (rc != 0) goto failed; continue; failed: libcfs_sock_release(newsock); } libcfs_sock_release(lnet_acceptor_state.pta_sock); lnet_acceptor_state.pta_sock = NULL; CDEBUG(D_NET, "Acceptor stopping\n"); /* unblock lnet_acceptor_stop() */ complete(&lnet_acceptor_state.pta_signal); return 0; }
// pRoot의 모든 스킬을 읽는다. XSkillDat* XESkillMng::LoadSkill( TiXmlElement *pRoot, XSkillDat *pParentDat, EFFECT *pParentEffect ) { XSkillDat *pSkillDat = NULL; EFFECT *pEffect = NULL; ////////////////////////////////////////////////////////////////////////// // 먼저 Attribute(폴더가 아닌것)가 있는지 살펴본다. TiXmlAttribute *pAttr = pRoot->FirstAttribute(); if( pAttr ) { const char *cAttrName = pAttr->Name(); if( cAttrName ) { // 속성이 하나라도 있으면 skillDat객체를 생성한다. // Attribute가 있으면 일단 스킬로 인식하고 Dat객체를 생성한다. pSkillDat = CreateSkillDat(); if( pParentDat ) { ID idSkill = pSkillDat->GetidSkill(); *pSkillDat = *pParentDat; // 부모의 데이타를 상속받는다. pSkillDat->SetidSkill( idSkill ); _tstring strIdentifier = U82SZ( pRoot->Value() ); pSkillDat->SetstrIdentifier( strIdentifier ); } // 디폴트 이펙트버퍼도 하나 받는다. pEffect = new EFFECT; if( pParentEffect ) *pEffect = *pParentEffect; // 루프 시작 do { const char *cAttrName = pAttr->Name(); const char *cParam = pAttr->Value(); if( cAttrName && cAttrName[ 0 ] != '_' ) { XU8LOG( cAttrName ); XU8LOG( cParam ); // 변수명과 값을 파싱해서 pSkillDat에 넣는다. ParsingAttr( pAttr, cAttrName, cParam, pSkillDat, pEffect ); } } while (( pAttr = pAttr->Next() )); } } // pRoot에 폴더가 있는지 찾는다. TiXmlElement *pElemChild = pRoot->FirstChildElement(); if( pElemChild ) { do { // pRoot하의 모든 폴더를 하나씩 꺼낸다. const char *cFolderName = pElemChild->Value(); if( cFolderName && cFolderName[0] != '_' ) { XU8LOG( cFolderName ); ////////////////////////////////////////////////////////////////////////// // "효과"블럭은 따로 처리 if( XSAME( pElemChild->Value(), 96 ) || XSAME( pElemChild->Value(), 226 ) ) { // 효과/발동효과 if( pSkillDat == NULL ) { pSkillDat = CreateSkillDat(); if( pParentDat ) { ID idSkill = pSkillDat->GetidSkill(); *pSkillDat = *pParentDat; // 부모의 데이타를 상속받는다. pSkillDat->SetidSkill( idSkill ); _tstring strIdentifier = U82SZ( pRoot->Value() ); pSkillDat->SetstrIdentifier( strIdentifier ); } } EFFECT *pEffBlock = new EFFECT; if( pEffect ) *pEffBlock = *pEffect; // 하위상속을 위해 내용 복사. else *pEffBlock = *pParentEffect; // 스킬블럭에 디폴트 파라메터가 없으면 부모것을 디폴트로 쓴다. int numAttr = LoadEffect( pElemChild, pSkillDat, pEffBlock ); // 효과블럭안에 아무것도 없었으면 지운다. if( numAttr == 0 ) SAFE_DELETE( pEffBlock ); if( pEffBlock ) pSkillDat->AddEffect( pEffBlock ); } else if( XSAME( pElemChild->Value(), 235 ) ) { // 발동조건 if( pEffect == nullptr ) { pEffect = new EFFECT; if( pParentEffect ) *pEffect = *pParentEffect; } LoadCond( pElemChild, pEffect ); } else if( cFolderName[0] != '_' ) // 스킬이름이 _로 시작되면 읽지 않는다. { // 그외 폴더는 일단 스킬로 인식한다. XSkillDat* pNewSkillDat = NULL; pNewSkillDat = LoadSkill( pElemChild, ( pSkillDat ) ? pSkillDat : pParentDat, ( pEffect ) ? pEffect : pParentEffect ); if( pNewSkillDat ) { Add( pNewSkillDat ); } } } } while (( pElemChild = pElemChild->NextSiblingElement() )); } if( pSkillDat ) { // "효과"블럭이 추가된게 있었으면 디폴트용으로 생성되었던 이펙트 블럭은 필요없으므로 지운다. if( pSkillDat->GetNumEffect() > 0 ) { SAFE_DELETE( pEffect ); } else // 효과폴더가 없고 발동파라메터가 지정되지 않은 폴더는 스킬이 아니라고 보고 지운다. if( pSkillDat->GetNumEffect() == 0 ) { if( pEffect->invokeParameter == 0 && pEffect->invokeState == 0 && pEffect->strInvokeSkill.empty() && pEffect->idInvokeSkill == 0 && pEffect->invokeAbilityMin.size() == 0 && pEffect->invokeJuncture != 99 ) { // 발동시점:하드코딩 SAFE_RELEASE_REF( pSkillDat ); SAFE_DELETE( pEffect ); } else // "효과"블럭으로 추가된게 없고 발동파라메터는 지정되었으면 디폴트 이펙트를 이펙트로 추가한다. pSkillDat->AddEffect( pEffect ); } else { XBREAK(1); } if( pSkillDat ) { XBREAK( pSkillDat->GetTargetEff().IsHave() && pSkillDat->GetTargetEff().m_Loop == xAL_LOOP ); if( pSkillDat->m_strShootObj.empty() == false && pSkillDat->m_idShootObj == 0 ) pSkillDat->m_idShootObj = 1; // 파라메터 보정 for( const auto pEffect : pSkillDat->GetlistEffects() ) { // 지속시간이 있는데 발동시점이 지정안되면 디폴트로 persist동작을 하도록 수정.(버프라도 지속시간계속 발동하는게 있고 버프받는최초에만 적용되는게 있다, 버프끝날때 발동되는것도 있고. if( pEffect->IsDuration() && pEffect->invokeJuncture == xJC_NONE ) { pEffect->invokeJuncture = xJC_PERSIST; } LCONSOLE( !pEffect->IsDuration() && pEffect->invokeJuncture == xJC_PERSIST , "%s", _T("지속시간이 없는스킬인데 지속발동으로 지정되어 있음.") ); // 발동시점스킬이 지정되어 있다면 발동시점은 무조건 스킬발동시가 된다. if( pEffect->strInvokeTimeSkill.empty() == false ) { pEffect->invokeJuncture = xJC_INVOKE_SKILL; // 이걸하지않으면 지속형 스킬이 되어버림. } // 발동대상우호가 지정되지 않았으면 시전대상우호를 가져다 쓴다. if( pEffect->invokefiltFriendship == xfNONESHIP ) pEffect->invokefiltFriendship = pEffect->castfiltFriendship; // 시전거리는 정해졌는데 시전범위타입이 지정되지 않았으면 디폴트로 원형이 됨 if( pEffect->castSize.w > 0.f && pEffect->castSize.h > 0.f && pEffect->castTargetRange == xTR_ONE ) pEffect->castTargetRange = xTR_LINE; if( pEffect->castSize.w > 0.f && pEffect->castTargetRange == xTR_ONE ) pEffect->castTargetRange = xTR_CIRCLE; if( pEffect->invokeTarget == xIVT_NONE ) pEffect->invokeTarget = xIVT_CAST_TARGET; if( pEffect->invokeTarget == xIVT_CAST_TARGET_RADIUS || pEffect->invokeTarget == xIVT_CAST_TARGET_SURROUND ) { if( pEffect->IsHaveInvokeSize() == false ) XALERT("스킬\"%s\":발동범위가 지정되지 않음", pSkillDat->GetstrIdentifier().c_str() ); } // 지속시간스킬이면서 발동스킬이 있는건 에러(매프레임 스킬을 발동시키게 됨) XBREAK( pEffect->IsDuration() && pEffect->secInvokeDOT == 0 && pEffect->invokeJuncture == xJC_PERSIST && !pEffect->strInvokeSkill.empty() ); XBREAK( pEffect->castTarget == xCST_BASE_TARGET_POS // 시전대상이 좌표형 && pEffect->IsDuration() // 지속시간형 && pEffect->m_PersistEff.IsEmpty() ); // 일때 지속효과 spr이 없으면 안됨.(투명 객체됨) AdjustEffectParam( pSkillDat, pEffect ); // virtual } // for effect } } else { SAFE_DELETE( pEffect ); } return pSkillDat; }