diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-07 16:14:16 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-14 08:42:28 +0100 |
commit | 32f8f583c9e11f85aa01e324b712e1fdd63fe797 (patch) | |
tree | d3763125b67e0fe855667b81fb2c7c1e6200e4a5 /fs | |
parent | 1a66a775674e3ae940e68c95e42dbad75af77523 (diff) | |
download | barebox-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.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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; |