1 |
/* inode.c - Inode management routines. |
/* inode.c - Inode management routines. |
2 |
Copyright (C) 1994,95,96,97,98,99, 2000, 2002 Free Software Foundation, Inc. |
Copyright (C) 1994,95,96,97,98,99,2000,02,03 Free Software Foundation, Inc. |
3 |
Modified for fatfs by Marcus Brinkmann <marcus@gnu.org> |
Modified for fatfs by Marcus Brinkmann <marcus@gnu.org> |
4 |
|
|
5 |
This file is part of the GNU Hurd. |
This file is part of the GNU Hurd. |
273 |
{ |
{ |
274 |
if (buf == 0) |
if (buf == 0) |
275 |
{ |
{ |
276 |
err = diskfs_cached_lookup (vk.dir_inode, &dp); |
/* FIXME: We know intimately that the parent dir is locked |
277 |
if (err) |
by libdiskfs. The only case it is not locked is for NFS |
278 |
return err; |
(fsys_getfile) and we disabled that. */ |
279 |
|
dp = ifind (vk.dir_inode); |
280 |
|
|
281 |
/* Map in the directory contents. */ |
/* Map in the directory contents. */ |
282 |
memobj = diskfs_get_filemap (dp, prot); |
memobj = diskfs_get_filemap (dp, prot); |
283 |
|
|
284 |
if (memobj == MACH_PORT_NULL) |
if (memobj == MACH_PORT_NULL) |
285 |
{ |
return errno; |
|
diskfs_nput (dp); |
|
|
return errno; |
|
|
} |
|
286 |
|
|
287 |
buflen = round_page (dp->dn_stat.st_size); |
buflen = round_page (dp->dn_stat.st_size); |
288 |
err = vm_map (mach_task_self (), |
err = vm_map (mach_task_self (), |
345 |
{ |
{ |
346 |
if (our_buf && buf) |
if (our_buf && buf) |
347 |
munmap ((caddr_t) buf, buflen); |
munmap ((caddr_t) buf, buflen); |
|
if (dp) |
|
|
diskfs_nput (dp); |
|
348 |
return err; |
return err; |
349 |
} |
} |
350 |
st->st_size = np->allocsize; |
st->st_size = np->allocsize; |
380 |
|
|
381 |
if (our_buf && buf) |
if (our_buf && buf) |
382 |
munmap ((caddr_t) buf, buflen); |
munmap ((caddr_t) buf, buflen); |
|
if (dp) |
|
|
diskfs_nput (dp); |
|
383 |
return 0; |
return 0; |
384 |
} |
} |
385 |
|
|