mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs update from Al Viro:
- big one - consolidation of descriptor-related logics; almost all of
that is moved to fs/file.c
(BTW, I'm seriously tempted to rename the result to fd.c. As it is,
we have a situation when file_table.c is about handling of struct
file and file.c is about handling of descriptor tables; the reasons
are historical - file_table.c used to be about a static array of
struct file we used to have way back).
A lot of stray ends got cleaned up and converted to saner primitives,
disgusting mess in android/binder.c is still disgusting, but at least
doesn't poke so much in descriptor table guts anymore. A bunch of
relatively minor races got fixed in process, plus an ext4 struct file
leak.
- related thing - fget_light() partially unuglified; see fdget() in
there (and yes, it generates the code as good as we used to have).
- also related - bits of Cyrill's procfs stuff that got entangled into
that work; _not_ all of it, just the initial move to fs/proc/fd.c and
switch of fdinfo to seq_file.
- Alex's fs/coredump.c spiltoff - the same story, had been easier to
take that commit than mess with conflicts. The rest is a separate
pile, this was just a mechanical code movement.
- a few misc patches all over the place. Not all for this cycle,
there'll be more (and quite a few currently sit in akpm's tree)."
Fix up trivial conflicts in the android binder driver, and some fairly
simple conflicts due to two different changes to the sock_alloc_file()
interface ("take descriptor handling from sock_alloc_file() to callers"
vs "net: Providing protocol type via system.sockprotoname xattr of
/proc/PID/fd entries" adding a dentry name to the socket)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (72 commits)
MAX_LFS_FILESIZE should be a loff_t
compat: fs: Generic compat_sys_sendfile implementation
fs: push rcu_barrier() from deactivate_locked_super() to filesystems
btrfs: reada_extent doesn't need kref for refcount
coredump: move core dump functionality into its own file
coredump: prevent double-free on an error path in core dumper
usb/gadget: fix misannotations
fcntl: fix misannotations
ceph: don't abuse d_delete() on failure exits
hypfs: ->d_parent is never NULL or negative
vfs: delete surplus inode NULL check
switch simple cases of fget_light to fdget
new helpers: fdget()/fdput()
switch o2hb_region_dev_write() to fget_light()
proc_map_files_readdir(): don't bother with grabbing files
make get_file() return its argument
vhost_set_vring(): turn pollstart/pollstop into bool
switch prctl_set_mm_exe_file() to fget_light()
switch xfs_find_handle() to fget_light()
switch xfs_swapext() to fget_light()
...
This commit is contained in:
commit
aab174f0df
142 changed files with 2915 additions and 2877 deletions
|
|
@ -590,6 +590,9 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
|
|||
unsigned long liovcnt, const struct compat_iovec __user *rvec,
|
||||
unsigned long riovcnt, unsigned long flags);
|
||||
|
||||
asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
|
||||
compat_off_t __user *offset, compat_size_t count);
|
||||
|
||||
#else
|
||||
|
||||
#define is_compat_task() (0)
|
||||
|
|
|
|||
|
|
@ -30,31 +30,11 @@ struct fdtable {
|
|||
struct fdtable *next;
|
||||
};
|
||||
|
||||
static inline void __set_close_on_exec(int fd, struct fdtable *fdt)
|
||||
{
|
||||
__set_bit(fd, fdt->close_on_exec);
|
||||
}
|
||||
|
||||
static inline void __clear_close_on_exec(int fd, struct fdtable *fdt)
|
||||
{
|
||||
__clear_bit(fd, fdt->close_on_exec);
|
||||
}
|
||||
|
||||
static inline bool close_on_exec(int fd, const struct fdtable *fdt)
|
||||
{
|
||||
return test_bit(fd, fdt->close_on_exec);
|
||||
}
|
||||
|
||||
static inline void __set_open_fd(int fd, struct fdtable *fdt)
|
||||
{
|
||||
__set_bit(fd, fdt->open_fds);
|
||||
}
|
||||
|
||||
static inline void __clear_open_fd(int fd, struct fdtable *fdt)
|
||||
{
|
||||
__clear_bit(fd, fdt->open_fds);
|
||||
}
|
||||
|
||||
static inline bool fd_is_open(int fd, const struct fdtable *fdt)
|
||||
{
|
||||
return test_bit(fd, fdt->open_fds);
|
||||
|
|
@ -93,15 +73,8 @@ struct file_operations;
|
|||
struct vfsmount;
|
||||
struct dentry;
|
||||
|
||||
extern int expand_files(struct files_struct *, int nr);
|
||||
extern void free_fdtable_rcu(struct rcu_head *rcu);
|
||||
extern void __init files_defer_init(void);
|
||||
|
||||
static inline void free_fdtable(struct fdtable *fdt)
|
||||
{
|
||||
call_rcu(&fdt->rcu, free_fdtable_rcu);
|
||||
}
|
||||
|
||||
static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd)
|
||||
{
|
||||
struct file * file = NULL;
|
||||
|
|
@ -122,8 +95,20 @@ struct task_struct;
|
|||
struct files_struct *get_files_struct(struct task_struct *);
|
||||
void put_files_struct(struct files_struct *fs);
|
||||
void reset_files_struct(struct files_struct *);
|
||||
void daemonize_descriptors(void);
|
||||
int unshare_files(struct files_struct **);
|
||||
struct files_struct *dup_fd(struct files_struct *, int *);
|
||||
void do_close_on_exec(struct files_struct *);
|
||||
int iterate_fd(struct files_struct *, unsigned,
|
||||
int (*)(const void *, struct file *, unsigned),
|
||||
const void *);
|
||||
|
||||
extern int __alloc_fd(struct files_struct *files,
|
||||
unsigned start, unsigned end, unsigned flags);
|
||||
extern void __fd_install(struct files_struct *files,
|
||||
unsigned int fd, struct file *file);
|
||||
extern int __close_fd(struct files_struct *files,
|
||||
unsigned int fd);
|
||||
|
||||
extern struct kmem_cache *files_cachep;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,15 +26,44 @@ static inline void fput_light(struct file *file, int fput_needed)
|
|||
fput(file);
|
||||
}
|
||||
|
||||
struct fd {
|
||||
struct file *file;
|
||||
int need_put;
|
||||
};
|
||||
|
||||
static inline void fdput(struct fd fd)
|
||||
{
|
||||
if (fd.need_put)
|
||||
fput(fd.file);
|
||||
}
|
||||
|
||||
extern struct file *fget(unsigned int fd);
|
||||
extern struct file *fget_light(unsigned int fd, int *fput_needed);
|
||||
|
||||
static inline struct fd fdget(unsigned int fd)
|
||||
{
|
||||
int b;
|
||||
struct file *f = fget_light(fd, &b);
|
||||
return (struct fd){f,b};
|
||||
}
|
||||
|
||||
extern struct file *fget_raw(unsigned int fd);
|
||||
extern struct file *fget_raw_light(unsigned int fd, int *fput_needed);
|
||||
|
||||
static inline struct fd fdget_raw(unsigned int fd)
|
||||
{
|
||||
int b;
|
||||
struct file *f = fget_raw_light(fd, &b);
|
||||
return (struct fd){f,b};
|
||||
}
|
||||
|
||||
extern int f_dupfd(unsigned int from, struct file *file, unsigned flags);
|
||||
extern int replace_fd(unsigned fd, struct file *file, unsigned flags);
|
||||
extern void set_close_on_exec(unsigned int fd, int flag);
|
||||
extern bool get_close_on_exec(unsigned int fd);
|
||||
extern void put_filp(struct file *);
|
||||
extern int alloc_fd(unsigned start, unsigned flags);
|
||||
extern int get_unused_fd(void);
|
||||
#define get_unused_fd_flags(flags) alloc_fd(0, (flags))
|
||||
extern int get_unused_fd_flags(unsigned flags);
|
||||
#define get_unused_fd() get_unused_fd_flags(0)
|
||||
extern void put_unused_fd(unsigned int fd);
|
||||
|
||||
extern void fd_install(unsigned int fd, struct file *file);
|
||||
|
|
|
|||
|
|
@ -1074,7 +1074,11 @@ struct file_handle {
|
|||
unsigned char f_handle[0];
|
||||
};
|
||||
|
||||
#define get_file(x) atomic_long_inc(&(x)->f_count)
|
||||
static inline struct file *get_file(struct file *f)
|
||||
{
|
||||
atomic_long_inc(&f->f_count);
|
||||
return f;
|
||||
}
|
||||
#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
|
||||
#define file_count(x) atomic_long_read(&(x)->f_count)
|
||||
|
||||
|
|
@ -1126,9 +1130,9 @@ static inline int file_check_writeable(struct file *filp)
|
|||
/* Page cache limit. The filesystems should put that into their s_maxbytes
|
||||
limits, otherwise bad things can happen in VM. */
|
||||
#if BITS_PER_LONG==32
|
||||
#define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
|
||||
#define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
|
||||
#elif BITS_PER_LONG==64
|
||||
#define MAX_LFS_FILESIZE 0x7fffffffffffffffUL
|
||||
#define MAX_LFS_FILESIZE ((loff_t)0x7fffffffffffffff)
|
||||
#endif
|
||||
|
||||
#define FL_POSIX 1
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ typedef enum {
|
|||
struct poll_table_struct;
|
||||
struct pipe_inode_info;
|
||||
struct inode;
|
||||
struct file;
|
||||
struct net;
|
||||
|
||||
#define SOCK_ASYNC_NOSPACE 0
|
||||
|
|
@ -246,7 +247,7 @@ extern int sock_sendmsg(struct socket *sock, struct msghdr *msg,
|
|||
size_t len);
|
||||
extern int sock_recvmsg(struct socket *sock, struct msghdr *msg,
|
||||
size_t size, int flags);
|
||||
extern int sock_map_fd(struct socket *sock, int flags);
|
||||
extern struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
|
||||
extern struct socket *sockfd_lookup(int fd, int *err);
|
||||
extern struct socket *sock_from_file(struct file *file, int *err);
|
||||
#define sockfd_put(sock) fput(sock->file)
|
||||
|
|
|
|||
|
|
@ -405,6 +405,7 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
|
|||
|
||||
extern void set_dumpable(struct mm_struct *mm, int value);
|
||||
extern int get_dumpable(struct mm_struct *mm);
|
||||
extern int __get_dumpable(unsigned long mm_flags);
|
||||
|
||||
/* get/set_dumpable() values */
|
||||
#define SUID_DUMPABLE_DISABLED 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue