summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cwfs/config.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-05-03 00:51:45 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-05-03 00:51:45 +0200
commit4c639475ce8cf0aec59632b6f7537169f1537f13 (patch)
treebc8aedcf42c1527d7ee62a43c5d73c923c24bcad /sys/src/cmd/cwfs/config.c
parent72e4d850a4c2b334b3442dd39aa973650e5d5ba4 (diff)
cwfs: fix 1GB memsize limitation
the malloc pool allocator is limited in its allocation size. as almost all data structures in cwfs are never freed, use brk() in ialloc() instead of mallocalign(). this means memory returned by ialloc() cannot be freed! to make sure we do not call free by accident, remove the #define malloc(n) ialloc(n, 0) macro and use ialloc() directly as in the original code to show the intend of permanent allocations.
Diffstat (limited to 'sys/src/cmd/cwfs/config.c')
-rw-r--r--sys/src/cmd/cwfs/config.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/src/cmd/cwfs/config.c b/sys/src/cmd/cwfs/config.c
index bcb8b5e58..da71fcd69 100644
--- a/sys/src/cmd/cwfs/config.c
+++ b/sys/src/cmd/cwfs/config.c
@@ -175,7 +175,7 @@ config1(int c)
Device *d, *t;
int m;
- d = malloc(sizeof(Device));
+ d = ialloc(sizeof(Device), 0);
do {
t = config();
if(d->cat.first == 0)
@@ -233,8 +233,7 @@ config(void)
if(f.error)
return devnone;
- d = malloc(sizeof(Device));
-
+ d = ialloc(sizeof(Device), 0);
c = *f.charp++;
switch(c) {
default:
@@ -277,7 +276,7 @@ config(void)
d->wren.ctrl = -1;
d->wren.targ = -1;
d->wren.lun = -1;
- d->wren.file = malloc((e - s) + 1);
+ d->wren.file = ialloc((e - s) + 1, 0);
memmove(d->wren.file, s, e - s);
d->wren.file[e - s] = 0;
break;
@@ -336,7 +335,7 @@ config(void)
d->type = Devcw;
d->cw.c = config();
d->cw.w = config();
- d->cw.ro = malloc(sizeof(Device));
+ d->cw.ro = ialloc(sizeof(Device), 0);
d->cw.ro->type = Devro;
d->cw.ro->ro.parent = d;
f.lastcw = d;