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
702ff7f9
Commit
702ff7f9
authored
Feb 06, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Feb 06, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] (2/8) ->get_sb() switchover
get_sb_bdev() et.al. get a new argument (fill_super) and become exported.
parent
143845d1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
16 deletions
+58
-16
fs/super.c
fs/super.c
+45
-16
include/linux/fs.h
include/linux/fs.h
+10
-0
kernel/ksyms.c
kernel/ksyms.c
+3
-0
No files found.
fs/super.c
View file @
702ff7f9
...
...
@@ -641,8 +641,9 @@ struct super_block *get_anon_super(struct file_system_type *type,
return
s
;
}
static
struct
super_block
*
get_sb_bdev
(
struct
file_system_type
*
fs_type
,
int
flags
,
char
*
dev_name
,
void
*
data
)
struct
super_block
*
get_sb_bdev
(
struct
file_system_type
*
fs_type
,
int
flags
,
char
*
dev_name
,
void
*
data
,
int
(
*
fill_super
)(
struct
super_block
*
,
void
*
,
int
))
{
struct
inode
*
inode
;
struct
block_device
*
bdev
;
...
...
@@ -698,7 +699,7 @@ static struct super_block *get_sb_bdev(struct file_system_type *fs_type,
list_for_each
(
p
,
&
super_blocks
)
{
struct
super_block
*
old
=
sb_entry
(
p
);
if
(
!
kdev_same
(
old
->
s_dev
,
dev
)
)
if
(
old
->
s_bdev
!=
bdev
)
continue
;
if
(
old
->
s_type
!=
fs_type
||
((
flags
^
old
->
s_flags
)
&
MS_RDONLY
))
{
...
...
@@ -718,8 +719,8 @@ static struct super_block *get_sb_bdev(struct file_system_type *fs_type,
s
->
s_flags
=
flags
;
insert_super
(
s
,
fs_type
);
strncpy
(
s
->
s_id
,
bdevname
(
dev
),
sizeof
(
s
->
s_id
));
error
=
-
EINVAL
;
if
(
!
fs_type
->
read_super
(
s
,
data
,
flags
&
MS_VERBOSE
?
1
:
0
)
)
error
=
fill_super
(
s
,
data
,
flags
&
MS_VERBOSE
?
1
:
0
)
;
if
(
error
)
goto
failed
;
s
->
s_flags
|=
MS_ACTIVE
;
path_release
(
&
nd
);
...
...
@@ -736,19 +737,23 @@ static struct super_block *get_sb_bdev(struct file_system_type *fs_type,
return
ERR_PTR
(
error
);
}
static
struct
super_block
*
get_sb_nodev
(
struct
file_system_type
*
fs_type
,
int
flags
,
char
*
dev_name
,
void
*
data
)
struct
super_block
*
get_sb_nodev
(
struct
file_system_type
*
fs_type
,
int
flags
,
void
*
data
,
int
(
*
fill_super
)(
struct
super_block
*
,
void
*
,
int
))
{
int
error
;
struct
super_block
*
s
=
get_anon_super
(
fs_type
,
NULL
,
NULL
);
if
(
IS_ERR
(
s
))
return
s
;
s
->
s_flags
=
flags
;
if
(
!
fs_type
->
read_super
(
s
,
data
,
flags
&
MS_VERBOSE
?
1
:
0
))
{
error
=
fill_super
(
s
,
data
,
flags
&
MS_VERBOSE
?
1
:
0
);
if
(
error
)
{
deactivate_super
(
s
);
remove_super
(
s
);
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
error
);
}
s
->
s_flags
|=
MS_ACTIVE
;
return
s
;
...
...
@@ -759,19 +764,22 @@ static int compare_single(struct super_block *s, void *p)
return
1
;
}
static
struct
super_block
*
get_sb_single
(
struct
file_system_type
*
fs_type
,
int
flags
,
char
*
dev_name
,
void
*
data
)
struct
super_block
*
get_sb_single
(
struct
file_system_type
*
fs_type
,
int
flags
,
void
*
data
,
int
(
*
fill_super
)(
struct
super_block
*
,
void
*
,
int
))
{
int
error
;
struct
super_block
*
s
=
get_anon_super
(
fs_type
,
compare_single
,
NULL
);
if
(
IS_ERR
(
s
))
return
s
;
if
(
!
s
->
s_root
)
{
s
->
s_flags
=
flags
;
if
(
!
fs_type
->
read_super
(
s
,
data
,
flags
&
MS_VERBOSE
?
1
:
0
))
{
error
=
fill_super
(
s
,
data
,
flags
&
MS_VERBOSE
?
1
:
0
);
if
(
error
)
{
deactivate_super
(
s
);
remove_super
(
s
);
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
error
);
}
s
->
s_flags
|=
MS_ACTIVE
;
}
...
...
@@ -779,6 +787,27 @@ static struct super_block *get_sb_single(struct file_system_type *fs_type,
return
s
;
}
/* Will go away */
static
int
fill_super
(
struct
super_block
*
sb
,
void
*
data
,
int
verbose
)
{
return
sb
->
s_type
->
read_super
(
sb
,
data
,
verbose
)
?
0
:
-
EINVAL
;
}
static
struct
super_block
*
__get_sb_bdev
(
struct
file_system_type
*
fs_type
,
int
flags
,
char
*
dev_name
,
void
*
data
)
{
return
get_sb_bdev
(
fs_type
,
flags
,
dev_name
,
data
,
fill_super
);
}
static
struct
super_block
*
__get_sb_nodev
(
struct
file_system_type
*
fs_type
,
int
flags
,
char
*
dev_name
,
void
*
data
)
{
return
get_sb_nodev
(
fs_type
,
flags
,
data
,
fill_super
);
}
static
struct
super_block
*
__get_sb_single
(
struct
file_system_type
*
fs_type
,
int
flags
,
char
*
dev_name
,
void
*
data
)
{
return
get_sb_nodev
(
fs_type
,
flags
,
data
,
fill_super
);
}
struct
vfsmount
*
do_kern_mount
(
const
char
*
fstype
,
int
flags
,
char
*
name
,
void
*
data
)
{
...
...
@@ -795,11 +824,11 @@ do_kern_mount(const char *fstype, int flags, char *name, void *data)
if
(
type
->
get_sb
)
sb
=
type
->
get_sb
(
type
,
flags
,
name
,
data
);
else
if
(
type
->
fs_flags
&
FS_REQUIRES_DEV
)
sb
=
get_sb_bdev
(
type
,
flags
,
name
,
data
);
sb
=
__
get_sb_bdev
(
type
,
flags
,
name
,
data
);
else
if
(
type
->
fs_flags
&
FS_SINGLE
)
sb
=
get_sb_single
(
type
,
flags
,
name
,
data
);
sb
=
__
get_sb_single
(
type
,
flags
,
name
,
data
);
else
sb
=
get_sb_nodev
(
type
,
flags
,
name
,
data
);
sb
=
__
get_sb_nodev
(
type
,
flags
,
name
,
data
);
if
(
IS_ERR
(
sb
))
goto
out_mnt
;
if
(
type
->
fs_flags
&
FS_NOMOUNT
)
...
...
include/linux/fs.h
View file @
702ff7f9
...
...
@@ -946,6 +946,16 @@ struct file_system_type {
struct
list_head
fs_supers
;
};
struct
super_block
*
get_sb_bdev
(
struct
file_system_type
*
fs_type
,
int
flags
,
char
*
dev_name
,
void
*
data
,
int
(
*
fill_super
)(
struct
super_block
*
,
void
*
,
int
));
struct
super_block
*
get_sb_single
(
struct
file_system_type
*
fs_type
,
int
flags
,
void
*
data
,
int
(
*
fill_super
)(
struct
super_block
*
,
void
*
,
int
));
struct
super_block
*
get_sb_nodev
(
struct
file_system_type
*
fs_type
,
int
flags
,
void
*
data
,
int
(
*
fill_super
)(
struct
super_block
*
,
void
*
,
int
));
#define DECLARE_FSTYPE(var,type,read,flags) \
struct file_system_type var = { \
name: type, \
...
...
kernel/ksyms.c
View file @
702ff7f9
...
...
@@ -275,6 +275,9 @@ EXPORT_SYMBOL(lock_may_write);
EXPORT_SYMBOL
(
dcache_readdir
);
EXPORT_SYMBOL
(
fd_install
);
EXPORT_SYMBOL
(
put_unused_fd
);
EXPORT_SYMBOL
(
get_sb_bdev
);
EXPORT_SYMBOL
(
get_sb_nodev
);
EXPORT_SYMBOL
(
get_sb_single
);
/* for stackable file systems (lofs, wrapfs, cryptfs, etc.) */
EXPORT_SYMBOL
(
default_llseek
);
...
...
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