git: 312d49ef7afc - main - unionfs: style

Jason A. Harmening jah at FreeBSD.org
Wed Sep 1 14:51:49 UTC 2021


The branch main has been updated by jah:

URL: https://cgit.FreeBSD.org/src/commit/?id=312d49ef7afcef2d7f50dcf4925011bd948646b8

commit 312d49ef7afcef2d7f50dcf4925011bd948646b8
Author:     Jason A. Harmening <jah at FreeBSD.org>
AuthorDate: 2021-08-31 01:55:42 +0000
Commit:     Jason A. Harmening <jah at FreeBSD.org>
CommitDate: 2021-09-01 14:55:37 +0000

    unionfs: style
    
    Fix the more egregious style(9) violations in unionfs.
    No functional change intended.
---
 sys/fs/unionfs/union.h        |  48 ++++++++-----
 sys/fs/unionfs/union_subr.c   | 131 +++++++++++++++++-----------------
 sys/fs/unionfs/union_vfsops.c |  26 +++----
 sys/fs/unionfs/union_vnops.c  | 162 ++++++++++++++++++++++++------------------
 4 files changed, 200 insertions(+), 167 deletions(-)

diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h
index a3484f818c66..79469a5957f4 100644
--- a/sys/fs/unionfs/union.h
+++ b/sys/fs/unionfs/union.h
@@ -113,24 +113,36 @@ struct unionfs_node {
 #define	VTOUNIONFS(vp) ((struct unionfs_node *)(vp)->v_data)
 #define	UNIONFSTOV(xp) ((xp)->un_vnode)
 
-int unionfs_init(struct vfsconf *vfsp);
-int unionfs_uninit(struct vfsconf *vfsp);
-int unionfs_nodeget(struct mount *mp, struct vnode *uppervp, struct vnode *lowervp, struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct thread *td);
-void unionfs_noderem(struct vnode *vp, struct thread *td);
-void unionfs_get_node_status(struct unionfs_node *unp, struct thread *td, struct unionfs_node_status **unspp);
-void unionfs_tryrem_node_status(struct unionfs_node *unp, struct unionfs_node_status *unsp);
-
-int unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td);
-int unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred, struct thread *td);
-void unionfs_create_uppervattr_core(struct unionfs_mount *ump, struct vattr *lva, struct vattr *uva, struct thread *td);
-int unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, struct vattr *uva, struct ucred *cred, struct thread *td);
-int unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *duvp, struct unionfs_node *unp, struct componentname *cnp, struct thread *td);
-int unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp,
-    struct thread *td, char *path, int pathlen);
-int unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct componentname *cn, struct thread *td, char *path, int pathlen, u_long nameiop);
-int unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, struct thread *td);
-int unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, struct thread *td);
-int unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, struct thread *td);
+int	unionfs_init(struct vfsconf *);
+int	unionfs_uninit(struct vfsconf *);
+int	unionfs_nodeget(struct mount *, struct vnode *, struct vnode *,
+	    struct vnode *, struct vnode **, struct componentname *,
+	    struct thread *);
+void	unionfs_noderem(struct vnode *, struct thread *);
+void	unionfs_get_node_status(struct unionfs_node *, struct thread *,
+	    struct unionfs_node_status **);
+void	unionfs_tryrem_node_status(struct unionfs_node *,
+	    struct unionfs_node_status *);
+int	unionfs_check_rmdir(struct vnode *, struct ucred *, struct thread *td);
+int	unionfs_copyfile(struct unionfs_node *, int, struct ucred *,
+	    struct thread *);
+void	unionfs_create_uppervattr_core(struct unionfs_mount *, struct vattr *,
+	    struct vattr *, struct thread *);
+int	unionfs_create_uppervattr(struct unionfs_mount *, struct vnode *,
+	    struct vattr *, struct ucred *, struct thread *);
+int	unionfs_mkshadowdir(struct unionfs_mount *, struct vnode *,
+	    struct unionfs_node *, struct componentname *, struct thread *);
+int	unionfs_mkwhiteout(struct vnode *, struct componentname *,
+	    struct thread *, char *, int);
+int	unionfs_relookup(struct vnode *, struct vnode **,
+	    struct componentname *, struct componentname *, struct thread *,
+	    char *, int, u_long);
+int	unionfs_relookup_for_create(struct vnode *, struct componentname *,
+	    struct thread *td);
+int	unionfs_relookup_for_delete(struct vnode *, struct componentname *,
+	    struct thread *);
+int	unionfs_relookup_for_rename(struct vnode *, struct componentname *,
+	    struct thread *td);
 
 #ifdef DIAGNOSTIC
 struct vnode   *unionfs_checklowervp(struct vnode *vp, char *fil, int lno);
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c
index d7d6b16a6ac8..5cb27dc94d55 100644
--- a/sys/fs/unionfs/union_subr.c
+++ b/sys/fs/unionfs/union_subr.c
@@ -131,9 +131,9 @@ unionfs_deferred_rele(void *arg __unused, int pending __unused)
 static struct unionfs_node_hashhead *
 unionfs_get_hashhead(struct vnode *dvp, char *path)
 {
+	struct unionfs_node *unp;
 	int		count;
 	char		hash;
-	struct unionfs_node *unp;
 
 	hash = 0;
 	unp = VTOUNIONFS(dvp);
@@ -150,11 +150,11 @@ unionfs_get_hashhead(struct vnode *dvp, char *path)
  */
 static struct vnode *
 unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp,
-			struct vnode *dvp, char *path)
+    struct vnode *dvp, char *path)
 {
 	struct unionfs_node_hashhead *hd;
 	struct unionfs_node *unp;
-	struct vnode   *vp;
+	struct vnode *vp;
 
 	KASSERT((uvp == NULLVP || uvp->v_type == VDIR),
 	    ("unionfs_get_cached_vnode: v_type != VDIR"));
@@ -188,11 +188,11 @@ unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp,
  */
 static struct vnode *
 unionfs_ins_cached_vnode(struct unionfs_node *uncp,
-			struct vnode *dvp, char *path)
+    struct vnode *dvp, char *path)
 {
 	struct unionfs_node_hashhead *hd;
 	struct unionfs_node *unp;
-	struct vnode   *vp;
+	struct vnode *vp;
 
 	KASSERT((uncp->un_uppervp==NULLVP || uncp->un_uppervp->v_type==VDIR),
 	    ("unionfs_ins_cached_vnode: v_type != VDIR"));
@@ -252,17 +252,16 @@ unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp)
  */
 int
 unionfs_nodeget(struct mount *mp, struct vnode *uppervp,
-		struct vnode *lowervp, struct vnode *dvp,
-		struct vnode **vpp, struct componentname *cnp,
-		struct thread *td)
+    struct vnode *lowervp, struct vnode *dvp, struct vnode **vpp,
+    struct componentname *cnp, struct thread *td)
 {
+	char	       *path;
 	struct unionfs_mount *ump;
 	struct unionfs_node *unp;
 	struct vnode   *vp;
 	int		error;
 	int		lkflags;
 	enum vtype	vt;
-	char	       *path;
 
 	ump = MOUNTTOUNIONFSMOUNT(mp);
 	lkflags = (cnp ? cnp->cn_lkflags : 0);
@@ -328,8 +327,8 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp,
 		vp->v_vnlock = lowervp->v_vnlock;
 
 	if (path != NULL) {
-		unp->un_path = (char *)
-		    malloc(cnp->cn_namelen +1, M_UNIONFSPATH, M_WAITOK|M_ZERO);
+		unp->un_path = malloc(cnp->cn_namelen + 1,
+		    M_UNIONFSPATH, M_WAITOK | M_ZERO);
 		bcopy(cnp->cn_nameptr, unp->un_path, cnp->cn_namelen);
 		unp->un_path[cnp->cn_namelen] = '\0';
 		unp->un_pathlen = cnp->cn_namelen;
@@ -373,13 +372,13 @@ unionfs_nodeget_out:
 void
 unionfs_noderem(struct vnode *vp, struct thread *td)
 {
-	int		count;
 	struct unionfs_node *unp, *unp_t1, *unp_t2;
 	struct unionfs_node_hashhead *hd;
 	struct unionfs_node_status *unsp, *unsp_tmp;
 	struct vnode   *lvp;
 	struct vnode   *uvp;
 	struct vnode   *dvp;
+	int		count;
 
 	/*
 	 * Use the interlock to protect the clearing of v_data to
@@ -456,10 +455,12 @@ unionfs_noderem(struct vnode *vp, struct thread *td)
  */
 void
 unionfs_get_node_status(struct unionfs_node *unp, struct thread *td,
-			struct unionfs_node_status **unspp)
+    struct unionfs_node_status **unspp)
 {
 	struct unionfs_node_status *unsp;
-	pid_t pid = td->td_proc->p_pid;
+	pid_t pid;
+
+	pid = td->td_proc->p_pid;
 
 	KASSERT(NULL != unspp, ("null pointer"));
 	ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), "unionfs_get_node_status");
@@ -487,7 +488,7 @@ unionfs_get_node_status(struct unionfs_node *unp, struct thread *td,
  */
 void
 unionfs_tryrem_node_status(struct unionfs_node *unp,
-			   struct unionfs_node_status *unsp)
+    struct unionfs_node_status *unsp)
 {
 	KASSERT(NULL != unsp, ("null pointer"));
 	ASSERT_VOP_ELOCKED(UNIONFSTOV(unp), "unionfs_get_node_status");
@@ -503,10 +504,8 @@ unionfs_tryrem_node_status(struct unionfs_node *unp,
  * Create upper node attr.
  */
 void
-unionfs_create_uppervattr_core(struct unionfs_mount *ump,
-			       struct vattr *lva,
-			       struct vattr *uva,
-			       struct thread *td)
+unionfs_create_uppervattr_core(struct unionfs_mount *ump, struct vattr *lva,
+    struct vattr *uva, struct thread *td)
 {
 	VATTR_NULL(uva);
 	uva->va_type = lva->va_type;
@@ -523,11 +522,13 @@ unionfs_create_uppervattr_core(struct unionfs_mount *ump,
 	case UNIONFS_MASQUERADE:
 		if (ump->um_uid == lva->va_uid) {
 			uva->va_mode = lva->va_mode & 077077;
-			uva->va_mode |= (lva->va_type == VDIR ? ump->um_udir : ump->um_ufile) & 0700;
+			uva->va_mode |= (lva->va_type == VDIR ?
+			    ump->um_udir : ump->um_ufile) & 0700;
 			uva->va_uid = lva->va_uid;
 			uva->va_gid = lva->va_gid;
 		} else {
-			uva->va_mode = (lva->va_type == VDIR ? ump->um_udir : ump->um_ufile);
+			uva->va_mode = (lva->va_type == VDIR ?
+			    ump->um_udir : ump->um_ufile);
 			uva->va_uid = ump->um_uid;
 			uva->va_gid = ump->um_gid;
 		}
@@ -544,14 +545,11 @@ unionfs_create_uppervattr_core(struct unionfs_mount *ump,
  * Create upper node attr.
  */
 int
-unionfs_create_uppervattr(struct unionfs_mount *ump,
-			  struct vnode *lvp,
-			  struct vattr *uva,
-			  struct ucred *cred,
-			  struct thread *td)
+unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp,
+    struct vattr *uva, struct ucred *cred, struct thread *td)
 {
-	int		error;
 	struct vattr	lva;
+	int		error;
 
 	if ((error = VOP_GETATTR(lvp, &lva, cred)))
 		return (error);
@@ -572,10 +570,10 @@ unionfs_create_uppervattr(struct unionfs_mount *ump,
  */
 int
 unionfs_relookup(struct vnode *dvp, struct vnode **vpp,
-		 struct componentname *cnp, struct componentname *cn,
-		 struct thread *td, char *path, int pathlen, u_long nameiop)
+    struct componentname *cnp, struct componentname *cn, struct thread *td,
+    char *path, int pathlen, u_long nameiop)
 {
-	int	error;
+	int error;
 
 	cn->cn_namelen = pathlen;
 	cn->cn_pnbuf = path;
@@ -621,12 +619,12 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp,
  */
 int
 unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp,
-			    struct thread *td)
+    struct thread *td)
 {
-	int	error;
 	struct vnode *udvp;
 	struct vnode *vp;
 	struct componentname cn;
+	int error;
 
 	udvp = UNIONFSVPTOUPPERVP(dvp);
 	vp = NULLVP;
@@ -655,12 +653,12 @@ unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp,
  */
 int
 unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp,
-			    struct thread *td)
+    struct thread *td)
 {
-	int	error;
 	struct vnode *udvp;
 	struct vnode *vp;
 	struct componentname cn;
+	int error;
 
 	udvp = UNIONFSVPTOUPPERVP(dvp);
 	vp = NULLVP;
@@ -689,12 +687,12 @@ unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp,
  */
 int
 unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp,
-			    struct thread *td)
+    struct thread *td)
 {
-	int error;
 	struct vnode *udvp;
 	struct vnode *vp;
 	struct componentname cn;
+	int error;
 
 	udvp = UNIONFSVPTOUPPERVP(dvp);
 	vp = NULLVP;
@@ -722,12 +720,12 @@ unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp,
  */
 static void
 unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp,
-		    struct thread *td)
+    struct thread *td)
 {
-	unsigned	count, lockrec;
 	struct vnode   *vp;
 	struct vnode   *lvp;
 	struct vnode   *dvp;
+	unsigned	count, lockrec;
 
 	vp = UNIONFSTOV(unp);
 	lvp = unp->un_lowervp;
@@ -768,10 +766,8 @@ unionfs_node_update(struct unionfs_node *unp, struct vnode *uvp,
  */
 int
 unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp,
-		    struct unionfs_node *unp, struct componentname *cnp,
-		    struct thread *td)
+    struct unionfs_node *unp, struct componentname *cnp, struct thread *td)
 {
-	int		error;
 	struct vnode   *lvp;
 	struct vnode   *uvp;
 	struct vattr	va;
@@ -781,6 +777,7 @@ unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *udvp,
 	struct ucred   *cred;
 	struct ucred   *credbk;
 	struct uidinfo *rootinfo;
+	int		error;
 
 	if (unp->un_uppervp != NULLVP)
 		return (EEXIST);
@@ -855,7 +852,7 @@ unionfs_mkshadowdir_abort:
  */
 int
 unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp,
-		   struct thread *td, char *path, int pathlen)
+    struct thread *td, char *path, int pathlen)
 {
 	struct vnode   *wvp;
 	struct nameidata nd;
@@ -897,17 +894,16 @@ unionfs_mkwhiteout_free_out:
  */
 static int
 unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp,
-			   struct unionfs_node *unp, struct vattr *uvap,
-			   struct thread *td)
+    struct unionfs_node *unp, struct vattr *uvap, struct thread *td)
 {
 	struct unionfs_mount *ump;
 	struct vnode   *vp;
 	struct vnode   *lvp;
 	struct ucred   *cred;
 	struct vattr	lva;
+	struct nameidata nd;
 	int		fmode;
 	int		error;
-	struct nameidata nd;
 
 	ump = MOUNTTOUNIONFSMOUNT(UNIONFSTOV(unp)->v_mount);
 	vp = NULLVP;
@@ -956,8 +952,8 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp,
 		goto unionfs_vn_create_on_upper_free_out1;
 	}
 	error = VOP_ADD_WRITECOUNT(vp, 1);
