Exemplo n.º 1
0
int ext2_write_off(struct ext2_info *fs, off_t off, unsigned char *buf, size_t len)
{
	struct file f;
	f.inode = fs->filesys->node;
	int ret = fs_file_pwrite(&f, off, buf, len);
	return ret;
}
Exemplo n.º 2
0
ssize_t fs_file_write(struct file *file, uint8_t *buffer, size_t length)
{
	ssize_t ret = fs_file_pwrite(file, file->pos, buffer, length);
	if(ret > 0)
		file->pos += ret;
	return ret;
}
Exemplo n.º 3
0
int ext2_write_block(struct ext2_info *fs, uint64_t block, unsigned char *buf)
{
	off_t off = block * ext2_sb_blocksize(fs->sb);// + fs->block*512;
	struct file f;
	f.inode = fs->filesys->node;
	int ret = fs_file_pwrite(&f, off, buf, ext2_sb_blocksize(fs->sb));
	return ret;
}
Exemplo n.º 4
0
int sys_write(int fp, off_t pos, unsigned char *buf, size_t count)
{
	struct file *f = file_get(fp);
	if(!f)
		return -EBADF;
	if(!count || !buf) {
		file_put(f);
		return -EINVAL;
	}
	if(!(f->flags & _FWRITE)) {
		file_put(f);
		return -EACCES;
	}
	int ret = fs_file_pwrite(f, pos, buf, count);
	file_put(f);
	return ret;
}