• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ReadBlock函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ReadBlock函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadBlock函数的具体用法?C++ ReadBlock怎么用?C++ ReadBlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: decrease_link_count

void decrease_link_count(ino iNode) {
    char iNodeDataBlock[BLOCK_SIZE];
    iNodeEntry *iNodes;

    if (iNode < 16) {
        ReadBlock(4, iNodeDataBlock);
        iNodes = (iNodeEntry *)iNodeDataBlock;

        // Decrease the number of link
        --iNodes[iNode].iNodeStat.st_nlink;
        if (iNodes[iNode].iNodeStat.st_nlink <= 0) {
            reset_inode_entry(&iNodes[iNode]);
        }

        WriteBlock(4, iNodeDataBlock);
    } else {
        ReadBlock(5, iNodeDataBlock);
        iNodes = (iNodeEntry *)iNodeDataBlock;

        // Decrease the number of links
        --iNodes[iNode - 16].iNodeStat.st_nlink;
        if (iNodes[iNode - 16].iNodeStat.st_nlink <= 0) {
            reset_inode_entry(&iNodes[iNode - 16]);
        }

        WriteBlock(5, iNodeDataBlock);
    }
}
开发者ID:AntoineGagne,项目名称:TPOS,代码行数:28,代码来源:UFS.c


示例2: LoadLCD

void LoadLCD(SAVESTATE_t* save, LCD_t* lcd) {
	CHUNK_t* chunk = FindChunk(save,LCD_tag);
	chunk->pnt = 0;

	lcd->active		= ReadInt(chunk);
	lcd->word_len	= ReadInt(chunk);
	lcd->x			= ReadInt(chunk);
	lcd->y			= ReadInt(chunk);
	lcd->z			= ReadInt(chunk);
	lcd->cursor_mode		= (LCD_CURSOR_MODE) ReadInt(chunk);
	lcd->contrast	= ReadInt(chunk);
	lcd->base_level	= ReadInt(chunk);

	ReadBlock(chunk, lcd->display, DISPLAY_SIZE);
	lcd->front		= ReadInt(chunk);
	ReadBlock(chunk,  (unsigned char *) lcd->queue, LCD_MAX_SHADES * DISPLAY_SIZE);
	lcd->shades		= ReadInt(chunk);
	lcd->mode		= (LCD_MODE) ReadInt(chunk);
	lcd->time		= ReadDouble(chunk);
	lcd->ufps		= ReadDouble(chunk);
	lcd->ufps_last	= ReadDouble(chunk);
	lcd->lastgifframe= ReadDouble(chunk);
	lcd->write_avg	= ReadDouble(chunk);
	lcd->write_last = ReadDouble(chunk);
}
开发者ID:elfprince13,项目名称:cli-wabbitemu,代码行数:25,代码来源:savestate.cpp


示例3: create_new_file_inode

void create_new_file_inode(ino fileiNode) {
    char iNodeDataBlock[BLOCK_SIZE];
    iNodeEntry *iNodes;

    if (fileiNode < 16) {
        ReadBlock(4, iNodeDataBlock);
        iNodes = (iNodeEntry *)iNodeDataBlock;
        iNodes[fileiNode].iNodeStat.st_ino = fileiNode;
        iNodes[fileiNode].iNodeStat.st_mode &= 0;
        iNodes[fileiNode].iNodeStat.st_mode |= G_IFREG | G_IRWXU | G_IRWXG;
        iNodes[fileiNode].iNodeStat.st_nlink = 1;
        iNodes[fileiNode].iNodeStat.st_size = 0;
        iNodes[fileiNode].iNodeStat.st_blocks = 0;
        WriteBlock(4, iNodeDataBlock);
    } else {
        ReadBlock(5, iNodeDataBlock);
        iNodes = (iNodeEntry *)iNodeDataBlock;
        iNodes[fileiNode - 16].iNodeStat.st_ino = fileiNode;
        iNodes[fileiNode - 16].iNodeStat.st_mode &= 0;
        iNodes[fileiNode - 16].iNodeStat.st_mode |= G_IFREG | G_IRWXU | G_IRWXG;
        iNodes[fileiNode - 16].iNodeStat.st_nlink = 1;
        iNodes[fileiNode - 16].iNodeStat.st_size = 0;
        iNodes[fileiNode - 16].iNodeStat.st_blocks = 0;
        WriteBlock(5, iNodeDataBlock);
    }
}
开发者ID:AntoineGagne,项目名称:TPOS,代码行数:26,代码来源:UFS.c


