[Netnice-commitlog] netnice : FreeBSD/miscfs/nnfs nnfs.h,1.1.4.2,1.1.4.3 nnfs_netnice.c,1.1.4.1,1.1.
Status: Alpha
Brought to you by:
taost6
From: Takashi O. <ta...@us...> - 2006-04-26 16:49:52
|
Update of /cvsroot/netnice/FreeBSD/miscfs/nnfs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10826/miscfs/nnfs Modified Files: Tag: netnice411 nnfs.h nnfs_netnice.c nnfs_subr.c nnfs_vnops.c Log Message: Several bugs in calculation of VIF dir entries are fixed. Index: nnfs_netnice.c =================================================================== RCS file: /cvsroot/netnice/FreeBSD/miscfs/nnfs/Attic/nnfs_netnice.c,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -u -d -r1.1.4.1 -r1.1.4.2 --- nnfs_netnice.c 1 Feb 2005 04:29:09 -0000 1.1.4.1 +++ nnfs_netnice.c 26 Apr 2006 16:49:47 -0000 1.1.4.2 @@ -254,7 +254,7 @@ MALLOC(finsn, struct bpf_insn *, xlen, M_TEMP, M_WAITOK); - error = nnfs_getuserstr(uio, (char *) finsn, &xlen); + error = nnfs_getuserdt(uio, (char *) finsn, &xlen); if (error) { FREE(finsn, M_TEMP); return error; Index: nnfs_subr.c =================================================================== RCS file: /cvsroot/netnice/FreeBSD/miscfs/nnfs/Attic/nnfs_subr.c,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.3 diff -u -d -r1.1.4.2 -r1.1.4.3 --- nnfs_subr.c 4 Feb 2005 12:48:23 -0000 1.1.4.2 +++ nnfs_subr.c 26 Apr 2006 16:49:47 -0000 1.1.4.3 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 Netnice.org + * Copyright (c) 2006 Netnice.org * All rights reserved. * * $Id$ @@ -208,3 +208,30 @@ return (0); } + + +int +nnfs_getuserdt(uio, buf, buflen) + struct uio *uio; + char *buf; + int buflen; +{ + int xlen; + int error; + + if (uio->uio_offset != 0) + return (EINVAL); + + /* must be able to read the whole string in one go */ + if (buflen < uio->uio_resid) + return (EMSGSIZE); + xlen = uio->uio_resid; + + if ((error = uiomove(buf, xlen, uio)) != 0) + return (error); + + /* allow multiple writes without seeks */ + uio->uio_offset = 0; + + return (0); +} Index: nnfs_vnops.c =================================================================== RCS file: /cvsroot/netnice/FreeBSD/miscfs/nnfs/Attic/nnfs_vnops.c,v retrieving revision 1.1.4.4 retrieving revision 1.1.4.5 diff -u -d -r1.1.4.4 -r1.1.4.5 --- nnfs_vnops.c 23 Jul 2005 11:06:06 -0000 1.1.4.4 +++ nnfs_vnops.c 26 Apr 2006 16:49:47 -0000 1.1.4.5 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 Netnice.org + * Copyright (c) 2006 Netnice.org * * $Id$ */ @@ -726,7 +726,8 @@ TAILQ_FOREACH(ptr, &vifnet, vif_link) nchild += (ptr->pptr == (caddr_t) vif ? 1 : 0); - vap->va_nlink = 2 + nvif_targets + nchild; + vap->va_nlink = 2 + nchild + nvif_targets - + ((!vif->finsn) ? 1 : 0); break; } @@ -1480,7 +1481,7 @@ case Pvif_dir: { struct vifnet *ptr, *vif = (struct vifnet *) pfs->pfs_data; struct vif_target *vt; - int j, cnt; + int j, cnt, nentry; error = 0; @@ -1539,6 +1540,8 @@ } end_vifdir: + nentry = nvif_targets + j - ((!vif->finsn) ? 1 : 0); + /* vif_targets[] */ for (cnt = 0, vt = &vif_targets[0]; uio->uio_resid >= delen && cnt < nvif_targets; vt++) { @@ -1557,7 +1560,7 @@ bcopy(vt->pt_name, dp->d_name, vt->pt_namlen + 1); dp->d_type = vt->pt_type; - if (++cnt < i - j) + if (++cnt < i - j || nentry < i) continue; i++; Index: nnfs.h =================================================================== RCS file: /cvsroot/netnice/FreeBSD/miscfs/nnfs/Attic/nnfs.h,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.3 diff -u -d -r1.1.4.2 -r1.1.4.3 --- nnfs.h 4 Feb 2005 12:48:22 -0000 1.1.4.2 +++ nnfs.h 26 Apr 2006 16:49:47 -0000 1.1.4.3 @@ -308,6 +308,7 @@ struct vifnet; int __getname __P((struct vnode *, char *, int)); /* vfs_cache.c */ int nnfs_getuserstr __P((struct uio *, char *, int *)); /* nnfs_subr.c */ +int nnfs_getuserdt __P((struct uio *, char *, int)); /* nnfs_subr.c */ int nnfs_vncache_alloc __P((struct mount *mp, struct vnode **vpp, nodeid_t *nid)); |