Commit 224e4d06 authored by Kai Germaschewski's avatar Kai Germaschewski

do_mounts: __init* cleanup

o prepare_namespace() is called before free_initmem(), so it can
  be __init.
o all static data in do_mounts.c can be __initdata for the same reason.
o move the __init into its standard location between return value
  and function name.
o root_device_name can be a char *.
parent e8f787bf
...@@ -47,8 +47,8 @@ static int __initdata mount_initrd = 0; ...@@ -47,8 +47,8 @@ static int __initdata mount_initrd = 0;
int __initdata rd_doload; /* 1 = load RAM disk, 0 = don't load */ int __initdata rd_doload; /* 1 = load RAM disk, 0 = don't load */
int root_mountflags = MS_RDONLY | MS_VERBOSE; int root_mountflags = MS_RDONLY | MS_VERBOSE;
static char root_device_name[64]; static char * __initdata root_device_name;
static char saved_root_name[64]; static char __initdata saved_root_name[64];
/* this is initialized in init/main.c */ /* this is initialized in init/main.c */
dev_t ROOT_DEV; dev_t ROOT_DEV;
...@@ -79,7 +79,7 @@ static int __init readwrite(char *str) ...@@ -79,7 +79,7 @@ static int __init readwrite(char *str)
__setup("ro", readonly); __setup("ro", readonly);
__setup("rw", readwrite); __setup("rw", readwrite);
static __init dev_t try_name(char *name, int part) static dev_t __init try_name(char *name, int part)
{ {
char path[64]; char path[64];
char buf[32]; char buf[32];
...@@ -148,7 +148,7 @@ static __init dev_t try_name(char *name, int part) ...@@ -148,7 +148,7 @@ static __init dev_t try_name(char *name, int part)
* is mounted on rootfs /sys. * is mounted on rootfs /sys.
*/ */
__init dev_t name_to_dev_t(char *name) dev_t name_to_dev_t(char *name)
{ {
char s[32]; char s[32];
char *p; char *p;
...@@ -206,8 +206,7 @@ __init dev_t name_to_dev_t(char *name) ...@@ -206,8 +206,7 @@ __init dev_t name_to_dev_t(char *name)
static int __init root_dev_setup(char *line) static int __init root_dev_setup(char *line)
{ {
strncpy(saved_root_name, line, 64); strncpy(saved_root_name, line, 63);
saved_root_name[63] = '\0';
return 1; return 1;
} }
...@@ -611,8 +610,8 @@ static void __init mount_root(void) ...@@ -611,8 +610,8 @@ static void __init mount_root(void)
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
static int old_fd, root_fd; static int __initdata old_fd, root_fd;
static int do_linuxrc(void * shell) static int __init do_linuxrc(void * shell)
{ {
static char *argv[] = { "linuxrc", NULL, }; static char *argv[] = { "linuxrc", NULL, };
extern char * envp_init[]; extern char * envp_init[];
...@@ -705,7 +704,7 @@ static void __init md_run_setup(void); ...@@ -705,7 +704,7 @@ static void __init md_run_setup(void);
/* /*
* Prepare the namespace - decide what/where to mount, load ramdisks, etc. * Prepare the namespace - decide what/where to mount, load ramdisks, etc.
*/ */
void prepare_namespace(void) void __init prepare_namespace(void)
{ {
int is_floppy; int is_floppy;
...@@ -714,11 +713,10 @@ void prepare_namespace(void) ...@@ -714,11 +713,10 @@ void prepare_namespace(void)
md_run_setup(); md_run_setup();
if (saved_root_name[0]) { if (saved_root_name[0]) {
char *p = saved_root_name; root_device_name = saved_root_name;
ROOT_DEV = name_to_dev_t(p); ROOT_DEV = name_to_dev_t(root_device_name);
if (strncmp(p, "/dev/", 5) == 0) if (strncmp(root_device_name, "/dev/", 5) == 0)
p += 5; root_device_name += 5;
strcpy(root_device_name, p);
} }
is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR; is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment