Beispiel #1
0
void fault_halt(struct stack_t *stack)
{
	(void)stack;

	/* Inspect stack->pc to locate the offending instruction. */
	assert_break();
}
Beispiel #2
0
// find task channel.
static task_chan* tch_find(const task_struct* task)
{
	task_chan* tch;

	for(tch=tchlist; tch!=NULL; tch=tch->next)
	{
		assert_break(tch->signature==TCH_SIG);

		if (tch->owner_task==task && tch->owner_pid==task->pid)
			return tch;
	}

	return NULL;
}
Beispiel #3
0
static void TCHLIST_PRINT(void)
{
	task_chan* tch;

	for(tch=tchlist; tch!=NULL; tch=tch->next)
	{
		assert_break(tch->signature==TCH_SIG);

		printk("%s %s(): tch=%p next=%p, ichlist: ",
			name, __FUNCTION__, tch, tch->next);
		ICHLIST_PRINT(tch);

		pr_endl();
	}
}
Beispiel #4
0
static bool process_file(string full_path, string rel_path, string name)
{
	string input_file = full_path + name;
	string output_file = s_outputpath + "/" + rel_path + name;
	string hash_file = output_file + s_hash_suffix;
	string rel_file = rel_path + name;
	int ret = 0;

	FILE* input_fp = NULL;
	FILE* output_fp = NULL;
	FILE* hash_fp = NULL;

	do {

	input_fp = fopen(input_file.c_str(), "rb");
	if ( input_fp == NULL )
	{
		// error!
		fprintf(s_process_log_fp, "[error]can't access file: %s\n", input_file.c_str() );
		s_file_err_counter++;
		return false;
	}

	ret = fseek(input_fp, 0, SEEK_END);  
	assert_break(ret == 0);
	size_t of_size = ftell(input_fp); 
	ret = fseek(input_fp, 0, SEEK_SET);  
	assert_break(ret == 0);

	if ( of_size == 0 )
	{
		// error!
		fclose(input_fp);
		fprintf(s_process_log_fp, "[error]zero size input file: %s\n", input_file.c_str() );
		s_file_err_counter++;
		return false;
	}

	output_fp = fopen(output_file.c_str(), "wb+");
	if ( output_fp == NULL )
	{
		// error!
		fclose(input_fp);
		fprintf(s_process_log_fp, "[error]can't create file: %s\n", output_file.c_str() );
		s_file_err_counter++;
		return false;
	}

	hash_fp = fopen(hash_file.c_str(), "w+");
	if ( hash_fp == NULL )
	{
		// error!
		fclose(input_fp);
		fclose(output_fp);
		fprintf(s_process_log_fp, "[error]can't create hash file: %s\n", hash_file.c_str() );
		s_file_err_counter++;
		return false;
	}

	string of_md5str = CUtils::filehash_md5str(input_fp, s_data_buf, sizeof(s_data_buf));
	string zf_md5str;
	size_t zf_size = 0;

	if ( of_size == 0 )
	{
		fclose(input_fp);
		fclose(output_fp);
		fclose(hash_fp);
		fprintf(s_process_log_fp, "[error] file size is zero!: %s\n", input_file.c_str() );
		s_file_err_counter++;
		return false;
	}

	ret = fseek(input_fp, 0, SEEK_SET);
	assert_break(ret == 0);

	if ( s_compress )
	{
		ret = CUtils::compress_fd(input_fp, output_fp, s_compress_level);
		assert_break(ret == 0);
	}
	else
	{
		while ( feof(input_fp) == 0 && ferror(input_fp) == 0 && ferror(output_fp) == 0 )
		{
			size_t read_size = fread(s_data_buf, 1, sizeof(s_data_buf), input_fp);
			size_t write_size = fwrite(s_data_buf, 1, read_size, output_fp);
			assert_break(read_size == write_size);
		}
	}

	fprintf(hash_fp, "%s\n%d\n", of_md5str.c_str(), of_size);
	if ( s_compress )
	{
		fclose(output_fp);
		output_fp = fopen(output_file.c_str(), "rb");
		assert_break(output_fp);

		zf_md5str = CUtils::filehash_md5str(output_fp, s_data_buf, sizeof(s_data_buf));

		ret = fseek(output_fp, 0, SEEK_END);  
		assert_break(ret == 0);
		zf_size = ftell(output_fp); 

		fprintf(hash_fp, "%s\n%d\n", zf_md5str.c_str(), zf_size);
	}

	// success!
	fprintf(s_files_outputfile_fp, "%s,%s,%d,", rel_file.c_str(), of_md5str.c_str(), of_size);	
	s_compress ? 
		fprintf(s_files_outputfile_fp, "%s,%d\n", zf_md5str.c_str(), zf_size) :
		fprintf(s_files_outputfile_fp, ",\n");
	fprintf(s_process_log_fp, "[info]build file: %s\n", rel_file.c_str());
	s_file_counter++;

	} while(0); // do

	fclose(input_fp);
	fclose(output_fp);
	fclose(hash_fp);

	if ( ret != 0 )
	{
		fprintf(s_process_log_fp, "[error]error occured when build file: %s\n", rel_file.c_str() );
		s_file_err_counter++;
		return false;
	}

	return true;
}
Beispiel #5
0
void hard_fault_handler(void)
{
	assert_break();
}
Beispiel #6
0
void assert_failed(uint8_t *function, uint32_t line)
{
	assert_break();
}
Beispiel #7
0
static bool process_file(string full_path, string rel_path, string name)
{
	// check is hash file
	string input_file = full_path + name;
	int suffixpos = name.rfind(s_hash_suffix.c_str());
	if ( suffixpos == -1 || suffixpos != name.size() - s_hash_suffix.size() )
	{
		return false;
	}
	string cell_name = rel_path + name.substr(0, suffixpos);

	FILE* input_fp = NULL;
	bool failed = true;

	do {
		input_fp = fopen(input_file.c_str(), "rb");
		if ( input_fp == NULL )
		{
			// error!
			fprintf(s_process_log_fp, "[error]can't access hash file: %s\n", input_file.c_str() );
			s_error_counter++;
			return false;
		}

		cell_attr* attr = new cell_attr;

		vector<string> strs;
		assert_break(parse_line(input_fp, strs));
		assert_break(strs.size() == 1);
		attr->omd5 = strs[0];
		strs.clear();
		assert_break(parse_line(input_fp, strs));
		assert_break(strs.size() == 1);
		attr->osize = CUtils::atoi(strs[0].c_str());
		strs.clear();
		bool zip = false;
		if ( parse_line(input_fp, strs) )
		{
			zip = true;
			assert_break(strs.size() == 1);
			attr->zmd5 = strs[0];
			strs.clear();
			assert_break(parse_line(input_fp, strs));
			assert_break(strs.size() == 1);
			attr->zsize = CUtils::atoi(strs[0].c_str());
			strs.clear();
		}
		
		sp_processing_idxmap->insert(std::make_pair(cell_name, attr));
		
		failed = false;
	} while(0); // do

	fclose(input_fp);

	if ( failed )
	{
		fprintf(s_process_log_fp, "[error]error occured when build version patch, file: %s\n", input_file.c_str() );
		s_error_counter++;
		return false;
	}

	return true;
}