示例4: ReadKeyValuePair

void GdbMIThreadInfoParser::Parse(const wxString& info)
{
    m_threads.clear();
    // an example for -thread-info output
    // ^done,threads=[{id="30",target-id="Thread5060.0x1174",frame={level="0",addr="0x77a1000d",func="foo",args=[],from="C:\path\to\file"},state="stopped"},{..}],current-thread-id="30"
    wxString buffer = info;
    wxString threadsInfo;
    wxString threadBlock;
    
    if ( !ReadBlock(buffer, "[]", threadsInfo) )
        return;
    
    wxString activeThreadId;
    ReadKeyValuePair(buffer, "current-thread-id=", activeThreadId);
    
    while ( ReadBlock(threadsInfo, "{}", threadBlock) ) {
        GdbMIThreadInfo ti;
        ReadKeyValuePair(threadBlock, "id=",        ti.threadId);
        ReadKeyValuePair(threadBlock, "target-id=", ti.extendedName);
        ReadKeyValuePair(threadBlock, "func=",      ti.function);
        ReadKeyValuePair(threadBlock, "file=",      ti.file);
        ReadKeyValuePair(threadBlock, "line=",      ti.line);
        ti.active = activeThreadId == ti.threadId ? "Yes" : "No";
        m_threads.push_back( ti );
    }
}
开发者ID:292388900,项目名称:codelite,代码行数:26,代码来源:gdbmi_parse_thread_info.cpp


示例5: allocate_directory

int allocate_directory(ino iNode, DirEntry **ppListeFichiers) {
    char iNodeDataBlock[BLOCK_SIZE];
    char directoryDataBlock[BLOCK_SIZE];

    ReadBlock(6 + iNode - 1, directoryDataBlock);
    DirEntry *directory = (DirEntry *)directoryDataBlock;

    if (iNode < 16) {
        ReadBlock(4, iNodeDataBlock);
        iNodeEntry *iNodes = (iNodeEntry *)iNodeDataBlock;
        // If it isn't a directory
        if (!(iNodes[iNode].iNodeStat.st_mode & G_IFDIR)) {
            return -1;
        }
        int directorySizeNumber = iNodes[iNode].iNodeStat.st_size;
        (*ppListeFichiers) = (DirEntry *)malloc(directorySizeNumber);
        memcpy((*ppListeFichiers), directory, directorySizeNumber);
        return NumberofDirEntry(directorySizeNumber);
    } else {
        ReadBlock(5, iNodeDataBlock);
        iNodeEntry *iNodes = (iNodeEntry *)iNodeDataBlock;
        // If it isn't a directory
        if (!(iNodes[iNode].iNodeStat.st_mode & G_IFDIR)) {
            return -1;
        }
        int directorySizeNumber = iNodes[iNode - 16].iNodeStat.st_size;
        (*ppListeFichiers) = (DirEntry *)malloc(directorySizeNumber);
        memcpy((*ppListeFichiers), directory, directorySizeNumber);
        return NumberofDirEntry(directorySizeNumber);
    }

    return -1;
}
开发者ID:AntoineGagne,项目名称:TPOS,代码行数:33,代码来源:UFS.c


示例6: FreeInode

int FreeInode(int dev, int ino)
{
    char buf[BLKSIZE * 2];
    ReadBlock(dev,SUP_BLK_STARTS_AT,buf);
    ReadBlock( dev,SUP_BLK_STARTS_AT+1,buf+BLKSIZE);
    struct SupBlock* sptr= (struct SupBlock*) buf;

    sptr->sb_nfreeino++;

    if (sptr->sb_freeinoindex !=0 ) // if inode list is not full
    {
        sptr->sb_freeinoindex--;
        sptr->sb_freeinos[sptr->sb_freeinoindex]= ino;
    }


    writeSuper(dev,sptr);

    struct INode inode;
    ReadInode(dev,ino,&inode);
    inode.i_lnk=0;
    WriteInode(dev,ino,&inode);
    //return success
    return 0;
}
开发者ID:hrishikeshgoyal,项目名称:svfs,代码行数:25,代码来源:fstemplate.c


