Use _DIRENT_MINSIZE when determining the number of NFS cookies to allocate,
rather than hard-coding 16.
This commit is contained in:
parent
1c42082598
commit
3ea6a6534e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cd9660_vnops.c,v 1.27 2007/07/29 13:31:08 ad Exp $ */
|
||||
/* $NetBSD: cd9660_vnops.c,v 1.28 2007/07/29 21:17:41 rumble Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.27 2007/07/29 13:31:08 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.28 2007/07/29 21:17:41 rumble Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -459,7 +459,7 @@ cd9660_readdir(v)
|
||||
if (ap->a_ncookies == NULL)
|
||||
idp->cookies = NULL;
|
||||
else {
|
||||
ncookies = uio->uio_resid / 16;
|
||||
ncookies = uio->uio_resid / _DIRENT_MINSIZE((struct dirent *)0);
|
||||
cookies = malloc(ncookies * sizeof(off_t), M_TEMP, M_WAITOK);
|
||||
idp->cookies = cookies;
|
||||
idp->ncookies = ncookies;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: filecore_vnops.c,v 1.20 2007/07/29 12:15:45 ad Exp $ */
|
||||
/* $NetBSD: filecore_vnops.c,v 1.21 2007/07/29 21:17:41 rumble Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The Regents of the University of California.
|
||||
@ -66,7 +66,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.20 2007/07/29 12:15:45 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.21 2007/07/29 21:17:41 rumble Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -317,7 +317,7 @@ filecore_readdir(v)
|
||||
cookies = NULL;
|
||||
else {
|
||||
*ap->a_ncookies = 0;
|
||||
ncookies = uio->uio_resid/16;
|
||||
ncookies = uio->uio_resid / _DIRENT_MINSIZE((struct dirent *)0);
|
||||
cookies = malloc(ncookies * sizeof(off_t), M_TEMP, M_WAITOK);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.39 2007/04/19 11:05:14 yamt Exp $ */
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.40 2007/07/29 21:17:41 rumble Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.39 2007/04/19 11:05:14 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.40 2007/07/29 21:17:41 rumble Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -1469,7 +1469,7 @@ msdosfs_readdir(v)
|
||||
uio_off = uio->uio_offset;
|
||||
|
||||
if (ap->a_ncookies) {
|
||||
nc = uio->uio_resid / 16;
|
||||
nc = uio->uio_resid / _DIRENT_MINSIZE((struct dirent *)0);
|
||||
cookies = malloc(nc * sizeof (off_t), M_TEMP, M_WAITOK);
|
||||
*ap->a_cookies = cookies;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user