svn commit: r328099 - in head/sys: fs/fdescfs fs/nfs fs/nfsserver fs/smbfs fs/tmpfs i386/ibcs2 kern sys

John Baldwin jhb at FreeBSD.org
Wed Jan 17 22:37:01 UTC 2018


Author: jhb
Date: Wed Jan 17 22:36:58 2018
New Revision: 328099
URL: https://svnweb.freebsd.org/changeset/base/328099

Log:
  Use long for the last argument to VOP_PATHCONF rather than a register_t.
  
  pathconf(2) and fpathconf(2) both return a long.  The kern_[f]pathconf()
  functions now accept a pointer to a long value rather than modifying
  td_retval directly.  Instead, the system calls explicitly store the
  returned long value in td_retval[0].
  
  Requested by:	bde
  Reviewed by:	kib
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/fs/fdescfs/fdesc_vnops.c
  head/sys/fs/nfs/nfs_commonport.c
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsserver/nfs_nfsdserv.c
  head/sys/fs/smbfs/smbfs_vnops.c
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/i386/ibcs2/ibcs2_misc.c
  head/sys/kern/kern_descrip.c
  head/sys/kern/vfs_syscalls.c
  head/sys/kern/vnode_if.src
  head/sys/sys/syscallsubr.h

Modified: head/sys/fs/fdescfs/fdesc_vnops.c
==============================================================================
--- head/sys/fs/fdescfs/fdesc_vnops.c	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/fs/fdescfs/fdesc_vnops.c	Wed Jan 17 22:36:58 2018	(r328099)
@@ -418,7 +418,7 @@ fdesc_pathconf(struct vop_pathconf_args *ap)
 		vref(vp);
 		VOP_UNLOCK(vp, 0);
 		error = kern_fpathconf(curthread, VTOFDESC(vp)->fd_fd,
-		    ap->a_name);
+		    ap->a_name, ap->a_retval);
 		vn_lock(vp, LK_SHARED | LK_RETRY);
 		vunref(vp);
 		return (error);

Modified: head/sys/fs/nfs/nfs_commonport.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonport.c	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/fs/nfs/nfs_commonport.c	Wed Jan 17 22:36:58 2018	(r328099)
@@ -316,7 +316,7 @@ nfsvno_getfs(struct nfsfsinfo *sip, int isdgram)
  * Do the pathconf vnode op.
  */
 int
-nfsvno_pathconf(struct vnode *vp, int flag, register_t *retf,
+nfsvno_pathconf(struct vnode *vp, int flag, long *retf,
     struct ucred *cred, struct thread *p)
 {
 	int error;
@@ -688,7 +688,7 @@ int
 nfs_supportsnfsv4acls(struct vnode *vp)
 {
 	int error;
-	register_t retval;
+	long retval;
 
 	ASSERT_VOP_LOCKED(vp, "nfs supports nfsv4acls");
 

Modified: head/sys/fs/nfs/nfs_var.h
==============================================================================
--- head/sys/fs/nfs/nfs_var.h	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/fs/nfs/nfs_var.h	Wed Jan 17 22:36:58 2018	(r328099)
@@ -371,8 +371,7 @@ struct ucred *newnfs_getcred(void);
 void newnfs_setroot(struct ucred *);
 int nfs_catnap(int, int, const char *);
 struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);
-int nfsvno_pathconf(vnode_t, int, register_t *, struct ucred *,
-    NFSPROC_T *);
+int nfsvno_pathconf(vnode_t, int, long *, struct ucred *, NFSPROC_T *);
 int nfsrv_atroot(vnode_t, uint64_t *);
 void newnfs_timer(void *);
 int nfs_supportsnfsv4acls(vnode_t);

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdserv.c	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.c	Wed Jan 17 22:36:58 2018	(r328099)
@@ -2133,7 +2133,7 @@ nfsrvd_pathconf(struct nfsrv_descript *nd, __unused in
 {
 	struct nfsv3_pathconf *pc;
 	int getret = 1;
-	register_t linkmax, namemax, chownres, notrunc;
+	long linkmax, namemax, chownres, notrunc;
 	struct nfsvattr at;
 
 	if (nd->nd_repstat) {

Modified: head/sys/fs/smbfs/smbfs_vnops.c
==============================================================================
--- head/sys/fs/smbfs/smbfs_vnops.c	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/fs/smbfs/smbfs_vnops.c	Wed Jan 17 22:36:58 2018	(r328099)
@@ -895,7 +895,7 @@ smbfs_pathconf (ap)
 {
 	struct smbmount *smp = VFSTOSMBFS(VTOVFS(ap->a_vp));
 	struct smb_vc *vcp = SSTOVC(smp->sm_share);
-	register_t *retval = ap->a_retval;
+	long *retval = ap->a_retval;
 	int error = 0;
 	
 	switch (ap->a_name) {

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vnops.c	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c	Wed Jan 17 22:36:58 2018	(r328099)
@@ -1343,7 +1343,7 @@ tmpfs_pathconf(struct vop_pathconf_args *v)
 {
 	struct vnode *vp = v->a_vp;
 	int name = v->a_name;
-	register_t *retval = v->a_retval;
+	long *retval = v->a_retval;
 
 	int error;
 

Modified: head/sys/i386/ibcs2/ibcs2_misc.c
==============================================================================
--- head/sys/i386/ibcs2/ibcs2_misc.c	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/i386/ibcs2/ibcs2_misc.c	Wed Jan 17 22:36:58 2018	(r328099)
@@ -737,12 +737,16 @@ int
 ibcs2_pathconf(struct thread *td, struct ibcs2_pathconf_args *uap)
 {
 	char *path;
+	long value;
 	int error;
 
 	CHECKALTEXIST(td, uap->path, &path);
 	uap->name++;	/* iBCS2 _PC_* defines are offset by one */
-	error = kern_pathconf(td, path, UIO_SYSSPACE, uap->name, FOLLOW);
+	error = kern_pathconf(td, path, UIO_SYSSPACE, uap->name, FOLLOW,
+	    &value);
 	free(path, M_TEMP);
+	if (error == 0)
+		td->td_retval[0] = value;
 	return (error);
 }
 

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/kern/kern_descrip.c	Wed Jan 17 22:36:58 2018	(r328099)
@@ -1418,12 +1418,17 @@ struct fpathconf_args {
 int
 sys_fpathconf(struct thread *td, struct fpathconf_args *uap)
 {
+	long value;
+	int error;
 
-	return (kern_fpathconf(td, uap->fd, uap->name));
+	error = kern_fpathconf(td, uap->fd, uap->name, &value);
+	if (error == 0)
+		td->td_retval[0] = value;
+	return (error);
 }
 
 int
-kern_fpathconf(struct thread *td, int fd, int name)
+kern_fpathconf(struct thread *td, int fd, int name, long *valuep)
 {
 	struct file *fp;
 	struct vnode *vp;
@@ -1435,19 +1440,19 @@ kern_fpathconf(struct thread *td, int fd, int name)
 		return (error);
 
 	if (name == _PC_ASYNC_IO) {
-		td->td_retval[0] = _POSIX_ASYNCHRONOUS_IO;
+		*valuep = _POSIX_ASYNCHRONOUS_IO;
 		goto out;
 	}
 	vp = fp->f_vnode;
 	if (vp != NULL) {
 		vn_lock(vp, LK_SHARED | LK_RETRY);
-		error = VOP_PATHCONF(vp, name, td->td_retval);
+		error = VOP_PATHCONF(vp, name, valuep);
 		VOP_UNLOCK(vp, 0);
 	} else if (fp->f_type == DTYPE_PIPE || fp->f_type == DTYPE_SOCKET) {
 		if (name != _PC_PIPE_BUF) {
 			error = EINVAL;
 		} else {
-			td->td_retval[0] = PIPE_BUF;
+			*valuep = PIPE_BUF;
 			error = 0;
 		}
 	} else {

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/kern/vfs_syscalls.c	Wed Jan 17 22:36:58 2018	(r328099)
@@ -2384,8 +2384,14 @@ struct pathconf_args {
 int
 sys_pathconf(struct thread *td, struct pathconf_args *uap)
 {
+	long value;
+	int error;
 
-	return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, FOLLOW));
+	error = kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, FOLLOW,
+	    &value);
+	if (error == 0)
+		td->td_retval[0] = value;
+	return (error);
 }
 
 #ifndef _SYS_SYSPROTO_H_
@@ -2397,14 +2403,19 @@ struct lpathconf_args {
 int
 sys_lpathconf(struct thread *td, struct lpathconf_args *uap)
 {
+	long value;
+	int error;
 
-	return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name,
-	    NOFOLLOW));
+	error = kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name,
+	    NOFOLLOW, &value);
+	if (error == 0)
+		td->td_retval[0] = value;
+	return (error);
 }
 
 int
 kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name,
-    u_long flags)
+    u_long flags, long *valuep)
 {
 	struct nameidata nd;
 	int error;
@@ -2415,7 +2426,7 @@ kern_pathconf(struct thread *td, char *path, enum uio_
 		return (error);
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 
-	error = VOP_PATHCONF(nd.ni_vp, name, td->td_retval);
+	error = VOP_PATHCONF(nd.ni_vp, name, valuep);
 	vput(nd.ni_vp);
 	return (error);
 }

Modified: head/sys/kern/vnode_if.src
==============================================================================
--- head/sys/kern/vnode_if.src	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/kern/vnode_if.src	Wed Jan 17 22:36:58 2018	(r328099)
@@ -429,7 +429,7 @@ vop_print {
 vop_pathconf {
 	IN struct vnode *vp;
 	IN int name;
-	OUT register_t *retval;
+	OUT long *retval;
 };
 
 

Modified: head/sys/sys/syscallsubr.h
==============================================================================
--- head/sys/sys/syscallsubr.h	Wed Jan 17 22:33:19 2018	(r328098)
+++ head/sys/sys/syscallsubr.h	Wed Jan 17 22:36:58 2018	(r328099)
@@ -118,7 +118,7 @@ int	kern_fcntl(struct thread *td, int fd, int cmd, int
 int	kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long 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_fpathconf(struct thread *td, int fd, int name);
+int	kern_fpathconf(struct thread *td, int fd, int name, long *valuep);
 int	kern_fstat(struct thread *td, int fd, struct stat *sbp);
 int	kern_fstatfs(struct thread *td, int fd, struct statfs *buf);
 int	kern_fsync(struct thread *td, int fd, bool fullsync);
@@ -187,7 +187,7 @@ int	kern_ogetdirentries(struct thread *td, struct oget
 int	kern_openat(struct thread *td, int fd, char *path,
 	    enum uio_seg pathseg, int flags, int mode);
 int	kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg,
-	    int name, u_long flags);
+	    int name, u_long flags, long *valuep);
 int	kern_pipe(struct thread *td, int fildes[2], int flags,
 	    struct filecaps *fcaps1, struct filecaps *fcaps2);
 int	kern_poll(struct thread *td, struct pollfd *fds, u_int nfds,


More information about the svn-src-head mailing list