[PATCH 09/10] fs: allocate FILE table dynamically
Sascha Hauer
s.hauer at pengutronix.de
Sat Mar 9 05:53:10 EST 2013
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 at pengutronix.de>
---
fs/fs.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/fs.c b/fs/fs.c
index 6346112..7e2fb78 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;
--
1.8.2.rc2
More information about the barebox
mailing list