diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2006-01-25 21:15:56 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2006-01-25 21:15:56 +0000 |
commit | f759fa5eb9b41d25d811fe02e4a779e229ea1294 (patch) | |
tree | d94c175f61639a403435b853464bf97f214574d3 | |
parent | a9baf2a1140435e534c53cb428653db6bc3741c8 (diff) |
reduce stack use; pedro@ miod@ ok
-rw-r--r-- | sys/isofs/cd9660/cd9660_lookup.c | 11 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_vnops.c | 19 |
2 files changed, 20 insertions, 10 deletions
diff --git a/sys/isofs/cd9660/cd9660_lookup.c b/sys/isofs/cd9660/cd9660_lookup.c index 4fd4d2cad3e..d0bf7cca7d4 100644 --- a/sys/isofs/cd9660/cd9660_lookup.c +++ b/sys/isofs/cd9660/cd9660_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_lookup.c,v 1.11 2003/06/02 23:28:05 millert Exp $ */ +/* $OpenBSD: cd9660_lookup.c,v 1.12 2006/01/25 21:15:55 mickey Exp $ */ /* $NetBSD: cd9660_lookup.c,v 1.18 1997/05/08 16:19:59 mycroft Exp $ */ /*- @@ -46,6 +46,7 @@ #include <sys/vnode.h> #include <sys/mount.h> #include <sys/systm.h> +#include <sys/malloc.h> #include <isofs/cd9660/iso.h> #include <isofs/cd9660/cd9660_extern.h> @@ -118,7 +119,7 @@ cd9660_lookup(v) ino_t ino = 0; int reclen; u_short namelen; - char altname[NAME_MAX]; + char *altname; int res; int assoc, len; char *name; @@ -288,10 +289,14 @@ searchloop: else ino = dbtob(bp->b_blkno) + entryoffsetinblock; dp->i_ino = ino; + MALLOC(altname, char *, NAME_MAX, M_TEMP, M_WAITOK); cd9660_rrip_getname(ep,altname,&namelen,&dp->i_ino,imp); if (namelen == cnp->cn_namelen - && !bcmp(name,altname,namelen)) + && !bcmp(name,altname,namelen)) { + FREE(altname, M_TEMP); goto found; + } + FREE(altname, M_TEMP); ino = 0; break; } diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index c21d5cc0a88..670f7b41b41 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vnops.c,v 1.33 2005/11/19 02:18:01 pedro Exp $ */ +/* $OpenBSD: cd9660_vnops.c,v 1.34 2006/01/25 21:15:55 mickey Exp $ */ /* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */ /*- @@ -350,18 +350,23 @@ cd9660_read(v) } else { #define MAX_RA 32 if (ci->ci_lastr + 1 == lbn) { - daddr_t rablks[MAX_RA]; - int rasizes[MAX_RA]; + struct ra { + daddr_t blks[MAX_RA]; + int sizes[MAX_RA]; + } *ra; int i; + MALLOC(ra, struct ra *, sizeof *ra, + M_TEMP, M_WAITOK); for (i = 0; i < MAX_RA && lblktosize(imp, (rablock + i)) < ip->i_size; i++) { - rablks[i] = rablock + i; - rasizes[i] = blksize(imp, ip, rablock + i); + ra->blks[i] = rablock + i; + ra->sizes[i] = blksize(imp, ip, rablock + i); } - error = breadn(vp, lbn, size, rablks, - rasizes, i, NOCRED, &bp); + error = breadn(vp, lbn, size, ra->blks, + ra->sizes, i, NOCRED, &bp); + FREE(ra, M_TEMP); } else error = bread(vp, lbn, size, NOCRED, &bp); } |