示例7: Display

void Display(int mode,int fid)
{
	if (fid==-1)
	
	{
		printf("目录下没有该文件。\n");
		return;
	}
	FileNode fn=*fileIndex[fid].node;
	int nowFDB=fn.FDBBlock;

	int size=fn.filesize;

	if (nowFDB==0||size==0)
	{
		return;
	}

	
	int BlockNum=(size+4092)/4093;
	char data[4096];
	if (mode==1)  //直接显示
	{
		for (int i=0;i<BlockNum-1;i++)
		{
			ReadBlock(nowFDB,data,4096);
			int nextBlock=ThreeToInt(&data[4093]);
			for (int j=0;j<4093;j++)
			{
				if (data[j]!='\r')
				{
					putchar(data[j]);
				}
			}
			nowFDB=nextBlock;
		}
		int remainSize=size%4093;
		if (remainSize==0)
		{
			remainSize=4093;
		}
		ReadBlock(nowFDB,data,4096);
		for (int i=0;i<remainSize;i++)
		{
			if (data[i]!='\r')
			{
				putchar(data[i]);
			}
		}
	}
	else
	{

	}
	printf("\n");
	
}
开发者ID:GregOcean,项目名称:mini_UFS,代码行数:57,代码来源:Display.cpp


示例8: readSuper

int readSuper (int dev, struct SupBlock* sb) {

    if (sb==NULL)
        return -1;//error
    char* ptr = (char*) sb;
    ReadBlock(dev,SUP_BLK_STARTS_AT+0,ptr);
    ReadBlock(dev,SUP_BLK_STARTS_AT+1,ptr+BLKSIZE);
    return 0;//success
}
开发者ID:hrishikeshgoyal,项目名称:svfs,代码行数:9,代码来源:fstemplate.c


示例9: EncodeFixed64

// Convert an index iterator value (i.e., an encoded BlockHandle)
// into an iterator over the contents of the corresponding block.
Iterator* Table::BlockReader(void* arg,
                             const ReadOptions& options,
                             const Slice& index_value) {
  Table* table = reinterpret_cast<Table*>(arg);
  Cache* block_cache = table->rep_->options.block_cache;
  Block* block = NULL;
  Cache::Handle* cache_handle = NULL;

  BlockHandle handle;
  Slice input = index_value;
  Status s = handle.DecodeFrom(&input);
  // We intentionally allow extra stuff in index_value so that we
  // can add more features in the future.

  if (s.ok()) {
    BlockContents contents;
    if (block_cache != NULL) {
      char cache_key_buffer[16];
      EncodeFixed64(cache_key_buffer, table->rep_->cache_id);
      EncodeFixed64(cache_key_buffer+8, handle.offset());
      Slice key(cache_key_buffer, sizeof(cache_key_buffer));
      cache_handle = block_cache->Lookup(key);
      if (cache_handle != NULL) {
        block = reinterpret_cast<Block*>(block_cache->Value(cache_handle));
      } else {
        s = ReadBlock(table->rep_->file, options, handle, &contents);
        if (s.ok()) {
          block = new Block(contents);
          if (contents.cachable && options.fill_cache) {
            cache_handle = block_cache->Insert(
                key, block, block->size(), &DeleteCachedBlock);
          }
        }
      }
    } else {
      s = ReadBlock(table->rep_->file, options, handle, &contents);
      if (s.ok()) {
        block = new Block(contents);
      }
    }
  }

  Iterator* iter;
  if (block != NULL) {
    iter = block->NewIterator(table->rep_->options.comparator);
    if (cache_handle == NULL) {
      iter->RegisterCleanup(&DeleteBlock, block, NULL);
    } else {
      iter->RegisterCleanup(&ReleaseBlock, block_cache, cache_handle);
    }
  } else {
    iter = NewErrorIterator(s);
  }
  return iter;
}
开发者ID:yanxi10,项目名称:leveldblib,代码行数:57,代码来源:table.cpp


示例10: WriteSkylanderToPortal

bool WriteSkylanderToPortal(unsigned char *encrypted_new_data, unsigned char *encrypted_old_data)
{
	bool bResult;
	bool bNewSkylander = false;
	unsigned char data[0x10]; 
	
	ConnectToPortal();
	
	// must start with a read of block zero
	bResult = ReadBlock(g_hPortalHandle, 0, data, bNewSkylander); 
	
	if(!bResult) {
		bNewSkylander = !bNewSkylander;
		bResult = ReadBlock(g_hPortalHandle, 0, data, bNewSkylander); 
		if(!bResult) {
			fprintf(stderr, "Abort before write. Could not read data from Skylander portal.\n");
			return false;
		}
	}
	
	if(encrypted_old_data == NULL) {
		encrypted_old_data = ReadSkylanderFromPortal();
	}
	
	printf("\nWriting Skylander to portal.\n");
	
	for(int i=0; i<2; i++) {
        // two pass write
		// write the access control blocks first
		bool selectAccessControlBlock;
		if(i == 0) {
			selectAccessControlBlock = 1;
		} else {
			selectAccessControlBlock = 0;
		}
		
		for(int block=0; block < 0x40; ++block) {
			bool changed, OK;
			int offset = block * 0x10;
			changed = (memcmp(encrypted_old_data+offset, encrypted_new_data+offset, 0x10) != 0);
			if(changed) {
				if(IsAccessControlBlock(block) == selectAccessControlBlock) {
					OK = WriteBlock(g_hPortalHandle, block, encrypted_new_data+offset, bNewSkylander);
					if(!OK) {
						fprintf(stderr, "Failed to write block %d. Aborting.\n", block);
						return false;
					}
				}
			}
		}
	}
	return true;
}
开发者ID:FunThomas76,项目名称:SkyReader,代码行数:53,代码来源:portalio_libusb.cpp


示例11: DB_DEBUG

void
CVarDataFile::UpdateRecord(DatabaseRec *inRecP) {
	SInt32 recSize = inRecP->recSize;
	SInt32 recPos = itsMasterIndex->UpdateEntry(inRecP->recID, recSize);	// find index entry
	inRecP->recPos = recPos;
#if DB_DEBUG_MODE || DB_INTEGRITY_CHECKING
	if (inRecP->recID > mLastRecID) {
		DB_DEBUG("ERROR: Invalid Record ID "<<inRecP->recID<<" updated. Last ID is "<<mLastRecID, DEBUG_ERROR);
		Throw_( dbInvalidID );
	}
	if (recSize < (SInt32)sizeof(DatabaseRec)) {
		DB_DEBUG("ERROR: Trying to update Rec "<<inRecP->recID<<" with size of "<<recSize<<" bytes, smaller than the record header alone.", DEBUG_ERROR);
        Throw_( dbDataCorrupt );
	}
	ASSERT(mBytesUsed <= mAllocatedBytes);	// can't use more than we've allocated
	ASSERT((mAllocatedBytes+mFirstItemPos) == GetLength());	// LFileStream needs to be in synch
	if (GetLength() < recPos) {
		DB_DEBUG("ERROR: Index returned offset "<<recPos<<" for Rec "<<inRecP->recID<<", but datafile is only "<<GetLength()<<" bytes long.", DEBUG_ERROR);
		mFileIsDamaged = true;
        Throw_( dbIndexCorrupt );
	}
//	DB_DEBUG("in UpdateRecord("<< inRecP->recID <<"); size: "<<recSize<<" pos: "<<recPos, DEBUG_TRIVIA);
	RecIDT oldID;
	SInt32 slotSize;
	SetMarker(recPos + kVarDBFileSlotSizeOffset, streamFrom_Start);	// debugging, check old ID
	ReadBlock(&slotSize, kSizeOfSlotSize);
	ReadBlock(&oldID, kSizeOfRecID);
  #if PLATFORM_LITTLE_ENDIAN
    slotSize = BigEndian32_ToNative(slotSize);
    oldID = BigEndian32_ToNative(oldID);
  #endif // PLATFORM_LITTLE_ENDIAN
	if ( (oldID != 0) && (oldID != inRecP->recID) ) {
	    DB_LOG("ERROR: Update Rec " << inRecP->recID << " " << recSize << "B pos: "<<recPos<<" FAILED, overwriting Rec "<<oldID);
		DB_DEBUG("ERROR: Updating "<< inRecP->recID << " into wrong place [" << recPos << "] , overwriting Rec "<<oldID, DEBUG_ERROR);
		mFileIsDamaged = true;
		Throw_( dbIndexCorrupt );
	}
	if (slotSize < RecSizeToSlotSize(recSize)) {
	    DB_LOG("ERROR: Update Rec " << inRecP->recID << " " << recSize << "B pos: "<<recPos<<" FAILED, slot too small "<<slotSize<<"B");
		DB_DEBUG("ERROR: Writing "<< inRecP->recID <<" of "<<RecSizeToSlotSize(recSize)<<" bytes into a "<<slotSize<<" byte slot at "<< recPos, DEBUG_ERROR);
		mFileIsDamaged = true;
        Throw_( dbDataCorrupt );
	}
#endif
	SetMarker(recPos + kVarDBFileRecIDOffset, streamFrom_Start);	// move to start of slot's data, skipping size
    inRecP->recID = Native_ToBigEndian32(inRecP->recID);
	WriteBlock(&inRecP->recID, RecSizeToIOSize(recSize));			// write the new record data into the slot
	inRecP->recID = BigEndian32_ToNative(inRecP->recID);
	DB_LOG("Updated Rec " << inRecP->recID << " " << recSize << "B pos: "<<recPos);
	DB_DEBUG("UpdateRecord("<< inRecP->recID <<"); size: "<<recSize<<" pos: "<<recPos, DEBUG_TRIVIA);
}
开发者ID:ezavada,项目名称:galactica-anno-dominari-3,代码行数:51,代码来源:CVarDataFile.cpp


