Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 270031
b: refs/heads/master
c: 5760495
h: refs/heads/master
i:
  270029: 020844c
  270027: eabba51
  270023: ed48029
  270015: da1c51b
v: v3
  • Loading branch information
Andi Kleen authored and root committed Oct 28, 2011
1 parent b949ccd commit 7e5d349
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 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: ef3d0fd27e90f67e35da516dafc1482c82939a60
refs/heads/master: 5760495a872d63a182962680a13c2af29235237c
37 changes: 28 additions & 9 deletions trunk/fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ static loff_t lseek_execute(struct file *file, struct inode *inode,
}

/**
* generic_file_llseek - generic llseek implementation for regular files
* generic_file_llseek_size - generic llseek implementation for regular files
* @file: file structure to seek on
* @offset: file offset to seek to
* @origin: type of seek
* @size: max size of file system
*
* This is a generic implemenation of ->llseek usable for all normal local
* filesystems. It just updates the file offset to the value specified by
* @offset and @origin under i_mutex.
* This is a variant of generic_file_llseek that allows passing in a custom
* file size.
*
* Synchronization:
* SEEK_SET is unsynchronized (but atomic on 64bit platforms)
* SEEK_SET and SEEK_END are unsynchronized (but atomic on 64bit platforms)
* SEEK_CUR is synchronized against other SEEK_CURs, but not read/writes.
* read/writes behave like SEEK_SET against seeks.
* SEEK_END
*/
loff_t
generic_file_llseek(struct file *file, loff_t offset, int origin)
generic_file_llseek_size(struct file *file, loff_t offset, int origin,
loff_t maxsize)
{
struct inode *inode = file->f_mapping->host;

Expand All @@ -91,7 +91,7 @@ generic_file_llseek(struct file *file, loff_t offset, int origin)
*/
spin_lock(&file->f_lock);
offset = lseek_execute(file, inode, file->f_pos + offset,
inode->i_sb->s_maxbytes);
maxsize);
spin_unlock(&file->f_lock);
return offset;
case SEEK_DATA:
Expand All @@ -113,7 +113,26 @@ generic_file_llseek(struct file *file, loff_t offset, int origin)
break;
}

return lseek_execute(file, inode, offset, inode->i_sb->s_maxbytes);
return lseek_execute(file, inode, offset, maxsize);
}
EXPORT_SYMBOL(generic_file_llseek_size);

/**
* generic_file_llseek - generic llseek implementation for regular files
* @file: file structure to seek on
* @offset: file offset to seek to
* @origin: type of seek
*
* This is a generic implemenation of ->llseek useable for all normal local
* filesystems. It just updates the file offset to the value specified by
* @offset and @origin under i_mutex.
*/
loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
{
struct inode *inode = file->f_mapping->host;

return generic_file_llseek_size(file, offset, origin,
inode->i_sb->s_maxbytes);
}
EXPORT_SYMBOL(generic_file_llseek);

Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2403,6 +2403,8 @@ file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
int origin, loff_t maxsize);
extern int generic_file_open(struct inode * inode, struct file * filp);
extern int nonseekable_open(struct inode * inode, struct file * filp);

Expand Down

0 comments on commit 7e5d349

Please sign in to comment.