-	CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d",  __func__, vp,
-	    vp->v_writecount);
+	CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d",
+	    __func__, vp, vp->v_writecount);
 	if (error == 0) {
 		*vpp = vp;
 	} else {
@@ -986,15 +982,15 @@ unionfs_vn_create_on_upper_free_out2:
  */
 static int
 unionfs_copyfile_core(struct vnode *lvp, struct vnode *uvp,
-		      struct ucred *cred, struct thread *td)
+    struct ucred *cred, struct thread *td)
 {
-	int		error;
-	off_t		offset;
-	int		count;
-	int		bufoffset;
 	char           *buf;
 	struct uio	uio;
 	struct iovec	iov;
+	off_t		offset;
+	int		count;
+	int		error;
+	int		bufoffset;
 
 	error = 0;
 	memset(&uio, 0, sizeof(uio));
@@ -1054,14 +1050,14 @@ unionfs_copyfile_core(struct vnode *lvp, struct vnode *uvp,
  */
 int
 unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred,
-		 struct thread *td)
+    struct thread *td)
 {
-	int		error;
 	struct mount   *mp;
 	struct vnode   *udvp;
 	struct vnode   *lvp;
 	struct vnode   *uvp;
 	struct vattr	uva;
+	int		error;
 
 	lvp = unp->un_lowervp;
 	uvp = NULLVP;
@@ -1099,8 +1095,8 @@ unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred,
 	}
 	VOP_CLOSE(uvp, FWRITE, cred, td);
 	VOP_ADD_WRITECOUNT_CHECKED(uvp, -1);
