Update of /cvsroot/netnice/FreeBSD5/fs/nnfs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32479/fs/nnfs
Modified Files:
Tag: netnice54
nnfs.h nnfs_netnice.c nnfs_subr.c nnfs_vnops.c
Log Message:
A bug in calculation of VIF dir entries is fixed.
Index: nnfs_netnice.c
===================================================================
RCS file: /cvsroot/netnice/FreeBSD5/fs/nnfs/Attic/nnfs_netnice.c,v
retrieving revision 1.1.8.2
retrieving revision 1.1.8.3
diff -u -d -r1.1.8.2 -r1.1.8.3
--- nnfs_netnice.c 23 Jul 2005 13:42:57 -0000 1.1.8.2
+++ nnfs_netnice.c 26 Apr 2006 17:17:33 -0000 1.1.8.3
@@ -259,7 +259,7 @@
MALLOC(finsn, struct bpf_insn *, xlen,
M_TEMP, M_WAITOK);
- error = vfs_getuserstr(uio, (char *) finsn, &xlen);
+ error = vfs_getuserdt(uio, (char *) finsn, &xlen);
if (error) {
FREE(finsn, M_TEMP);
return error;
Index: nnfs_subr.c
===================================================================
RCS file: /cvsroot/netnice/FreeBSD5/fs/nnfs/Attic/nnfs_subr.c,v
retrieving revision 1.1.8.2
retrieving revision 1.1.8.3
diff -u -d -r1.1.8.2 -r1.1.8.3
--- nnfs_subr.c 23 Jul 2005 13:42:58 -0000 1.1.8.2
+++ nnfs_subr.c 26 Apr 2006 17:17:33 -0000 1.1.8.3
@@ -210,4 +210,28 @@
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/FreeBSD5/fs/nnfs/Attic/nnfs_vnops.c,v
retrieving revision 1.1.8.2
retrieving revision 1.1.8.3
diff -u -d -r1.1.8.2 -r1.1.8.3
--- nnfs_vnops.c 23 Jul 2005 13:42:58 -0000 1.1.8.2
+++ nnfs_vnops.c 26 Apr 2006 17:17:33 -0000 1.1.8.3
@@ -772,7 +772,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;
}
@@ -1606,7 +1607,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;
@@ -1665,6 +1666,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++) {
@@ -1683,7 +1686,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/FreeBSD5/fs/nnfs/Attic/nnfs.h,v
retrieving revision 1.1.8.2
retrieving revision 1.1.8.3
diff -u -d -r1.1.8.2 -r1.1.8.3
--- nnfs.h 23 Jul 2005 13:42:57 -0000 1.1.8.2
+++ nnfs.h 26 Apr 2006 17:17:33 -0000 1.1.8.3
@@ -319,6 +319,7 @@
/* in vfs_cache.c */
int __getname __P((struct vnode *, char *, int));
int vfs_getuserstr __P((struct uio *, char *, int *));
+int nnfs_getuserdt __P((struct uio *, char *, int));
extern vop_t **nnfs_vnodeop_p;
|