Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Jun 2011 16:21:49 +0000
From:      gk@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r222844 - in soc2011/gk/ino64-head/sys: kern sys
Message-ID:  <20110605162149.C74AD106564A@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gk
Date: Sun Jun  5 16:21:49 2011
New Revision: 222844
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222844

Log:
  Add kern_fhstat() wrapper, adjust fhstat() to use it

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

Modified: soc2011/gk/ino64-head/sys/kern/vfs_syscalls.c
==============================================================================
--- soc2011/gk/ino64-head/sys/kern/vfs_syscalls.c	Sun Jun  5 16:21:38 2011	(r222843)
+++ soc2011/gk/ino64-head/sys/kern/vfs_syscalls.c	Sun Jun  5 16:21:49 2011	(r222844)
@@ -4553,20 +4553,30 @@
  */
 #ifndef _SYS_SYSPROTO_H_
 struct fhstat_args {
-	struct fhandle *u_fhp;
+	const struct fhandle *u_fhp;
 	struct stat *sb;
 };
 #endif
 int
-fhstat(td, uap)
-	struct thread *td;
-	register struct fhstat_args /* {
-		struct fhandle *u_fhp;
-		struct stat *sb;
-	} */ *uap;
+fhstat(struct thread *td, struct fhstat_args *uap)
 {
 	struct stat sb;
-	fhandle_t fh;
+	struct fhandle fh;
+	int error;
+
+	error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t));
+	if (error != 0)
+		return (error);
+	error = kern_fhstat(td, fh, &sb);
+	if (error != 0)
+		return (error);
+	error = copyout(&sb, uap->sb, sizeof(sb));
+	return (error);
+}
+
+int
+kern_fhstat(struct thread *td, struct fhandle fh, struct stat *sb)
+{
 	struct mount *mp;
 	struct vnode *vp;
 	int vfslocked;
@@ -4575,9 +4585,6 @@
 	error = priv_check(td, PRIV_VFS_FHSTAT);
 	if (error)
 		return (error);
-	error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t));
-	if (error)
-		return (error);
 	if ((mp = vfs_busyfs(&fh.fh_fsid)) == NULL)
 		return (ESTALE);
 	vfslocked = VFS_LOCK_GIANT(mp);
@@ -4587,12 +4594,9 @@
 		VFS_UNLOCK_GIANT(vfslocked);
 		return (error);
 	}
-	error = vn_stat(vp, &sb, td->td_ucred, NOCRED, td);
+	error = vn_stat(vp, sb, td->td_ucred, NOCRED, td);
 	vput(vp);
 	VFS_UNLOCK_GIANT(vfslocked);
-	if (error)
-		return (error);
-	error = copyout(&sb, uap->sb, sizeof(sb));
 	return (error);
 }
 

Modified: soc2011/gk/ino64-head/sys/sys/syscallsubr.h
==============================================================================
--- soc2011/gk/ino64-head/sys/sys/syscallsubr.h	Sun Jun  5 16:21:38 2011	(r222843)
+++ soc2011/gk/ino64-head/sys/sys/syscallsubr.h	Sun Jun  5 16:21:49 2011	(r222844)
@@ -89,6 +89,7 @@
 int	kern_fchownat(struct thread *td, int fd, char *path,
 	    enum uio_seg pathseg, int uid, int gid, int flag);
 int	kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg);
+int	kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf);
 int	kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
 int	kern_fstat(struct thread *td, int fd, struct stat *sbp);
 int	kern_fstatfs(struct thread *td, int fd, struct statfs *buf);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110605162149.C74AD106564A>