-	CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d", __func__, uvp,
-	    uvp->v_writecount);
+	CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d",
+	    __func__, uvp, uvp->v_writecount);
 
 	vn_finished_write(mp);
 
@@ -1124,22 +1120,23 @@ unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred,
 int
 unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td)
 {
-	int		error;
-	int		eofflag;
-	int		lookuperr;
 	struct vnode   *uvp;
 	struct vnode   *lvp;
 	struct vnode   *tvp;
-	struct vattr	va;
+	struct dirent  *dp;
+	struct dirent  *edp;
 	struct componentname cn;
+	struct iovec	iov;
+	struct uio	uio;
+	struct vattr	va;
+	int		error;
+	int		eofflag;
+	int		lookuperr;
+
 	/*
 	 * The size of buf needs to be larger than DIRBLKSIZ.
 	 */
 	char		buf[256 * 6];
-	struct dirent  *dp;
-	struct dirent  *edp;
-	struct uio	uio;
-	struct iovec	iov;
 
 	ASSERT_VOP_ELOCKED(vp, "unionfs_check_rmdir");
 
@@ -1200,7 +1197,8 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td)
 			cn.cn_pnbuf = NULL;
 			cn.cn_nameptr = dp->d_name;
 			cn.cn_nameiop = LOOKUP;
