summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-03-07 16:14:16 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-14 08:42:28 +0100
commit32f8f583c9e11f85aa01e324b712e1fdd63fe797 (patch)
treed3763125b67e0fe855667b81fb2c7c1e6200e4a5 /fs
parent1a66a775674e3ae940e68c95e42dbad75af77523 (diff)
downloadbarebox-32f8f583c9e11f85aa01e324b712e1fdd63fe797.tar.gz
barebox-32f8f583c9e11f85aa01e324b712e1fdd63fe797.tar.xz
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 6346112e52..7e2fb78845 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -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;