当前位置: 首页>>代码示例>>C++>>正文


C++ SharedACQPtr::PeekCEwithCID方法代码示例

本文整理汇总了C++中SharedACQPtr::PeekCEwithCID方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedACQPtr::PeekCEwithCID方法的具体用法?C++ SharedACQPtr::PeekCEwithCID怎么用?C++ SharedACQPtr::PeekCEwithCID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SharedACQPtr的用法示例。


在下文中一共展示了SharedACQPtr::PeekCEwithCID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FrmwkEx


//.........这里部分代码省略.........
    */
    // Set attach namespace buffer to be the full controller list, to attach all new NSIDs to to all on this subsystem
    namespaceAttachCmd->SetPrpBuffer(prpBitmask, identifyControllerList);

	LOG_NRM("Create Namespace Management to create all namespaces before attaching to all contollers");
    SharedNamespaceManagementPtr namespaceManagementCmd = SharedNamespaceManagementPtr(new NamespaceManagement() );
    SharedMemBufferPtr managementBuffer = SharedMemBufferPtr(new MemBuffer() );

    NamespaceManagementCreateStruct nscreate;
    nscreate.NSZE = individualNamespaceCapacity;
    nscreate.NCAP = individualNamespaceCapacity;
    nscreate.FLBAS = 0;
    nscreate.DPS   = 0;
    nscreate.NMIC  = 1;

    //NamespaceManagementCreateStruct nscreate( individualNamespaceCapacity, individualNamespaceCapacity, 0, 0, 1 );
    // BUGBUG we are going to assume a 512B size and barenamespace as FLBAS=0... otherwise we need to determine what format via namespace structs...
    //CreateNamespaceManagementStructure( individualNamespaceCapacity, individualNamespaceCapacity, 0, 0, 1, userBuffer);
    LOG_NRM("Each of the %d namespaces will be of 0x%llx size", identifyControllerMaxNSID, (long long unsigned int) individualNamespaceCapacity);
    nscreate.print();

    managementBuffer->InitAlignment(384, 4096, false, 0x0, (uint8_t*) &nscreate); // Contains namespace struct info for namespace management to consume (384B)
    namespaceManagementCmd->SetPrpBuffer(prpBitmask, managementBuffer);
    namespaceAttachCmd->SetSEL( 0 );
    namespaceAttachCmd->SetNSID( 0 );

	LOG_NRM("Start main loop over valid NSIDs to create/attach them.");
	for(uint64_t currentNamespaceIdToCreate = 0; currentNamespaceIdToCreate < identifyControllerMaxNSID; currentNamespaceIdToCreate++ ) {
		// Get the current
		// Create this namespace using 1/NNth amount of the total available space.
	    namespaceManagementCmd->SetSEL(0);
	    namespaceManagementCmd->SetNSID(0);
	    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, namespaceManagementCmd, "Creating namespace that is 1/NNth size of total NVM capacity, 512B bare LBAs.", false, CESTAT_SUCCESS);
	    newlyCreatedNSID = (acq->PeekCEwithCID( namespaceManagementCmd->GetCID() ) ).t.dw0;
	    LOG_NRM("Newly created NS has NSID of 0x%llu", (long long unsigned) newlyCreatedNSID);

		// ID this namespace and see if it is all 0s. Namespace should be created but 'inactive'.
		identifyCmd->SetCNS(CNS_Namespace ); // Standard Namespace ID, should also be attached to this controller
		identifyCmd->SetNSID( newlyCreatedNSID ); //
	    identifyCmd->SetCNTID(0);
		identifyCmd->SetPrpBuffer(prpBitmask, identifyNamespaceStruct);
	    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, identifyCmd, "Read Identify Controller struct from created NSID, expecting it to be all 0's since it has not yet attached", false, CESTAT_SUCCESS);
	    // Currently fails on FW
	    for(uint32_t bufferIndex = 0; bufferIndex < 4096; bufferIndex++) {
    		if ( identifyCmd->GetROPrpBuffer()[bufferIndex] != 0) {
    			throw FrmwkEx(HERE, "Expected Identify Namespace to returned all zero buffer as namespace should be inactive and non-attached");
    		}
    	}

	    // Now attach the drive to all controllers on the subsystem
	    namespaceAttachCmd->SetNSID( newlyCreatedNSID );
	    namespaceAttachCmd->SetSEL(0);
	    // Should already have the ControllerList associated with the NamespaceAttach command
	    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, namespaceAttachCmd, "Attaching NSID to all controllers on subsystem", false, CESTAT_SUCCESS);

	    // Reread this NS struct back and make sure the values match what we had requested...
	    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, identifyCmd, "Read Identify Controller struct from created NSID, expecting non-zero since it is now attached", false, CESTAT_SUCCESS);
	    // First ensure the buffer is not completely non-zero
	    bool identifyNamespaceBufferIsZeroFilled = true;
	    for(uint32_t bufferIndex = 0; bufferIndex < 4096; bufferIndex++) {
    		if ( identifyCmd->GetROPrpBuffer()[bufferIndex] != 0) {
    			identifyNamespaceBufferIsZeroFilled = false;
    			break;
    		}
    	}
	    if( identifyNamespaceBufferIsZeroFilled == true) {
开发者ID:davidsaOpenu,项目名称:nvmeCompl,代码行数:67,代码来源:createAndAttachMaxNamespacesAndVerify.cpp


注:本文中的SharedACQPtr::PeekCEwithCID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。