-			cn.cn_flags = (LOCKPARENT | LOCKLEAF | SAVENAME | RDONLY | ISLASTCN);
+			cn.cn_flags = LOCKPARENT | LOCKLEAF | SAVENAME |
+			    RDONLY | ISLASTCN;
 			cn.cn_lkflags = LK_EXCLUSIVE;
 			cn.cn_thread = td;
 			cn.cn_cred = cred;
@@ -1222,7 +1220,8 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td)
 			 * If it has no exist/whiteout entry in upper,
 			 * directory is not empty.
 			 */
-			cn.cn_flags = (LOCKPARENT | LOCKLEAF | SAVENAME | RDONLY | ISLASTCN);
+			cn.cn_flags = LOCKPARENT | LOCKLEAF | SAVENAME |
+			    RDONLY | ISLASTCN;
 			lookuperr = VOP_LOOKUP(uvp, &tvp, &cn);
 
 			if (!lookuperr)
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index c17650dedc63..5096d46bea58 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -74,7 +74,6 @@ static struct vfsops unionfs_vfsops;
 static int
 unionfs_domount(struct mount *mp)
 {
-	int		error;
 	struct mount   *lowermp, *uppermp;
 	struct vnode   *lowerrootvp;
 	struct vnode   *upperrootvp;
@@ -83,18 +82,19 @@ unionfs_domount(struct mount *mp)
 	char           *target;
 	char           *tmp;
 	char           *ep;
-	int		len;
+	struct nameidata nd, *ndp;
+	struct vattr	va;
+	unionfs_copymode copymode;
+	unionfs_whitemode whitemode;
 	int		below;
+	int		error;
+	int		len;
 	uid_t		uid;
 	gid_t		gid;
 	u_short		udir;
 	u_short		ufile;
-	unionfs_copymode copymode;
-	unionfs_whitemode whitemode;
-	struct nameidata nd, *ndp;
-	struct vattr	va;
 
-	UNIONFSDEBUG("unionfs_mount(mp = %p)\n", (void *)mp);
+	UNIONFSDEBUG("unionfs_mount(mp = %p)\n", mp);
 
 	error = 0;
 	below = 0;
@@ -245,8 +245,8 @@ unionfs_domount(struct mount *mp)
 	upperrootvp = ndp->ni_vp;
 
 	/* create unionfs_mount */
-	ump = (struct unionfs_mount *)malloc(sizeof(struct unionfs_mount),
-	    M_UNIONFSMNT, M_WAITOK | M_ZERO);
+	ump = malloc(sizeof(struct unionfs_mount), M_UNIONFSMNT,
+	    M_WAITOK | M_ZERO);
 
 	/*
 	 * Save reference
@@ -340,7 +340,7 @@ unionfs_unmount(struct mount *mp, int mntflags)
 	int		freeing;
 	int		flags;
 
-	UNIONFSDEBUG("unionfs_unmount: mp = %p\n", (void *)mp);
+	UNIONFSDEBUG("unionfs_unmount: mp = %p\n", mp);
 
 	ump = MOUNTTOUNIONFSMOUNT(mp);
 	flags = 0;
@@ -371,7 +371,7 @@ static int
 unionfs_root(struct mount *mp, int flags, struct vnode **vpp)
 {
 	struct unionfs_mount *ump;
-	struct vnode   *vp;
+	struct vnode *vp;
 
 	ump = MOUNTTOUNIONFSMOUNT(mp);
 	vp = ump->um_rootvp;
@@ -427,14 +427,14 @@ static int
 unionfs_statfs(struct mount *mp, struct statfs *sbp)
 {
 	struct unionfs_mount *ump;
-	int		error;
 	struct statfs	*mstat;
 	uint64_t	lbsize;
+	int		error;
 
 	ump = MOUNTTOUNIONFSMOUNT(mp);
 
 	UNIONFSDEBUG("unionfs_statfs(mp = %p, lvp = %p, uvp = %p)\n",
-	    (void *)mp, (void *)ump->um_lowervp, (void *)ump->um_uppervp);
+	    mp, ump->um_lowervp, ump->um_uppervp);
 
 	mstat = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK | M_ZERO);
 
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index d09b8cd50854..eb74192fd504 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -80,16 +80,16 @@
 static int
 unionfs_lookup(struct vop_cachedlookup_args *ap)
 {
-	int		iswhiteout;
-	int		lockflag;
-	int		error , uerror, lerror;
-	u_long		nameiop;
-	u_long		cnflags, cnflagsbk;
 	struct unionfs_node *dunp;
 	struct vnode   *dvp, *udvp, *ldvp, *vp, *uvp, *lvp, *dtmpvp;
 	struct vattr	va;
 	struct componentname *cnp;
 	struct thread  *td;
+	u_long		nameiop;
+	u_long		cnflags, cnflagsbk;
+	int		iswhiteout;
+	int		lockflag;
+	int		error , uerror, lerror;
 
 	iswhiteout = 0;
 	lockflag = 0;
@@ -105,7 +105,9 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
 	td = curthread;
 	*(ap->a_vpp) = NULLVP;
 
-	UNIONFS_INTERNAL_DEBUG("unionfs_lookup: enter: nameiop=%ld, flags=%lx, path=%s\n", nameiop, cnflags, cnp->cn_nameptr);
+	UNIONFS_INTERNAL_DEBUG(
+	    "unionfs_lookup: enter: nameiop=%ld, flags=%lx, path=%s\n",
+	    nameiop, cnflags, cnp->cn_nameptr);
 
 	if (dvp->v_type != VDIR)
 		return (ENOTDIR);
@@ -182,7 +184,8 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
 				*(ap->a_vpp) = dvp;
 				vref(dvp);
 
-				UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", uerror);
+				UNIONFS_INTERNAL_DEBUG(
+				    "unionfs_lookup: leave (%d)\n", uerror);
 
 				return (uerror);
 			}
@@ -200,7 +203,9 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
 			    (va.va_flags & OPAQUE))
 				iswhiteout = 1;	/* don't lookup lower */
 #if 0
-		UNIONFS_INTERNAL_DEBUG("unionfs_lookup: debug: whiteout=%d, path=%s\n", iswhiteout, cnp->cn_nameptr);
+		UNIONFS_INTERNAL_DEBUG(
+		    "unionfs_lookup: debug: whiteout=%d, path=%s\n",
+		    iswhiteout, cnp->cn_nameptr);
 #endif
 	}
 
