mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
Merge branch 'work.open3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs open-related updates from Al Viro:
- "do we need fput() or put_filp()" rules are gone - it's always fput()
now. We keep track of that state where it belongs - in ->f_mode.
- int *opened mess killed - in finish_open(), in ->atomic_open()
instances and in fs/namei.c code around do_last()/lookup_open()/atomic_open().
- alloc_file() wrappers with saner calling conventions are introduced
(alloc_file_clone() and alloc_file_pseudo()); callers converted, with
much simplification.
- while we are at it, saner calling conventions for path_init() and
link_path_walk(), simplifying things inside fs/namei.c (both on
open-related paths and elsewhere).
* 'work.open3' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (40 commits)
few more cleanups of link_path_walk() callers
allow link_path_walk() to take ERR_PTR()
make path_init() unconditionally paired with terminate_walk()
document alloc_file() changes
make alloc_file() static
do_shmat(): grab shp->shm_file earlier, switch to alloc_file_clone()
new helper: alloc_file_clone()
create_pipe_files(): switch the first allocation to alloc_file_pseudo()
anon_inode_getfile(): switch to alloc_file_pseudo()
hugetlb_file_setup(): switch to alloc_file_pseudo()
ocxlflash_getfile(): switch to alloc_file_pseudo()
cxl_getfile(): switch to alloc_file_pseudo()
... and switch shmem_file_setup() to alloc_file_pseudo()
__shmem_file_setup(): reorder allocations
new wrapper: alloc_file_pseudo()
kill FILE_{CREATED,OPENED}
switch atomic_open() and lookup_open() to returning 0 in all success cases
document ->atomic_open() changes
->atomic_open(): return 0 in all success cases
get rid of 'opened' in path_openat() and the helpers downstream
...
This commit is contained in:
commit
a66b4cd1e7
45 changed files with 371 additions and 576 deletions
|
|
@ -88,10 +88,8 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
|
|||
const struct file_operations *fops,
|
||||
void *priv, int flags)
|
||||
{
|
||||
struct qstr this;
|
||||
struct path path;
|
||||
struct file *file;
|
||||
struct inode *inode = NULL;
|
||||
struct inode *inode;
|
||||
int rc;
|
||||
|
||||
if (fops->owner && !try_module_get(fops->owner)) {
|
||||
|
|
@ -116,29 +114,15 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
|
|||
goto err3;
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.len = strlen(name);
|
||||
this.hash = 0;
|
||||
path.dentry = d_alloc_pseudo(ocxlflash_vfs_mount->mnt_sb, &this);
|
||||
if (!path.dentry) {
|
||||
dev_err(dev, "%s: d_alloc_pseudo failed\n", __func__);
|
||||
rc = -ENOMEM;
|
||||
goto err4;
|
||||
}
|
||||
|
||||
path.mnt = mntget(ocxlflash_vfs_mount);
|
||||
d_instantiate(path.dentry, inode);
|
||||
|
||||
file = alloc_file(&path, OPEN_FMODE(flags), fops);
|
||||
file = alloc_file_pseudo(inode, ocxlflash_vfs_mount, name,
|
||||
flags & (O_ACCMODE | O_NONBLOCK), fops);
|
||||
if (IS_ERR(file)) {
|
||||
rc = PTR_ERR(file);
|
||||
dev_err(dev, "%s: alloc_file failed rc=%d\n",
|
||||
__func__, rc);
|
||||
path_put(&path);
|
||||
goto err3;
|
||||
goto err4;
|
||||
}
|
||||
|
||||
file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
|
||||
file->private_data = priv;
|
||||
out:
|
||||
return file;
|
||||
|
|
|
|||
Loading…
Reference in a new issue