Пример #1
0
inline TInt DMemSamplerImpl::EncodeChunkName(DChunk& c)
    {	
	// the size of the following name is in the first byte
	TUint8* size = &sample[0];
	*size = 0;
		
	// encode chunk name
	this->sampleDescriptor.Zero();
	this->sampleDescriptor.Append(_L("C_"));
	c.TraceAppendFullName(this->sampleDescriptor,false);
	*size += this->sampleDescriptor.Size();
		
	// add chunk object address here
	TUint32 chunkAddr((TUint32)&c);
	this->sampleDescriptor.Append((TUint8*)&(chunkAddr),sizeof(TUint32));
	*size += sizeof(TUint32);

	// the size is the descriptor length + the size field
	LOGSTRING2("Non-Heap Chunk Name - %d",*size);
	return ((TInt)(*size))+1;			
    }
Пример #2
0
    size_t         i;

    for (i = 0; i < len; i++)
        acc = crc16Add(acc, d[i]);

    return acc;
}

/* Should be called with the mutex locked. */
static void doRead(struct fsBlockHandle * restrict handle, fsOff_t start,
                   void * restrict buf, size_t len)
{
    if (start != 0 && start % BLOCK_DATA_SIZE == 0)
        handle->curr = fsBlockGetNext(handle->curr);

    blkExtFlashRead(chunkAddr(handle->curr, start), buf, len);
}

/*
 * Fill the buffer, possibly compare checksums. Should be called with the mutex
 * locked.
 */
static bool fillBuffer(struct fsBlockHandle *handle)
{
    blk_t   backup = handle->curr;
    fsOff_t end = handle->readEnd - handle->readEnd % CHUNK_DATA_SIZE
                  + CHUNK_DATA_SIZE;
    if (end > handle->fcb->size)
        end = handle->fcb->size;

    doRead(handle, handle->readEnd,