diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-04 14:54:22 -0500 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-10 11:44:42 -0400 |
| commit | bd2a31d522344b3ac2fb680bd2366e77a9bd8209 (patch) | |
| tree | d08be6aea75b2f41bebf516bfc33187d0673bfce /include/linux | |
| parent | 00e188ef6a7e7bf2883bcffc30d89e98a0bb76b3 (diff) | |
get rid of fget_light()
instead of returning the flags by reference, we can just have the
low-level primitive return those in lower bits of unsigned long,
with struct file * derived from the rest.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/file.h | 21 | ||||
| -rw-r--r-- | include/linux/fs.h | 2 |
2 files changed, 12 insertions, 11 deletions
diff --git a/include/linux/file.h b/include/linux/file.h index f2517fa2d610..4d69123377a2 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -40,23 +40,24 @@ static inline void fdput(struct fd fd) | |||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | extern struct file *fget(unsigned int fd); | 42 | extern struct file *fget(unsigned int fd); |
| 43 | extern struct file *fget_light(unsigned int fd, int *fput_needed); | 43 | extern struct file *fget_raw(unsigned int fd); |
| 44 | extern unsigned long __fdget(unsigned int fd); | ||
| 45 | extern unsigned long __fdget_raw(unsigned int fd); | ||
| 46 | extern unsigned long __fdget_pos(unsigned int fd); | ||
| 44 | 47 | ||
| 45 | static inline struct fd fdget(unsigned int fd) | 48 | static inline struct fd __to_fd(unsigned long v) |
| 46 | { | 49 | { |
| 47 | int b; | 50 | return (struct fd){(struct file *)(v & ~3),v & 3}; |
| 48 | struct file *f = fget_light(fd, &b); | ||
| 49 | return (struct fd){f,b}; | ||
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | extern struct file *fget_raw(unsigned int fd); | 53 | static inline struct fd fdget(unsigned int fd) |
| 53 | extern struct file *fget_raw_light(unsigned int fd, int *fput_needed); | 54 | { |
| 55 | return __to_fd(__fdget(fd)); | ||
| 56 | } | ||
| 54 | 57 | ||
| 55 | static inline struct fd fdget_raw(unsigned int fd) | 58 | static inline struct fd fdget_raw(unsigned int fd) |
| 56 | { | 59 | { |
| 57 | int b; | 60 | return __to_fd(__fdget_raw(fd)); |
| 58 | struct file *f = fget_raw_light(fd, &b); | ||
| 59 | return (struct fd){f,b}; | ||
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); | 63 | extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index ebfde04bca06..23b2a35d712e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -812,7 +812,7 @@ struct file { | |||
| 812 | #ifdef CONFIG_DEBUG_WRITECOUNT | 812 | #ifdef CONFIG_DEBUG_WRITECOUNT |
| 813 | unsigned long f_mnt_write_state; | 813 | unsigned long f_mnt_write_state; |
| 814 | #endif | 814 | #endif |
| 815 | }; | 815 | } __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ |
| 816 | 816 | ||
| 817 | struct file_handle { | 817 | struct file_handle { |
| 818 | __u32 handle_bytes; | 818 | __u32 handle_bytes; |
