--- MiNT/src/unifs.c 2018/04/24 17:57:22 1.1.1.4 +++ MiNT/src/unifs.c 2018/04/24 17:58:11 1.1.1.5 @@ -2,7 +2,7 @@ Copyright 1991,1992 Eric R. Smith. -Copyright 1992,1993 Atari Corporation. +Copyright 1992,1993,1994 Atari Corporation. All rights reserved. @@ -138,6 +138,34 @@ static UNIFILE *u_root = 0; +static long do_ulookup P_((fcookie *, const char *, fcookie *, UNIFILE **)); + + + +FILESYS * + +get_filesys (dev) + + int dev; + +{ + + UNIFILE *u; + + + + for (u = u_root; u; u = u->next) + + if (u->dev == dev) + + return u->fs; + + return (FILESYS *) 0L; + +} + + + void unifs_init() @@ -250,6 +278,32 @@ uni_lookup(dir, name, fc) { + return do_ulookup(dir, name, fc, (UNIFILE **)0); + +} + + + +/* worker function for uni_lookup; can also return the UNIFILE + + * pointer for the root directory + + */ + +static long + +do_ulookup(dir, name, fc, up) + + fcookie *dir; + + const char *name; + + fcookie *fc; + + UNIFILE **up; + +{ + UNIFILE *u; long drvs; @@ -306,6 +360,8 @@ uni_lookup(dir, name, fc) fs = u->fs; + if (up) *up = u; + return (*fs->root)(u->dev,fc); } @@ -340,6 +396,8 @@ uni_lookup(dir, name, fc) } + if (up) *up = u; + return 0; } @@ -1420,7 +1478,9 @@ uni_fscntl(dir, name, cmd, arg) /* first check that directory exists */ - r = uni_lookup(dir, name, &fc); + /* use special uni_lookup mode to get the unifile entry */ + + r = do_ulookup(dir, name, &fc, &u); if (r != 0) return EFILNF; /* name does not exist */ @@ -1432,10 +1492,10 @@ uni_fscntl(dir, name, cmd, arg) return EFILNF; /* not the right name! */ - u = (UNIFILE*)fc.index; - release_cookie(&fc); + + if (!u || (u->fs != d->file_system)) return EFILNF;