socsvn commit: r224116 - soc2011/gk/ino64-head/sys/kern
gk at FreeBSD.org
gk at FreeBSD.org
Mon Jul 11 07:11:11 UTC 2011
Author: gk
Date: Mon Jul 11 07:11:08 2011
New Revision: 224116
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=224116
Log:
Remove readdir cookies and set d_off in mqueue
Modified:
soc2011/gk/ino64-head/sys/kern/uipc_mqueue.c
Modified: soc2011/gk/ino64-head/sys/kern/uipc_mqueue.c
==============================================================================
--- soc2011/gk/ino64-head/sys/kern/uipc_mqueue.c Mon Jul 11 05:57:49 2011 (r224115)
+++ soc2011/gk/ino64-head/sys/kern/uipc_mqueue.c Mon Jul 11 07:11:08 2011 (r224116)
@@ -1344,8 +1344,6 @@
struct uio *a_uio;
struct ucred *a_cred;
int *a_eofflag;
- int *a_ncookies;
- u_long **a_cookies;
};
#endif
@@ -1361,7 +1359,6 @@
struct mqfs_node *pn;
struct dirent entry;
struct uio *uio;
- int *tmp_ncookies = NULL;
off_t offset;
int error, i;
@@ -1373,15 +1370,9 @@
if (vp->v_type != VDIR)
return (ENOTDIR);
- if (uio->uio_offset < 0)
+ if (uio->uio_offset < 0 || uio->uio_resid < sizeof(entry))
return (EINVAL);
- if (ap->a_ncookies != NULL) {
- tmp_ncookies = ap->a_ncookies;
- *ap->a_ncookies = 0;
- ap->a_ncookies = NULL;
- }
-
error = 0;
offset = 0;
@@ -1392,6 +1383,7 @@
if (!pn->mn_fileno)
mqfs_fileno_alloc(mi, pn);
entry.d_fileno = pn->mn_fileno;
+ entry.d_off = offset + entry.d_reclen;
for (i = 0; i < MQFS_NAMELEN - 1 && pn->mn_name[i] != '\0'; ++i)
entry.d_name[i] = pn->mn_name[i];
entry.d_name[i] = 0;
@@ -1416,19 +1408,15 @@
if (entry.d_reclen > uio->uio_resid)
break;
if (offset >= uio->uio_offset) {
- error = vfs_read_dirent(ap, &entry, offset);
+ error = vfs_read_dirent(ap, &entry);
if (error)
break;
+ uio->uio_offset = entry.d_off;
}
- offset += entry.d_reclen;
+ offset = entry.d_off;
}
sx_xunlock(&mi->mi_lock);
- uio->uio_offset = offset;
-
- if (tmp_ncookies != NULL)
- ap->a_ncookies = tmp_ncookies;
-
return (error);
}
More information about the svn-soc-all
mailing list