//read emmc panel partions data to buf;
//write buf data to emmc partions
static int realrwdata(rwinfo *info)
{
int device_fd = -1;
device_fd = open(info->path, O_RDWR | O_SYNC);
if (device_fd < 0) {
return -1;
}
lseek(device_fd, info->rw_offset, SEEK_SET);
if(info->rw_type == DATA_W)
info->data_size = write(device_fd, (char*)info->data_buf, info->rw_size);
else if(info->rw_type == DATA_R)
info->data_size = read(device_fd, (char*)info->data_buf, info->rw_size);
fsync(device_fd);
close(device_fd);
return info->data_size;
}
阅读(3371) | 评论(0) | 转发(0) |