Ejemplo n.º 1
0
int do_write(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode,indx,opflag;
	uint64_t chunkid;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(indx,ptr);
	if (*ptr==',') {
		EAT(ptr,filename,lv,',');
		GETU32(opflag,ptr);
	} else {
		opflag=1;
	}
	EAT(ptr,filename,lv,')');
	EAT(ptr,filename,lv,':');
	GETU64(chunkid,ptr);
	return fs_log_write(ts,inode,indx,opflag,chunkid);
}
Ejemplo n.º 2
0
/******************************************************************************
	Store all currently available packets to the stream
*******************************************************************************
	Return value:
		0:			Success
		Other		Number of calls to fs_log_write that failed.
******************************************************************************/
unsigned short log_logpacket(FS_STATE *fs_state)
{
	unsigned char rv;
	signed char rp;
	unsigned short numerr;

	numerr=0;

	// Audio
	rp=packetholder_read_next(&packetholder_audio);
	if(rp!=-1)
	{
		// Write data
		rv = fs_log_write(fs_state,packet_audio[rp],PACKET_SIZE_AUDIO);

		if(rv)
			numerr++;
		
		//printf_P(PSTR("Wrote audio %d. %02lu/%02lu\r"),rp,packetholder_audio._log_numerr,packetholder_audio.total);

		packetholder_read_done(&packetholder_audio);
	}
	
	// Acceleration
	rp=packetholder_read_next(&packetholder_acc);
	if(rp!=-1)
	{
		// Write data
		rv = fs_log_write(fs_state,packet_acc[rp],PACKET_SIZE_ACC);

		if(rv)
			numerr++;
		
		//printf_P(PSTR("Wrote acc %d. %02lu/%02lu\r"),rp,packetholder_acc._log_numerr,packetholder_acc.total);

		packetholder_read_done(&packetholder_acc);
	}
	// System
	rp=packetholder_read_next(&packetholder_system);
	if(rp!=-1)
	{
		// Write data
		rv = fs_log_write(fs_state,packet_system[rp],PACKET_SIZE_SYSTEM);

		if(rv)
			numerr++;
		
		//printf_P(PSTR("Wrote system %d. %02lu/%02lu\r"),rp,packetholder_system._log_numerr,packetholder_system.total);

		packetholder_read_done(&packetholder_system);
	}
	// Light
	rp=packetholder_read_next(&packetholder_light);
	if(rp!=-1)
	{
		// Write data
		rv = fs_log_write(fs_state,packet_light[rp],PACKET_SIZE_LIGHT);

		if(rv)
			numerr++;
		
		//printf_P(PSTR("Wrote light %d. %02lu/%02lu\r"),rp,packetholder_light._log_numerr,packetholder_light.total);

		packetholder_read_done(&packetholder_light);
	}
	// tmp
	rp=packetholder_read_next(&packetholder_tmp);
	if(rp!=-1)
	{
		// Write data
		rv = fs_log_write(fs_state,packet_tmp[rp],PACKET_SIZE_TMP);

		if(rv)
			numerr++;
		
		//printf_P(PSTR("Wrote tmp %d. %02lu/%02lu\r"),rp,packetholder_tmp._log_numerr,packetholder_tmp.total);

		packetholder_read_done(&packetholder_tmp);
	}
	// hmc
	rp=packetholder_read_next(&packetholder_hmc);
	if(rp!=-1)
	{
		// Write data
		rv = fs_log_write(fs_state,packet_hmc[rp],PACKET_SIZE_HMC);

		if(rv)
			numerr++;
		
		//printf_P(PSTR("Wrote hmc %d. %02lu/%02lu\r"),rp,packetholder_hmc._log_numerr,packetholder_hmc.total);

		packetholder_read_done(&packetholder_hmc);
	}
	
	return numerr;
}