@@ -227,7 +232,8 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
 				*(ap->a_vpp) = dvp;
 				vref(dvp);
 
-				UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", lerror);
+				UNIONFS_INTERNAL_DEBUG(
+				    "unionfs_lookup: leave (%d)\n", lerror);
 
 				return (lerror);
 			}
@@ -277,7 +283,8 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
 		if (lockflag != 0)
 			VOP_UNLOCK(vp);
 		if (error != 0) {
-			UNIONFSDEBUG("unionfs_lookup: Unable to create shadow dir.");
+			UNIONFSDEBUG(
+			    "unionfs_lookup: Unable to create shadow dir.");
 			if ((cnp->cn_lkflags & LK_TYPE_MASK) == LK_EXCLUSIVE)
 				vput(vp);
 			else
@@ -319,7 +326,8 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
 			error = unionfs_nodeget(dvp->v_mount, uvp, lvp,
 			    dvp, &vp, cnp, td);
 		if (error != 0) {
-			UNIONFSDEBUG("unionfs_lookup: Unable to create unionfs vnode.");
+			UNIONFSDEBUG(
+			    "unionfs_lookup: Unable to create unionfs vnode.");
 			goto unionfs_lookup_out;
 		}
 		if ((nameiop == DELETE || nameiop == RENAME) &&
@@ -462,7 +470,6 @@ unionfs_mknod_abort:
 static int
 unionfs_open(struct vop_open_args *ap)
 {
-	int		error;
 	struct unionfs_node *unp;
 	struct unionfs_node_status *unsp;
 	struct vnode   *uvp;
@@ -470,6 +477,7 @@ unionfs_open(struct vop_open_args *ap)
 	struct vnode   *targetvp;
 	struct ucred   *cred;
 	struct thread  *td;
+	int		error;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_open: enter\n");
 
@@ -544,14 +552,14 @@ unionfs_open_abort:
 static int
 unionfs_close(struct vop_close_args *ap)
 {
-	int		error;
-	int		locked;
 	struct unionfs_node *unp;
 	struct unionfs_node_status *unsp;
 	struct ucred   *cred;
 	struct thread  *td;
 	struct vnode   *vp;
 	struct vnode   *ovp;
+	int		error;
+	int		locked;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_close: enter\n");
 
@@ -619,9 +627,8 @@ unionfs_close_abort:
  * Check the access mode toward shadow file/dir.
  */
 static int
-unionfs_check_corrected_access(accmode_t accmode,
-			     struct vattr *va,
-			     struct ucred *cred)
+unionfs_check_corrected_access(accmode_t accmode, struct vattr *va,
+    struct ucred *cred)
 {
 	int		count;
 	uid_t		uid;	/* upper side vnode's uid */
@@ -723,7 +730,8 @@ unionfs_access(struct vop_access_args *ap)
 				default:
 					break;
 				}
-			} else if (ap->a_vp->v_type == VREG || ap->a_vp->v_type == VDIR) {
+			} else if (ap->a_vp->v_type == VREG ||
+			    ap->a_vp->v_type == VDIR) {
 				/* check shadow file/dir */
 				if (ump->um_copymode != UNIONFS_TRANSPARENT) {
 					error = unionfs_create_uppervattr(ump,
@@ -751,13 +759,13 @@ unionfs_access(struct vop_access_args *ap)
 static int
 unionfs_getattr(struct vop_getattr_args *ap)
 {
-	int		error;
 	struct unionfs_node *unp;
 	struct unionfs_mount *ump;
 	struct vnode   *uvp;
 	struct vnode   *lvp;
 	struct thread  *td;
 	struct vattr	va;
+	int		error;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_getattr: enter\n");
 
@@ -771,9 +779,11 @@ unionfs_getattr(struct vop_getattr_args *ap)
 
 	if (uvp != NULLVP) {
 		if ((error = VOP_GETATTR(uvp, ap->a_vap, ap->a_cred)) == 0)
-			ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
+			ap->a_vap->va_fsid =
+			    ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
 
-		UNIONFS_INTERNAL_DEBUG("unionfs_getattr: leave mode=%o, uid=%d, gid=%d (%d)\n",
+		UNIONFS_INTERNAL_DEBUG(
+		    "unionfs_getattr: leave mode=%o, uid=%d, gid=%d (%d)\n",
 		    ap->a_vap->va_mode, ap->a_vap->va_uid,
 		    ap->a_vap->va_gid, error);
 
@@ -795,7 +805,8 @@ unionfs_getattr(struct vop_getattr_args *ap)
 	if (error == 0)
 		ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
 
-	UNIONFS_INTERNAL_DEBUG("unionfs_getattr: leave mode=%o, uid=%d, gid=%d (%d)\n",
+	UNIONFS_INTERNAL_DEBUG(
+	    "unionfs_getattr: leave mode=%o, uid=%d, gid=%d (%d)\n",
 	    ap->a_vap->va_mode, ap->a_vap->va_uid, ap->a_vap->va_gid, error);
 
 	return (error);
@@ -804,12 +815,12 @@ unionfs_getattr(struct vop_getattr_args *ap)
 static int
 unionfs_setattr(struct vop_setattr_args *ap)
 {
-	int		error;
 	struct unionfs_node *unp;
 	struct vnode   *uvp;
 	struct vnode   *lvp;
 	struct thread  *td;
 	struct vattr   *vap;
+	int		error;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_setattr: enter\n");
 
@@ -847,9 +858,9 @@ unionfs_setattr(struct vop_setattr_args *ap)
 static int
 unionfs_read(struct vop_read_args *ap)
 {
-	int		error;
 	struct unionfs_node *unp;
 	struct vnode   *tvp;
+	int		error;
 
 	/* UNIONFS_INTERNAL_DEBUG("unionfs_read: enter\n"); */
 
@@ -868,9 +879,9 @@ unionfs_read(struct vop_read_args *ap)
 static int
 unionfs_write(struct vop_write_args *ap)
 {
-	int		error;
 	struct unionfs_node *unp;
 	struct vnode   *tvp;
+	int		error;
 
 	/* UNIONFS_INTERNAL_DEBUG("unionfs_write: enter\n"); */
 
@@ -889,10 +900,10 @@ unionfs_write(struct vop_write_args *ap)
 static int
 unionfs_ioctl(struct vop_ioctl_args *ap)
 {
-	int error;
 	struct unionfs_node *unp;
 	struct unionfs_node_status *unsp;
 	struct vnode   *ovp;
+	int error;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_ioctl: enter\n");
 
@@ -921,7 +932,7 @@ unionfs_poll(struct vop_poll_args *ap)
 {
 	struct unionfs_node *unp;
 	struct unionfs_node_status *unsp;
-	struct vnode   *ovp;
+	struct vnode *ovp;
 
 	KASSERT_UNIONFS_VNODE(ap->a_vp);
 
@@ -943,7 +954,7 @@ unionfs_fsync(struct vop_fsync_args *ap)
 {
 	struct unionfs_node *unp;
 	struct unionfs_node_status *unsp;
-	struct vnode   *ovp;
+	struct vnode *ovp;
 
 	KASSERT_UNIONFS_VNODE(ap->a_vp);
 
@@ -1048,14 +1059,14 @@ unionfs_remove(struct vop_remove_args *ap)
 static int
 unionfs_link(struct vop_link_args *ap)
 {
-	int		error;
-	int		needrelookup;
 	struct unionfs_node *dunp;
 	struct unionfs_node *unp;
 	struct vnode   *udvp;
 	struct vnode   *uvp;
 	struct componentname *cnp;
 	struct thread  *td;
+	int		error;
+	int		needrelookup;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_link: enter\n");
 
@@ -1105,7 +1116,6 @@ unionfs_link(struct vop_link_args *ap)
 static int
 unionfs_rename(struct vop_rename_args *ap)
 {
-	int		error;
 	struct vnode   *fdvp;
 	struct vnode   *fvp;
 	struct componentname *fcnp;
@@ -1122,9 +1132,10 @@ unionfs_rename(struct vop_rename_args *ap)
 	struct vnode   *rtdvp;
 	struct vnode   *rtvp;
 
-	int		needrelookup;
 	struct unionfs_mount *ump;
 	struct unionfs_node *unp;
+	int		error;
+	int		needrelookup;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_rename: enter\n");
 
@@ -1175,7 +1186,8 @@ unionfs_rename(struct vop_rename_args *ap)
 
 	unp = VTOUNIONFS(fdvp);
 #ifdef UNIONFS_IDBG_RENAME
-	UNIONFS_INTERNAL_DEBUG("fdvp=%p, ufdvp=%p, lfdvp=%p\n", fdvp, unp->un_uppervp, unp->un_lowervp);
+	UNIONFS_INTERNAL_DEBUG("fdvp=%p, ufdvp=%p, lfdvp=%p\n",
+	    fdvp, unp->un_uppervp, unp->un_lowervp);
 #endif
 	if (unp->un_uppervp == NULLVP) {
 		error = ENODEV;
@@ -1186,7 +1198,8 @@ unionfs_rename(struct vop_rename_args *ap)
 
 	unp = VTOUNIONFS(fvp);
 #ifdef UNIONFS_IDBG_RENAME
-	UNIONFS_INTERNAL_DEBUG("fvp=%p, ufvp=%p, lfvp=%p\n", fvp, unp->un_uppervp, unp->un_lowervp);
+	UNIONFS_INTERNAL_DEBUG("fvp=%p, ufvp=%p, lfvp=%p\n",
+	    fvp, unp->un_uppervp, unp->un_lowervp);
 #endif
 	ump = MOUNTTOUNIONFSMOUNT(fvp->v_mount);
 	if (unp->un_uppervp == NULLVP) {
@@ -1222,7 +1235,8 @@ unionfs_rename(struct vop_rename_args *ap)
 
 	unp = VTOUNIONFS(tdvp);
 #ifdef UNIONFS_IDBG_RENAME
-	UNIONFS_INTERNAL_DEBUG("tdvp=%p, utdvp=%p, ltdvp=%p\n", tdvp, unp->un_uppervp, unp->un_lowervp);
+	UNIONFS_INTERNAL_DEBUG("tdvp=%p, utdvp=%p, ltdvp=%p\n",
+	    tdvp, unp->un_uppervp, unp->un_lowervp);
 #endif
 	if (unp->un_uppervp == NULLVP) {
 		error = ENODEV;
@@ -1238,7 +1252,8 @@ unionfs_rename(struct vop_rename_args *ap)
 	} else if (tvp != NULLVP) {
 		unp = VTOUNIONFS(tvp);
 #ifdef UNIONFS_IDBG_RENAME
-		UNIONFS_INTERNAL_DEBUG("tvp=%p, utvp=%p, ltvp=%p\n", tvp, unp->un_uppervp, unp->un_lowervp);
+		UNIONFS_INTERNAL_DEBUG("tvp=%p, utvp=%p, ltvp=%p\n",
+		    tvp, unp->un_uppervp, unp->un_lowervp);
 #endif
 		if (unp->un_uppervp == NULLVP)
 			rtvp = NULLVP;
@@ -1331,14 +1346,14 @@ unionfs_rename_abort:
 static int
 unionfs_mkdir(struct vop_mkdir_args *ap)
 {
-	int		error;
-	int		lkflags;
 	struct unionfs_node *dunp;
 	struct componentname *cnp;
 	struct thread  *td;
 	struct vnode   *udvp;
 	struct vnode   *uvp;
 	struct vattr	va;
+	int		error;
+	int		lkflags;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_mkdir: enter\n");
 
@@ -1379,7 +1394,6 @@ unionfs_mkdir(struct vop_mkdir_args *ap)
 static int
 unionfs_rmdir(struct vop_rmdir_args *ap)
 {
-	int		error;
 	struct unionfs_node *dunp;
 	struct unionfs_node *unp;
 	struct unionfs_mount *ump;
@@ -1388,6 +1402,7 @@ unionfs_rmdir(struct vop_rmdir_args *ap)
 	struct vnode   *udvp;
 	struct vnode   *uvp;
 	struct vnode   *lvp;
+	int		error;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_rmdir: enter\n");
 
@@ -1439,13 +1454,13 @@ unionfs_rmdir(struct vop_rmdir_args *ap)
 static int
 unionfs_symlink(struct vop_symlink_args *ap)
 {
-	int		error;
-	int		lkflags;
 	struct unionfs_node *dunp;
 	struct componentname *cnp;
 	struct thread  *td;
 	struct vnode   *udvp;
 	struct vnode   *uvp;
+	int		error;
+	int		lkflags;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_symlink: enter\n");
 
@@ -1478,10 +1493,6 @@ unionfs_symlink(struct vop_symlink_args *ap)
 static int
 unionfs_readdir(struct vop_readdir_args *ap)
 {
-	int		error;
-	int		eofflag;
-	int		locked;
-	int		uio_offset_bk;
 	struct unionfs_node *unp;
 	struct unionfs_node_status *unsp;
 	struct uio     *uio;
@@ -1491,8 +1502,12 @@ unionfs_readdir(struct vop_readdir_args *ap)
 	struct thread  *td;
 	struct vattr    va;
 
-	int		ncookies_bk;
 	u_long         *cookies_bk;
+	int		error;
+	int		eofflag;
+	int		locked;
+	int		ncookies_bk;
+	int		uio_offset_bk;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_readdir: enter\n");
 
@@ -1647,7 +1662,8 @@ unionfs_readdir(struct vop_readdir_args *ap)
 
 		memcpy(pos, cookies_bk, ncookies_bk * sizeof(u_long));
 		pos += ncookies_bk;
-		memcpy(pos, *(ap->a_cookies), *(ap->a_ncookies) * sizeof(u_long));
+		memcpy(pos, *(ap->a_cookies),
+		    *(ap->a_ncookies) * sizeof(u_long));
 		free(cookies_bk, M_TEMP);
 		free(*(ap->a_cookies), M_TEMP);
 		*(ap->a_ncookies) = size;
@@ -1666,9 +1682,9 @@ unionfs_readdir_exit:
 static int
 unionfs_readlink(struct vop_readlink_args *ap)
 {
-	int error;
 	struct unionfs_node *unp;
 	struct vnode   *vp;
+	int error;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_readlink: enter\n");
 
@@ -1687,9 +1703,9 @@ unionfs_readlink(struct vop_readlink_args *ap)
 static int
 unionfs_getwritemount(struct vop_getwritemount_args *ap)
 {
-	int		error;
 	struct vnode   *uvp;
 	struct vnode   *vp;
*** 209 LINES SKIPPED ***


More information about the dev-commits-src-main mailing list