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
nexedi
linux
Commits
6b4d0b27
Commit
6b4d0b27
authored
Feb 14, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean shmem_file_setup() a bit
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
39b65252
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
mm/shmem.c
mm/shmem.c
+9
-10
No files found.
mm/shmem.c
View file @
6b4d0b27
...
@@ -2873,15 +2873,14 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range);
...
@@ -2873,15 +2873,14 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range);
*/
*/
struct
file
*
shmem_file_setup
(
const
char
*
name
,
loff_t
size
,
unsigned
long
flags
)
struct
file
*
shmem_file_setup
(
const
char
*
name
,
loff_t
size
,
unsigned
long
flags
)
{
{
int
error
;
struct
file
*
res
;
struct
file
*
file
;
struct
inode
*
inode
;
struct
inode
*
inode
;
struct
path
path
;
struct
path
path
;
struct
dentry
*
root
;
struct
dentry
*
root
;
struct
qstr
this
;
struct
qstr
this
;
if
(
IS_ERR
(
shm_mnt
))
if
(
IS_ERR
(
shm_mnt
))
return
(
void
*
)
shm_mnt
;
return
ERR_CAST
(
shm_mnt
)
;
if
(
size
<
0
||
size
>
MAX_LFS_FILESIZE
)
if
(
size
<
0
||
size
>
MAX_LFS_FILESIZE
)
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
-
EINVAL
);
...
@@ -2889,7 +2888,7 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
...
@@ -2889,7 +2888,7 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
if
(
shmem_acct_size
(
flags
,
size
))
if
(
shmem_acct_size
(
flags
,
size
))
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
error
=
-
ENOMEM
;
res
=
ERR_PTR
(
-
ENOMEM
)
;
this
.
name
=
name
;
this
.
name
=
name
;
this
.
len
=
strlen
(
name
);
this
.
len
=
strlen
(
name
);
this
.
hash
=
0
;
/* will go */
this
.
hash
=
0
;
/* will go */
...
@@ -2899,7 +2898,7 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
...
@@ -2899,7 +2898,7 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
goto
put_memory
;
goto
put_memory
;
path
.
mnt
=
mntget
(
shm_mnt
);
path
.
mnt
=
mntget
(
shm_mnt
);
error
=
-
ENOSPC
;
res
=
ERR_PTR
(
-
ENOSPC
)
;
inode
=
shmem_get_inode
(
root
->
d_sb
,
NULL
,
S_IFREG
|
S_IRWXUGO
,
0
,
flags
);
inode
=
shmem_get_inode
(
root
->
d_sb
,
NULL
,
S_IFREG
|
S_IRWXUGO
,
0
,
flags
);
if
(
!
inode
)
if
(
!
inode
)
goto
put_dentry
;
goto
put_dentry
;
...
@@ -2909,23 +2908,23 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
...
@@ -2909,23 +2908,23 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
clear_nlink
(
inode
);
/* It is unlinked */
clear_nlink
(
inode
);
/* It is unlinked */
#ifndef CONFIG_MMU
#ifndef CONFIG_MMU
error
=
ramfs_nommu_expand_for_mapping
(
inode
,
size
);
error
=
ramfs_nommu_expand_for_mapping
(
inode
,
size
);
res
=
ERR_PTR
(
error
);
if
(
error
)
if
(
error
)
goto
put_dentry
;
goto
put_dentry
;
#endif
#endif
file
=
alloc_file
(
&
path
,
FMODE_WRITE
|
FMODE_READ
,
res
=
alloc_file
(
&
path
,
FMODE_WRITE
|
FMODE_READ
,
&
shmem_file_operations
);
&
shmem_file_operations
);
error
=
PTR_ERR
(
file
);
if
(
IS_ERR
(
res
))
if
(
IS_ERR
(
file
))
goto
put_dentry
;
goto
put_dentry
;
return
file
;
return
res
;
put_dentry:
put_dentry:
path_put
(
&
path
);
path_put
(
&
path
);
put_memory:
put_memory:
shmem_unacct_size
(
flags
,
size
);
shmem_unacct_size
(
flags
,
size
);
return
ERR_PTR
(
error
)
;
return
res
;
}
}
EXPORT_SYMBOL_GPL
(
shmem_file_setup
);
EXPORT_SYMBOL_GPL
(
shmem_file_setup
);
...
...
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