示例12: d

TInt YModem::ReadPacket(TDes8& aDest)
	{
	TUint8* pD = (TUint8*)aDest.Ptr();
	TInt r;
	TPtr8 d(pD, 0, 1);
	r = ReadBlock(d);
	if (r != KErrNone)
		return r;
	if (d.Length()==0)
		return KErrZeroLengthPacket;
	TUint8 b0 = *pD;
	if (b0==CAN)
		return KErrAbort;
	if (b0==EOT)
		return KErrEof;
	if (b0==SOH)
		iBlockSize=128;
	else if (b0==STX)
		iBlockSize=1024;
	else
		return KErrBadPacketType;
	iTimeout=5000000;
	iPacketSize = iBlockSize+5;
	d.Set(pD+1, 0, iPacketSize-1);
	r = ReadBlock(d);
	if (r!=KErrNone && r!=KErrTimedOut)
		return r;
	if (d.Length() < iPacketSize-1)
		return KErrPacketTooShort;
	TUint8 seq = pD[1];
	TUint8 seqbar = pD[2];
	seqbar^=seq;
	if (seqbar != 0xff)
		return KErrCorruptSequenceNumber;
	if (seq==iSeqNum)
		return KErrAlreadyExists;
	else
		{
		TUint8 nextseq=(TUint8)(iSeqNum+1);
		if (seq!=nextseq)
			return KErrWrongSequenceNumber;
		}
	iCrc=0;
	UpdateCrc(pD+3, iBlockSize);
	aDest.SetLength(iPacketSize);
	TUint16 rx_crc = (TUint16)((pD[iPacketSize-2]<<8) | pD[iPacketSize-1]);
	if (rx_crc != iCrc)
		return KErrBadCrc;
	++iSeqNum;
	return KErrNone;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:51,代码来源:ymodem.cpp


示例13: sizeof

static char *ReadFileBlock(InodePtr fileInode, long blockNum, long blockOffset,
			   long length, char *buffer, long cache)
{
  long diskBlockNum, indBlockNum, indBlockOff, refsPerBlock;
  char *indBlock;
  
  if (blockNum >= fileInode->e2di_nblock) return 0;
  
  refsPerBlock = gBlockSize / sizeof(u_int32_t);
  
  // Get Direct Block Number.
  if (blockNum < NDADDR) {
    diskBlockNum = bswap32(fileInode->e2di_blocks[blockNum]);
  } else {
    blockNum -= NDADDR;
    
    // Get Single Indirect Block Number.
    if (blockNum < refsPerBlock) {
      indBlockNum = bswap32(fileInode->e2di_blocks[NDADDR]);
    } else {
      blockNum -= refsPerBlock;
      
      // Get Double Indirect Block Number.
      if (blockNum < (refsPerBlock * refsPerBlock)) {
	indBlockNum = fileInode->e2di_blocks[NDADDR + 1];
      } else {
	blockNum -= refsPerBlock * refsPerBlock;
	
	// Get Triple Indirect Block Number.
	indBlockNum = fileInode->e2di_blocks[NDADDR + 2];
	
	indBlock = ReadBlock(indBlockNum, 0, gBlockSize, 0, 1);
	indBlockOff = blockNum / (refsPerBlock * refsPerBlock);
	blockNum %= (refsPerBlock * refsPerBlock);
	indBlockNum = bswap32(((u_int32_t *)indBlock)[indBlockOff]);
      }
      
      indBlock = ReadBlock(indBlockNum, 0, gBlockSize, 0, 1);
      indBlockOff = blockNum / refsPerBlock;
      blockNum %= refsPerBlock;
      indBlockNum = bswap32(((u_int32_t *)indBlock)[indBlockOff]);
    }
    
    indBlock = ReadBlock(indBlockNum, 0, gBlockSize, 0, 1);
    diskBlockNum = bswap32(((u_int32_t *)indBlock)[blockNum]);
  }
  
  buffer = ReadBlock(diskBlockNum, blockOffset, length, buffer, cache);
  
  return buffer;
}
开发者ID:OpenDarwin-CVS,项目名称:SEDarwin,代码行数:51,代码来源:ext2fs.c


示例14: print_iNode

void print_iNode(ino pathiNode) {
    char iNodeDataBlock[BLOCK_SIZE];
    iNodeEntry *iNodes;

    if (pathiNode < 16) {
        ReadBlock(4, iNodeDataBlock);
        iNodes = (iNodeEntry *)iNodeDataBlock;
        printiNode(iNodes[pathiNode]);
    } else {
        ReadBlock(5, iNodeDataBlock);
        iNodes = (iNodeEntry *)iNodeDataBlock;
        printiNode(iNodes[pathiNode - 16]);
    }
}
开发者ID:AntoineGagne,项目名称:TPOS,代码行数:14,代码来源:UFS.c


示例15: set_stats

void set_stats(const ino iNode, gstat *pStat) {
    if (iNode < 16) {
        char iNodeDataBlock[BLOCK_SIZE];
        ReadBlock(4, iNodeDataBlock);
        iNodeEntry *iNodes = (iNodeEntry *)iNodeDataBlock;
        assign_stats(iNodes[iNode], pStat);
    } else {
        char iNodeDataBlock[BLOCK_SIZE];
        ReadBlock(5, iNodeDataBlock);
        iNodeEntry *iNodes = (iNodeEntry *)iNodeDataBlock;
        // We remove 16 from the iNode to get back to the beginning of the array
        assign_stats(iNodes[iNode - 16], pStat);
    }
}
开发者ID:AntoineGagne,项目名称:TPOS,代码行数:14,代码来源:UFS.c


示例16: has_allowed_block

int has_allowed_block(ino iNode) {
    char iNodeDataBlock[BLOCK_SIZE];
    iNodeEntry *iNodes;

    if (iNode < 16) {
        ReadBlock(4, iNodeDataBlock);
        iNodes = (iNodeEntry *)iNodeDataBlock;
        return iNodes[iNode].iNodeStat.st_blocks;
    } else {
        ReadBlock(5, iNodeDataBlock);
        iNodes = (iNodeEntry *)iNodeDataBlock;
        return iNodes[iNode - 16].iNodeStat.st_blocks;
    }
}
开发者ID:AntoineGagne,项目名称:TPOS,代码行数:14,代码来源:UFS.c


示例17: ReadAllBoardsBroadcast

bool FirewirePort::ReadAllBoards(void)
{
    if (Protocol_ == FirewirePort::PROTOCOL_BC_QRW) {
        return ReadAllBoardsBroadcast();
    }

    if (!handle) {
        outStr << "ReadAllBoards: handle for port " << PortNum << " is NULL" << std::endl;
        return false;
    }
    bool allOK = true;
    bool noneRead = true;
    for (int board = 0; board < max_board; board++) {
        if (BoardList[board]) {
            bool ret = ReadBlock(board, 0, BoardList[board]->GetReadBuffer(),
                                 BoardList[board]->GetReadNumBytes());
            if (ret) {
                noneRead = false;
            } else {
                allOK = false;
            }
            BoardList[board]->SetReadValid(ret);

            if (!ret) {
                outStr << "ReadAllBoards: read failed on port " << PortNum << ", board " << board << std::endl;
            }
        }
    }
    if (noneRead) {
        PollEvents();
    }
    return allOK;
}
开发者ID:samzer2,项目名称:mechatronics-software,代码行数:33,代码来源:FirewirePort.cpp


示例18: RemoveINodeFromINode

static int RemoveINodeFromINode(const char* filename, const iNodeEntry *pSrcInode, iNodeEntry *pDstInode) {
  
  if (!(pDstInode->iNodeStat.st_mode & G_IFDIR))
    return -1;

  char dataBlock[BLOCK_SIZE];
  if (ReadBlock(pDstInode->Block[0], dataBlock) == -1)
    return -1;

  DirEntry *pDirEntry = (DirEntry*)dataBlock;
  if (pDirEntry == NULL)
    return -1;
  
  const ino inode = pSrcInode->iNodeStat.st_ino;
  const size_t nDir = NumberofDirEntry(pDstInode->iNodeStat.st_size);
  size_t i;
  for (i = 0; i < nDir; ++i) {
    if ((pDirEntry[i].iNode == inode) 
	&& (strcmp(pDirEntry[i].Filename, filename) == 0))
      break;
  }
  for (; i< nDir; ++i) {
    pDirEntry[i] = pDirEntry[i + 1];
  }
  pDstInode->iNodeStat.st_size -= sizeof(DirEntry);
  if (WriteBlock(pDstInode->Block[0], dataBlock) == -1)
    return -1;
  return WriteINodeToDisk(pDstInode);
}
开发者ID:antiqe,项目名称:UnixFileSystem,代码行数:29,代码来源:UFS.c


示例19: ReadMeta

void Table::ReadMeta(const Footer& footer) {
  if (rep_->options.filter_policy == NULL) {
    return;  // Do not need any metadata
  }

  // TODO(sanjay): Skip this if footer.metaindex_handle() size indicates
  // it is an empty block.
  ReadOptions opt;
  if (rep_->options.paranoid_checks) {
    opt.verify_checksums = true;
  }
  BlockContents contents;
  if (!ReadBlock(rep_->file, opt, footer.metaindex_handle(), &contents).ok()) {
    // Do not propagate errors since meta info is not needed for operation
    return;
  }
  Block* meta = new Block(contents);

  Iterator* iter = meta->NewIterator(BytewiseComparator());
  std::string key = "filter.";
  key.append(rep_->options.filter_policy->Name());
  iter->Seek(key);
  if (iter->Valid() && iter->key() == Slice(key)) {
    ReadFilter(iter->value());
  }
  delete iter;
  delete meta;
}
开发者ID:yanxi10,项目名称:leveldblib,代码行数:28,代码来源:table.cpp


示例20: free_data_block_bitmap

void free_data_block_bitmap(UINT16 blockNumber) {
    printf("GLOFS: Relache bloc %u\n", blockNumber);
    char blockFreeBitmap[BLOCK_SIZE];
    ReadBlock(FREE_BLOCK_BITMAP, blockFreeBitmap);
    blockFreeBitmap[blockNumber] = 1;
    WriteBlock(FREE_BLOCK_BITMAP, blockFreeBitmap);
}
开发者ID:AntoineGagne,项目名称:TPOS,代码行数:7,代码来源:UFS.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ReadBool函数代码示例发布时间:2022-05-30
下一篇:
C++ ReadBlob函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap