svn commit: r225198 - in projects/ino64/sys: kern sys
Matthew D Fleming
mdf at FreeBSD.org
Fri Aug 26 17:45:57 UTC 2011
Author: mdf
Date: Fri Aug 26 17:45:56 2011
New Revision: 225198
URL: http://svn.freebsd.org/changeset/base/225198
Log:
Add kern_fhstat() wrapper, adjust fhstat() to use it.
GSoC r222844.
Gode by Gleb Kurtsou.
Modified:
projects/ino64/sys/kern/vfs_syscalls.c
projects/ino64/sys/sys/syscallsubr.h
Modified: projects/ino64/sys/kern/vfs_syscalls.c
==============================================================================
--- projects/ino64/sys/kern/vfs_syscalls.c Fri Aug 26 17:37:09 2011 (r225197)
+++ projects/ino64/sys/kern/vfs_syscalls.c Fri Aug 26 17:45:56 2011 (r225198)
@@ -4637,15 +4637,25 @@ struct fhstat_args {
};
#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(fh));
+ 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;
@@ -4654,9 +4664,6 @@ fhstat(td, uap)
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);
@@ -4666,12 +4673,9 @@ fhstat(td, uap)
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: projects/ino64/sys/sys/syscallsubr.h
==============================================================================
--- projects/ino64/sys/sys/syscallsubr.h Fri Aug 26 17:37:09 2011 (r225197)
+++ projects/ino64/sys/sys/syscallsubr.h Fri Aug 26 17:45:56 2011 (r225198)
@@ -89,6 +89,7 @@ int kern_fchmodat(struct thread *td, int
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);
More information about the svn-src-projects
mailing list