#include "hal_interface_api.h"
#include "com_IPMIDefs.h"
#include "userinfo.h"
#include "goahead.h"


int FlushUserInfoTbl(void)
{
	pthread_mutex_lock(&Flash_Mutex);
	sf_sector_erase(5, USERTBL_FLASH_ADDR);
	sf_write(5, USERTBL_FLASH_ADDR, (uint8_t*)UserInfoTbl, sizeof(UserInfo_T)*MAX_USER_NUM);
	pthread_mutex_unlock(&Flash_Mutex);
	return 0;
}

int UpdateUserInfoTble(void)
{
	pthread_mutex_lock(&Flash_Mutex);
	sf_read(5, USERTBL_FLASH_ADDR, (uint8_t*)UserInfoTbl, sizeof(UserInfo_T)*MAX_USER_NUM);
	pthread_mutex_unlock(&Flash_Mutex);
	return 0;
}