9
0
Fork 0

fs: allocate FILE table dynamically

Some systems are runnignfrom a very limited SRAM, but have a huge
malloc space in SDRAM. The bss normally is in SRAM, so we should
avoid having big structures there. The FILE table is 5120 bytes
big, so allocate it dynamically instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-03-07 16:14:16 +01:00
parent 1a66a77567
commit 32f8f583c9
1 changed files with 7 additions and 4 deletions

11
fs/fs.c
View File

@ -119,14 +119,19 @@ EXPORT_SYMBOL(mkmodestr);
static char *cwd;
static int init_cwd(void)
static FILE *files;
static int init_fs(void)
{
cwd = xzalloc(PATH_MAX);
*cwd = '/';
files = xzalloc(sizeof(FILE) * MAX_FILES);
return 0;
}
postcore_initcall(init_cwd);
postcore_initcall(init_fs);
char *normalise_link(const char *pathname, const char *symlink)
{
@ -268,8 +273,6 @@ char *get_mounted_path(const char *path)
return fdev->path;
}
static FILE files[MAX_FILES];
static FILE *get_file(void)
{
int i;