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
0036dac9
Commit
0036dac9
authored
Feb 22, 2003
by
Kai Germaschewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do_mounts: Separate out common root mounting code into do_mount_root()
Small savings, but somewhat nicer anyway.
parent
9b561322
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
init/do_mounts.c
init/do_mounts.c
+21
-12
No files found.
init/do_mounts.c
View file @
0036dac9
...
@@ -225,6 +225,22 @@ static void __init get_fs_names(char *page)
...
@@ -225,6 +225,22 @@ static void __init get_fs_names(char *page)
}
}
*
s
=
'\0'
;
*
s
=
'\0'
;
}
}
static
int
__init
do_mount_root
(
char
*
name
,
char
*
fs
,
int
flags
,
void
*
data
)
{
int
err
=
sys_mount
(
name
,
"/root"
,
fs
,
flags
,
data
);
if
(
err
)
return
err
;
sys_chdir
(
"/root"
);
ROOT_DEV
=
current
->
fs
->
pwdmnt
->
mnt_sb
->
s_dev
;
printk
(
"VFS: Mounted root (%s filesystem)%s.
\n
"
,
current
->
fs
->
pwdmnt
->
mnt_sb
->
s_type
->
name
,
current
->
fs
->
pwdmnt
->
mnt_sb
->
s_flags
&
MS_RDONLY
?
" readonly"
:
""
);
return
0
;
}
void
__init
mount_block_root
(
char
*
name
,
int
flags
)
void
__init
mount_block_root
(
char
*
name
,
int
flags
)
{
{
char
*
fs_names
=
__getname
();
char
*
fs_names
=
__getname
();
...
@@ -233,7 +249,7 @@ void __init mount_block_root(char *name, int flags)
...
@@ -233,7 +249,7 @@ void __init mount_block_root(char *name, int flags)
get_fs_names
(
fs_names
);
get_fs_names
(
fs_names
);
retry:
retry:
for
(
p
=
fs_names
;
*
p
;
p
+=
strlen
(
p
)
+
1
)
{
for
(
p
=
fs_names
;
*
p
;
p
+=
strlen
(
p
)
+
1
)
{
int
err
=
sys_mount
(
name
,
"/root"
,
p
,
flags
,
root_mount_data
);
int
err
=
do_mount_root
(
name
,
p
,
flags
,
root_mount_data
);
switch
(
err
)
{
switch
(
err
)
{
case
0
:
case
0
:
goto
out
;
goto
out
;
...
@@ -256,11 +272,6 @@ void __init mount_block_root(char *name, int flags)
...
@@ -256,11 +272,6 @@ void __init mount_block_root(char *name, int flags)
panic
(
"VFS: Unable to mount root fs on %s"
,
kdevname
(
to_kdev_t
(
ROOT_DEV
)));
panic
(
"VFS: Unable to mount root fs on %s"
,
kdevname
(
to_kdev_t
(
ROOT_DEV
)));
out:
out:
putname
(
fs_names
);
putname
(
fs_names
);
sys_chdir
(
"/root"
);
ROOT_DEV
=
current
->
fs
->
pwdmnt
->
mnt_sb
->
s_dev
;
printk
(
"VFS: Mounted root (%s filesystem)%s.
\n
"
,
current
->
fs
->
pwdmnt
->
mnt_sb
->
s_type
->
name
,
(
current
->
fs
->
pwdmnt
->
mnt_sb
->
s_flags
&
MS_RDONLY
)
?
" readonly"
:
""
);
}
}
#ifdef CONFIG_ROOT_NFS
#ifdef CONFIG_ROOT_NFS
...
@@ -268,7 +279,8 @@ static int __init mount_nfs_root(void)
...
@@ -268,7 +279,8 @@ static int __init mount_nfs_root(void)
{
{
void
*
data
=
nfs_root_data
();
void
*
data
=
nfs_root_data
();
if
(
data
&&
sys_mount
(
"/dev/root"
,
"/root"
,
"nfs"
,
root_mountflags
,
data
)
==
0
)
if
(
data
&&
do_mount_root
(
"/dev/root"
,
"nfs"
,
root_mountflags
,
data
)
==
0
)
return
1
;
return
1
;
return
0
;
return
0
;
}
}
...
@@ -308,12 +320,9 @@ void __init mount_root(void)
...
@@ -308,12 +320,9 @@ void __init mount_root(void)
{
{
#ifdef CONFIG_ROOT_NFS
#ifdef CONFIG_ROOT_NFS
if
(
MAJOR
(
ROOT_DEV
)
==
UNNAMED_MAJOR
)
{
if
(
MAJOR
(
ROOT_DEV
)
==
UNNAMED_MAJOR
)
{
if
(
mount_nfs_root
())
{
if
(
mount_nfs_root
())
sys_chdir
(
"/root"
);
ROOT_DEV
=
current
->
fs
->
pwdmnt
->
mnt_sb
->
s_dev
;
printk
(
"VFS: Mounted root (nfs filesystem).
\n
"
);
return
;
return
;
}
printk
(
KERN_ERR
"VFS: Unable to mount root fs via NFS, trying floppy.
\n
"
);
printk
(
KERN_ERR
"VFS: Unable to mount root fs via NFS, trying floppy.
\n
"
);
ROOT_DEV
=
Root_FD0
;
ROOT_DEV
=
Root_FD0
;
}
}
...
...
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