socsvn commit: r222845 - in soc2011/gk/ino64-head/sys: compat/freebsd32 kern sys

gk at FreeBSD.org gk at FreeBSD.org
Sun Jun 5 16:22:04 UTC 2011


Author: gk
Date: Sun Jun  5 16:22:01 2011
New Revision: 222845
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222845

Log:
  Extend kern_getdirentries to accept segflg and return buffer residue

Modified:
  soc2011/gk/ino64-head/sys/compat/freebsd32/freebsd32_misc.c
  soc2011/gk/ino64-head/sys/kern/vfs_syscalls.c
  soc2011/gk/ino64-head/sys/sys/syscallsubr.h

Modified: soc2011/gk/ino64-head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- soc2011/gk/ino64-head/sys/compat/freebsd32/freebsd32_misc.c	Sun Jun  5 16:21:49 2011	(r222844)
+++ soc2011/gk/ino64-head/sys/compat/freebsd32/freebsd32_misc.c	Sun Jun  5 16:22:01 2011	(r222845)
@@ -1485,7 +1485,8 @@
 	int32_t base32;
 	int error;
 
-	error = kern_getdirentries(td, uap->fd, uap->buf, uap->count, &base);
+	error = kern_getdirentries(td, uap->fd, uap->buf, uap->count,
+	    &base, NULL, UIO_USERSPACE);
 	if (error)
 		return (error);
 	if (uap->basep != NULL) {

Modified: soc2011/gk/ino64-head/sys/kern/vfs_syscalls.c
==============================================================================
--- soc2011/gk/ino64-head/sys/kern/vfs_syscalls.c	Sun Jun  5 16:21:49 2011	(r222844)
+++ soc2011/gk/ino64-head/sys/kern/vfs_syscalls.c	Sun Jun  5 16:22:01 2011	(r222845)
@@ -4062,7 +4062,8 @@
 	long base;
 	int error;
 
-	error = kern_getdirentries(td, uap->fd, uap->buf, uap->count, &base);
+	error = kern_getdirentries(td, uap->fd, uap->buf, uap->count, &base,
+	    NULL, UIO_USERSPACE);
 	if (error)
 		return (error);
 	if (uap->basep != NULL)
@@ -4072,7 +4073,7 @@
 
 int
 kern_getdirentries(struct thread *td, int fd, char *buf, u_int count,
-    long *basep)
+    long *basep, ssize_t *residp, enum uio_seg bufseg)
 {
 	struct vnode *vp;
 	struct file *fp;
@@ -4104,7 +4105,7 @@
 	auio.uio_iov = &aiov;
 	auio.uio_iovcnt = 1;
 	auio.uio_rw = UIO_READ;
-	auio.uio_segflg = UIO_USERSPACE;
+	auio.uio_segflg = bufseg;
 	auio.uio_td = td;
 	auio.uio_resid = count;
 	vn_lock(vp, LK_SHARED | LK_RETRY);
@@ -4138,6 +4139,8 @@
 	VOP_UNLOCK(vp, 0);
 	VFS_UNLOCK_GIANT(vfslocked);
 	*basep = loff;
+	if (residp != NULL)
+		*residp = auio.uio_resid;
 	td->td_retval[0] = count - auio.uio_resid;
 fail:
 	fdrop(fp, td);

Modified: soc2011/gk/ino64-head/sys/sys/syscallsubr.h
==============================================================================
--- soc2011/gk/ino64-head/sys/sys/syscallsubr.h	Sun Jun  5 16:21:49 2011	(r222844)
+++ soc2011/gk/ino64-head/sys/sys/syscallsubr.h	Sun Jun  5 16:22:01 2011	(r222845)
@@ -97,7 +97,7 @@
 int	kern_futimes(struct thread *td, int fd, struct timeval *tptr,
 	    enum uio_seg tptrseg);
 int	kern_getdirentries(struct thread *td, int fd, char *buf, u_int count,
-	    long *basep);
+	    long *basep, ssize_t *residp, enum uio_seg bufseg);
 int	kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
 	    enum uio_seg bufseg, int flags);
 int	kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups);


More information about the svn-soc-all mailing list