diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/compat.h | 3 | ||||
-rw-r--r-- | include/linux/fdtable.h | 39 | ||||
-rw-r--r-- | include/linux/file.h | 35 | ||||
-rw-r--r-- | include/linux/fs.h | 10 | ||||
-rw-r--r-- | include/linux/net.h | 3 | ||||
-rw-r--r-- | include/linux/sched.h | 1 |
6 files changed, 57 insertions, 34 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h index 09b28b7369d7..fd4e29956d1c 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -590,6 +590,9 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid, | |||
590 | unsigned long liovcnt, const struct compat_iovec __user *rvec, | 590 | unsigned long liovcnt, const struct compat_iovec __user *rvec, |
591 | unsigned long riovcnt, unsigned long flags); | 591 | unsigned long riovcnt, unsigned long flags); |
592 | 592 | ||
593 | asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, | ||
594 | compat_off_t __user *offset, compat_size_t count); | ||
595 | |||
593 | #else | 596 | #else |
594 | 597 | ||
595 | #define is_compat_task() (0) | 598 | #define is_compat_task() (0) |
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 158a41eed314..45052aa814c8 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
@@ -30,31 +30,11 @@ struct fdtable { | |||
30 | struct fdtable *next; | 30 | struct fdtable *next; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | static inline void __set_close_on_exec(int fd, struct fdtable *fdt) | ||
34 | { | ||
35 | __set_bit(fd, fdt->close_on_exec); | ||
36 | } | ||
37 | |||
38 | static inline void __clear_close_on_exec(int fd, struct fdtable *fdt) | ||
39 | { | ||
40 | __clear_bit(fd, fdt->close_on_exec); | ||
41 | } | ||
42 | |||
43 | static inline bool close_on_exec(int fd, const struct fdtable *fdt) | 33 | static inline bool close_on_exec(int fd, const struct fdtable *fdt) |
44 | { | 34 | { |
45 | return test_bit(fd, fdt->close_on_exec); | 35 | return test_bit(fd, fdt->close_on_exec); |
46 | } | 36 | } |
47 | 37 | ||
48 | static inline void __set_open_fd(int fd, struct fdtable *fdt) | ||
49 | { | ||
50 | __set_bit(fd, fdt->open_fds); | ||
51 | } | ||
52 | |||
53 | static inline void __clear_open_fd(int fd, struct fdtable *fdt) | ||
54 | { | ||
55 | __clear_bit(fd, fdt->open_fds); | ||
56 | } | ||
57 | |||
58 | static inline bool fd_is_open(int fd, const struct fdtable *fdt) | 38 | static inline bool fd_is_open(int fd, const struct fdtable *fdt) |
59 | { | 39 | { |
60 | return test_bit(fd, fdt->open_fds); | 40 | return test_bit(fd, fdt->open_fds); |
@@ -93,15 +73,8 @@ struct file_operations; | |||
93 | struct vfsmount; | 73 | struct vfsmount; |
94 | struct dentry; | 74 | struct dentry; |
95 | 75 | ||
96 | extern int expand_files(struct files_struct *, int nr); | ||
97 | extern void free_fdtable_rcu(struct rcu_head *rcu); | ||
98 | extern void __init files_defer_init(void); | 76 | extern void __init files_defer_init(void); |
99 | 77 | ||
100 | static inline void free_fdtable(struct fdtable *fdt) | ||
101 | { | ||
102 | call_rcu(&fdt->rcu, free_fdtable_rcu); | ||
103 | } | ||
104 | |||
105 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) | 78 | static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) |
106 | { | 79 | { |
107 | struct file * file = NULL; | 80 | struct file * file = NULL; |
@@ -122,8 +95,20 @@ struct task_struct; | |||
122 | struct files_struct *get_files_struct(struct task_struct *); | 95 | struct files_struct *get_files_struct(struct task_struct *); |
123 | void put_files_struct(struct files_struct *fs); | 96 | void put_files_struct(struct files_struct *fs); |
124 | void reset_files_struct(struct files_struct *); | 97 | void reset_files_struct(struct files_struct *); |
98 | void daemonize_descriptors(void); | ||
125 | int unshare_files(struct files_struct **); | 99 | int unshare_files(struct files_struct **); |
126 | struct files_struct *dup_fd(struct files_struct *, int *); | 100 | struct files_struct *dup_fd(struct files_struct *, int *); |
101 | void do_close_on_exec(struct files_struct *); | ||
102 | int iterate_fd(struct files_struct *, unsigned, | ||
103 | int (*)(const void *, struct file *, unsigned), | ||
104 | const void *); | ||
105 | |||
106 | extern int __alloc_fd(struct files_struct *files, | ||
107 | unsigned start, unsigned end, unsigned flags); | ||
108 | extern void __fd_install(struct files_struct *files, | ||
109 | unsigned int fd, struct file *file); | ||
110 | extern int __close_fd(struct files_struct *files, | ||
111 | unsigned int fd); | ||
127 | 112 | ||
128 | extern struct kmem_cache *files_cachep; | 113 | extern struct kmem_cache *files_cachep; |
129 | 114 | ||
diff --git a/include/linux/file.h b/include/linux/file.h index a22408bac0d0..cbacf4faf447 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -26,15 +26,44 @@ static inline void fput_light(struct file *file, int fput_needed) | |||
26 | fput(file); | 26 | fput(file); |
27 | } | 27 | } |
28 | 28 | ||
29 | struct fd { | ||
30 | struct file *file; | ||
31 | int need_put; | ||
32 | }; | ||
33 | |||
34 | static inline void fdput(struct fd fd) | ||
35 | { | ||
36 | if (fd.need_put) | ||
37 | fput(fd.file); | ||
38 | } | ||
39 | |||
29 | extern struct file *fget(unsigned int fd); | 40 | extern struct file *fget(unsigned int fd); |
30 | extern struct file *fget_light(unsigned int fd, int *fput_needed); | 41 | extern struct file *fget_light(unsigned int fd, int *fput_needed); |
42 | |||
43 | static inline struct fd fdget(unsigned int fd) | ||
44 | { | ||
45 | int b; | ||
46 | struct file *f = fget_light(fd, &b); | ||
47 | return (struct fd){f,b}; | ||
48 | } | ||
49 | |||
31 | extern struct file *fget_raw(unsigned int fd); | 50 | extern struct file *fget_raw(unsigned int fd); |
32 | extern struct file *fget_raw_light(unsigned int fd, int *fput_needed); | 51 | extern struct file *fget_raw_light(unsigned int fd, int *fput_needed); |
52 | |||
53 | static inline struct fd fdget_raw(unsigned int fd) | ||
54 | { | ||
55 | int b; | ||
56 | struct file *f = fget_raw_light(fd, &b); | ||
57 | return (struct fd){f,b}; | ||
58 | } | ||
59 | |||
60 | extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); | ||
61 | extern int replace_fd(unsigned fd, struct file *file, unsigned flags); | ||
33 | extern void set_close_on_exec(unsigned int fd, int flag); | 62 | extern void set_close_on_exec(unsigned int fd, int flag); |
63 | extern bool get_close_on_exec(unsigned int fd); | ||
34 | extern void put_filp(struct file *); | 64 | extern void put_filp(struct file *); |
35 | extern int alloc_fd(unsigned start, unsigned flags); | 65 | extern int get_unused_fd_flags(unsigned flags); |
36 | extern int get_unused_fd(void); | 66 | #define get_unused_fd() get_unused_fd_flags(0) |
37 | #define get_unused_fd_flags(flags) alloc_fd(0, (flags)) | ||
38 | extern void put_unused_fd(unsigned int fd); | 67 | extern void put_unused_fd(unsigned int fd); |
39 | 68 | ||
40 | extern void fd_install(unsigned int fd, struct file *file); | 69 | extern void fd_install(unsigned int fd, struct file *file); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index aa110476a95b..ca6d8c806f47 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1074,7 +1074,11 @@ struct file_handle { | |||
1074 | unsigned char f_handle[0]; | 1074 | unsigned char f_handle[0]; |
1075 | }; | 1075 | }; |
1076 | 1076 | ||
1077 | #define get_file(x) atomic_long_inc(&(x)->f_count) | 1077 | static inline struct file *get_file(struct file *f) |
1078 | { | ||
1079 | atomic_long_inc(&f->f_count); | ||
1080 | return f; | ||
1081 | } | ||
1078 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 1082 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
1079 | #define file_count(x) atomic_long_read(&(x)->f_count) | 1083 | #define file_count(x) atomic_long_read(&(x)->f_count) |
1080 | 1084 | ||
@@ -1126,9 +1130,9 @@ static inline int file_check_writeable(struct file *filp) | |||
1126 | /* Page cache limit. The filesystems should put that into their s_maxbytes | 1130 | /* Page cache limit. The filesystems should put that into their s_maxbytes |
1127 | limits, otherwise bad things can happen in VM. */ | 1131 | limits, otherwise bad things can happen in VM. */ |
1128 | #if BITS_PER_LONG==32 | 1132 | #if BITS_PER_LONG==32 |
1129 | #define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) | 1133 | #define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) |
1130 | #elif BITS_PER_LONG==64 | 1134 | #elif BITS_PER_LONG==64 |
1131 | #define MAX_LFS_FILESIZE 0x7fffffffffffffffUL | 1135 | #define MAX_LFS_FILESIZE ((loff_t)0x7fffffffffffffff) |
1132 | #endif | 1136 | #endif |
1133 | 1137 | ||
1134 | #define FL_POSIX 1 | 1138 | #define FL_POSIX 1 |
diff --git a/include/linux/net.h b/include/linux/net.h index 99276c3dc89a..6ab31cabef7c 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -65,6 +65,7 @@ typedef enum { | |||
65 | struct poll_table_struct; | 65 | struct poll_table_struct; |
66 | struct pipe_inode_info; | 66 | struct pipe_inode_info; |
67 | struct inode; | 67 | struct inode; |
68 | struct file; | ||
68 | struct net; | 69 | struct net; |
69 | 70 | ||
70 | #define SOCK_ASYNC_NOSPACE 0 | 71 | #define SOCK_ASYNC_NOSPACE 0 |
@@ -246,7 +247,7 @@ extern int sock_sendmsg(struct socket *sock, struct msghdr *msg, | |||
246 | size_t len); | 247 | size_t len); |
247 | extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, | 248 | extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, |
248 | size_t size, int flags); | 249 | size_t size, int flags); |
249 | extern int sock_map_fd(struct socket *sock, int flags); | 250 | extern struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname); |
250 | extern struct socket *sockfd_lookup(int fd, int *err); | 251 | extern struct socket *sockfd_lookup(int fd, int *err); |
251 | extern struct socket *sock_from_file(struct file *file, int *err); | 252 | extern struct socket *sock_from_file(struct file *file, int *err); |
252 | #define sockfd_put(sock) fput(sock->file) | 253 | #define sockfd_put(sock) fput(sock->file) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 9c5612f0374b..9d51e260bde0 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -405,6 +405,7 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} | |||
405 | 405 | ||
406 | extern void set_dumpable(struct mm_struct *mm, int value); | 406 | extern void set_dumpable(struct mm_struct *mm, int value); |
407 | extern int get_dumpable(struct mm_struct *mm); | 407 | extern int get_dumpable(struct mm_struct *mm); |
408 | extern int __get_dumpable(unsigned long mm_flags); | ||
408 | 409 | ||
409 | /* get/set_dumpable() values */ | 410 | /* get/set_dumpable() values */ |
410 | #define SUID_DUMPABLE_DISABLED 0 | 411 | #define SUID_DUMPABLE_DISABLED 0 |