Lines Matching refs:file
23 #include <linux/file.h>
412 * __mnt_want_write_file - get write access to a file's mount
413 * @file: the file who's mount on which to take a write
415 * This is like __mnt_want_write, but if the file is already open for writing it
416 * skips incrementing mnt_writers (since the open file already has a reference)
420 int __mnt_want_write_file(struct file *file)
422 if (file->f_mode & FMODE_WRITER) {
427 if (__mnt_is_readonly(file->f_path.mnt))
431 return __mnt_want_write(file->f_path.mnt);
435 * mnt_want_write_file - get write access to a file's mount
436 * @file: the file who's mount on which to take a write
438 * This is like mnt_want_write, but if the file is already open for writing it
439 * skips incrementing mnt_writers (since the open file already has a reference)
443 int mnt_want_write_file(struct file *file)
447 sb_start_write(file_inode(file)->i_sb);
448 ret = __mnt_want_write_file(file);
450 sb_end_write(file_inode(file)->i_sb);
485 void __mnt_drop_write_file(struct file *file)
487 if (!(file->f_mode & FMODE_WRITER))
488 __mnt_drop_write(file->f_path.mnt);
491 void mnt_drop_write_file(struct file *file)
493 __mnt_drop_write_file(file);
494 sb_end_write(file_inode(file)->i_sb);
2648 static struct file *open_detached_copy(struct path *path, bool recursive)
2653 struct file *file;
2679 file = dentry_open(path, O_PATH, current_cred());
2680 if (IS_ERR(file))
2683 file->f_mode |= FMODE_NEED_UNMOUNT;
2684 return file;
2689 struct file *file;
2722 file = ERR_PTR(error);
2725 file = open_detached_copy(&path, flags & AT_RECURSIVE);
2727 file = dentry_open(&path, O_PATH, current_cred());
2730 if (IS_ERR(file)) {
2732 return PTR_ERR(file);
2734 fd_install(fd, file);
3938 * (specified by fs_fd) and attach to an open_tree-like file descriptor.
3945 struct file *file;
3977 if (!f.file)
3981 if (f.file->f_op != &fscontext_fops)
3984 fc = f.file->private_data;
4016 /* We've done the mount bit - now move the file context into more or
4038 file = dentry_open(&newmount, O_PATH, fc->cred);
4039 if (IS_ERR(file)) {
4041 ret = PTR_ERR(file);
4044 file->f_mode |= FMODE_NEED_UNMOUNT;
4048 fd_install(ret, file);
4050 fput(file);
4154 * Moves the root file system of the current process to the directory put_old,
4155 * makes new_root as the new root file system of the current process, and sets
4160 * same file system as the current process root. The put_old must be
4163 * file system may be mounted on put_old. After all, new_root is a mountpoint.
4172 * - it's okay to pick a root that isn't the root of a file system, e.g.
4227 goto out4; /* loop, on the same file system */
4528 if (!f.file)
4531 if (!proc_ns_file(f.file)) {
4536 ns = get_proc_ns(file_inode(f.file));
4773 * we unmount before file sys is unregistered
4931 * suid/sgid bits, file caps, or security labels that originate