static void write_file(char *filename, unsigned char *data, unsigned int nSize)
{
struct file *file;
loff_t pos = 0;
int fd;
dmac_inv_range(data, data + nSize);
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
fd = sys_open(filename, O_WRONLY|O_CREAT, 0644);
if (fd >= 0) {
sys_write(fd, data, nSize);
file = fget(fd);
if (file) {
vfs_write(file, data, nSize, &pos);
fput(file);
}
sys_close(fd);
}
else
{
mfc_err("........Open fail : %d \n", fd);
}
set_fs(old_fs);
dmac_clean_range(data, data + nSize);
}
{
struct file *file;
loff_t pos = 0;
int fd;
dmac_inv_range(data, data + nSize);
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
fd = sys_open(filename, O_WRONLY|O_CREAT, 0644);
if (fd >= 0) {
sys_write(fd, data, nSize);
file = fget(fd);
if (file) {
vfs_write(file, data, nSize, &pos);
fput(file);
}
sys_close(fd);
}
else
{
mfc_err("........Open fail : %d \n", fd);
}
set_fs(old_fs);
dmac_clean_range(data, data + nSize);
}