Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
2f502839
Commit
2f502839
authored
Jul 18, 2018
by
Miklos Szeredi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ovl: add ovl_mmap()
Implement stacked mmap. Signed-off-by:
Miklos Szeredi
<
mszeredi@redhat.com
>
parent
de30dfd6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
fs/overlayfs/file.c
fs/overlayfs/file.c
+32
-0
No files found.
fs/overlayfs/file.c
View file @
2f502839
...
@@ -255,6 +255,37 @@ static int ovl_fsync(struct file *file, loff_t start, loff_t end, int datasync)
...
@@ -255,6 +255,37 @@ static int ovl_fsync(struct file *file, loff_t start, loff_t end, int datasync)
return
ret
;
return
ret
;
}
}
static
int
ovl_mmap
(
struct
file
*
file
,
struct
vm_area_struct
*
vma
)
{
struct
file
*
realfile
=
file
->
private_data
;
const
struct
cred
*
old_cred
;
int
ret
;
if
(
!
realfile
->
f_op
->
mmap
)
return
-
ENODEV
;
if
(
WARN_ON
(
file
!=
vma
->
vm_file
))
return
-
EIO
;
vma
->
vm_file
=
get_file
(
realfile
);
old_cred
=
ovl_override_creds
(
file_inode
(
file
)
->
i_sb
);
ret
=
call_mmap
(
vma
->
vm_file
,
vma
);
revert_creds
(
old_cred
);
if
(
ret
)
{
/* Drop reference count from new vm_file value */
fput
(
realfile
);
}
else
{
/* Drop reference count from previous vm_file value */
fput
(
file
);
}
ovl_file_accessed
(
file
);
return
ret
;
}
const
struct
file_operations
ovl_file_operations
=
{
const
struct
file_operations
ovl_file_operations
=
{
.
open
=
ovl_open
,
.
open
=
ovl_open
,
.
release
=
ovl_release
,
.
release
=
ovl_release
,
...
@@ -262,4 +293,5 @@ const struct file_operations ovl_file_operations = {
...
@@ -262,4 +293,5 @@ const struct file_operations ovl_file_operations = {
.
read_iter
=
ovl_read_iter
,
.
read_iter
=
ovl_read_iter
,
.
write_iter
=
ovl_write_iter
,
.
write_iter
=
ovl_write_iter
,
.
fsync
=
ovl_fsync
,
.
fsync
=
ovl_fsync
,
.
mmap
=
ovl_mmap
,
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment