Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linux-seco-imx
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Jira
Code
Merge requests
12
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Clea OS
bsp
nxp
linux-seco-imx
Commits
2f502839
Commit
2f502839
authored
6 years ago
by
Miklos Szeredi
Browse files
Options
Downloads
Patches
Plain Diff
ovl: add ovl_mmap()
Implement stacked mmap. Signed-off-by:
Miklos Szeredi
<
mszeredi@redhat.com
>
parent
de30dfd6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fs/overlayfs/file.c
+32
-0
32 additions, 0 deletions
fs/overlayfs/file.c
with
32 additions
and
0 deletions
fs/overlayfs/file.c
+
32
−
0
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
,
};
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment