svn commit: r321681 - stable/11/sys/fs/fdescfs

Dmitry Chagin dchagin at FreeBSD.org
Sat Jul 29 10:30:14 UTC 2017


Author: dchagin
Date: Sat Jul 29 10:30:13 2017
New Revision: 321681
URL: https://svnweb.freebsd.org/changeset/base/321681

Log:
  MFC r320814:
  
  Style(9). Add blank line aftr {.
  
  MFC r320815:
  
  Remove init from declaration.
  
  MFC r320816:
  
  Remove init from declaration, collapse two int vars declarations into single.
  
  MFC r320817:
  
  Don't take a lock around atomic operation.
  
  MFC r320818:
  
  Eliminate the bogus cast.
  
  MFC r320819:
  
  Eliminate the bogus cast.
  
  MFC r320820:
  
  Don't initialize error in declaration.

Modified:
  stable/11/sys/fs/fdescfs/fdesc_vfsops.c
  stable/11/sys/fs/fdescfs/fdesc_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/fdescfs/fdesc_vfsops.c
==============================================================================
--- stable/11/sys/fs/fdescfs/fdesc_vfsops.c	Sat Jul 29 09:56:07 2017	(r321680)
+++ stable/11/sys/fs/fdescfs/fdesc_vfsops.c	Sat Jul 29 10:30:13 2017	(r321681)
@@ -68,6 +68,7 @@ static vfs_root_t	fdesc_root;
 int
 fdesc_cmount(struct mntarg *ma, void *data, uint64_t flags)
 {
+
 	return kernel_mount(ma, flags);
 }
 
@@ -77,10 +78,10 @@ fdesc_cmount(struct mntarg *ma, void *data, uint64_t f
 static int
 fdesc_mount(struct mount *mp)
 {
-	int error = 0;
 	struct fdescmount *fmp;
 	struct thread *td = curthread;
 	struct vnode *rvp;
+	int error;
 
 	if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_FDESCFS))
 		return (EPERM);
@@ -98,7 +99,7 @@ fdesc_mount(struct mount *mp)
 	 * We need to initialize a few bits of our local mount point struct to
 	 * avoid confusion in allocvp.
 	 */
-	mp->mnt_data = (qaddr_t) fmp;
+	mp->mnt_data = fmp;
 	fmp->flags = 0;
 	error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp);
 	if (error) {
@@ -122,11 +123,10 @@ static int
 fdesc_unmount(struct mount *mp, int mntflags)
 {
 	struct fdescmount *fmp;
-	caddr_t data;
-	int error;
-	int flags = 0;
+	int error, flags;
 
-	fmp = (struct fdescmount *)mp->mnt_data;
+	flags = 0;
+	fmp = mp->mnt_data;
 	if (mntflags & MNT_FORCE) {
 		/* The hash mutex protects the private mount flags. */
 		mtx_lock(&fdesc_hashmtx);
@@ -147,15 +147,10 @@ fdesc_unmount(struct mount *mp, int mntflags)
 		return (error);
 
 	/*
-	 * Finally, throw away the fdescmount structure. Hold the hashmtx to
-	 * protect the fdescmount structure.
+	 * Finally, throw away the fdescmount structure.
 	 */
-	mtx_lock(&fdesc_hashmtx);
-	data = mp->mnt_data;
 	mp->mnt_data = NULL;
-	mtx_unlock(&fdesc_hashmtx);
-	free(data, M_FDESCMNT);	/* XXX */
-
+	free(fmp, M_FDESCMNT);
 	return (0);
 }
 

Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c
==============================================================================
--- stable/11/sys/fs/fdescfs/fdesc_vnops.c	Sat Jul 29 09:56:07 2017	(r321680)
+++ stable/11/sys/fs/fdescfs/fdesc_vnops.c	Sat Jul 29 10:30:13 2017	(r321681)
@@ -152,7 +152,7 @@ fdesc_allocvp(fdntype ftype, unsigned fd_fd, int ix, s
 	struct fdescnode *fd, *fd2;
 	struct vnode *vp, *vp2;
 	struct thread *td;
-	int error = 0;
+	int error;
 
 	td = curthread;
 	fc = FD_NHASH(ix);


More information about the svn-src-all mailing list