Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95274
b: refs/heads/master
c: 5559b8f
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Apr 30, 2008
1 parent 23f49bb commit ce77f11
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b48badf013018ef2aa4a46416454bdb18f77fb01
refs/heads/master: 5559b8f4d1f630b8614b6c8e13b8bf6c9c45d7d7
29 changes: 27 additions & 2 deletions trunk/fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1431,8 +1431,33 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
return err ? 0 : outarg.block;
}

static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
{
loff_t retval;
struct inode *inode = file->f_path.dentry->d_inode;

mutex_lock(&inode->i_mutex);
switch (origin) {
case SEEK_END:
offset += i_size_read(inode);
break;
case SEEK_CUR:
offset += file->f_pos;
}
retval = -EINVAL;
if (offset >= 0 && offset <= inode->i_sb->s_maxbytes) {
if (offset != file->f_pos) {
file->f_pos = offset;
file->f_version = 0;
}
retval = offset;
}
mutex_unlock(&inode->i_mutex);
return retval;
}

static const struct file_operations fuse_file_operations = {
.llseek = generic_file_llseek,
.llseek = fuse_file_llseek,
.read = do_sync_read,
.aio_read = fuse_file_aio_read,
.write = do_sync_write,
Expand All @@ -1448,7 +1473,7 @@ static const struct file_operations fuse_file_operations = {
};

static const struct file_operations fuse_direct_io_file_operations = {
.llseek = generic_file_llseek,
.llseek = fuse_file_llseek,
.read = fuse_direct_read,
.write = fuse_direct_write,
.open = fuse_open,
Expand Down

0 comments on commit ce77f11

Please sign in to comment.