Module Name:src
Committed By: christos
Date: Sun Sep 11 16:42:07 UTC 2022
Modified Files:
src/sys/fs/unionfs: unionfs_subr.c unionfs_vfsops.c unionfs_vnops.c
Log Message:
catch up; make this compile again.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/fs/unionfs/unionfs_subr.c
cvs rdiff -u -r1.14 -r1.15 src/sys/fs/unionfs/unionfs_vfsops.c
cvs rdiff -u -r1.18 -r1.19 src/sys/fs/unionfs/unionfs_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/fs/unionfs/unionfs_subr.c
diff -u src/sys/fs/unionfs/unionfs_subr.c:1.15 src/sys/fs/unionfs/unionfs_subr.c:1.16
--- src/sys/fs/unionfs/unionfs_subr.c:1.15 Tue Jun 29 18:39:20 2021
+++ src/sys/fs/unionfs/unionfs_subr.c Sun Sep 11 12:42:07 2022
@@ -96,8 +96,7 @@ unionfs_nodeget(struct mount *mp, struct
* unless layers are inverted.
*/
vnode_t *svp = (uppervp != NULLVP) ? uppervp : lowervp;
- error = getnewvnode(VT_UNION, mp, unionfs_vnodeop_p,
- svp->v_interlock, );
+ error = vcache_get(mp, svp, sizeof(svp), );
if (error != 0) {
return (error);
}
@@ -139,14 +138,11 @@ unionfs_nodeget(struct mount *mp, struct
void
unionfs_noderem(struct vnode *vp)
{
- struct unionfs_mount *ump;
struct unionfs_node *unp;
struct unionfs_node_status *unsp;
struct vnode *lvp;
struct vnode *uvp;
- ump = MOUNTTOUNIONFSMOUNT(vp->v_mount);
-
/*
* Use the interlock to protect the clearing of v_data to
* prevent faults in unionfs_lock().
Index: src/sys/fs/unionfs/unionfs_vfsops.c
diff -u src/sys/fs/unionfs/unionfs_vfsops.c:1.14 src/sys/fs/unionfs/unionfs_vfsops.c:1.15
--- src/sys/fs/unionfs/unionfs_vfsops.c:1.14 Fri Jan 17 15:08:08 2020
+++ src/sys/fs/unionfs/unionfs_vfsops.c Sun Sep 11 12:42:07 2022
@@ -94,7 +94,7 @@ unionfs_mount(struct mount *mp, const ch
if (*data_len < sizeof *args)
return EINVAL;
- UNIONFSDEBUG("unionfs_mount(mp = %p)\n", (void *)mp);
+ UNIONFSDEBUG("%s(mp = %p)\n", __func__, mp);
error = 0;
below = 0;
@@ -105,11 +105,10 @@ unionfs_mount(struct mount *mp, const ch
copymode = UNIONFS_TRANSPARENT; /* default */
whitemode = UNIONFS_WHITE_ALWAYS;
ndp =
- cred = kauth_cred_get();
if (mp->mnt_flag & MNT_ROOTFS) {
- printf("union_mount: cannot union mount root filesystem\n");
- return (EOPNOTSUPP);
+ printf("%s: cannot union mount root filesystem\n", __func__);
+ return EOPNOTSUPP;
}
if (mp->mnt_flag & MNT_GETARGS) {
@@ -126,10 +125,11 @@ unionfs_mount(struct mount *mp, const ch
* Update is a no operation.
*/
if (mp->mnt_flag & MNT_UPDATE) {
- printf("union_mount: cannot update union mount\n");
- return (EOPNOTSUPP);
+ printf("%s: cannot update union mount\n", __func__);
+ return EOPNOTSUPP;
}
+ cred = kauth_cred_get();
vn_lock(mp->mnt_vnodecovered, LK_EXCLUSIVE | LK_RETRY);
error = VOP_GETATTR(mp->mnt_vnodecovered, , cred);
if (!error) {
@@ -142,7 +142,7 @@ unionfs_mount(struct mount *mp, const ch
}
VOP_UNLOCK(mp->mnt_vnodecovered);
if (error)
- return (error);
+ return error;
switch (args->mntflags & UNMNT_OPMASK) {
case UNMNT_ABOVE:
@@ -164,17 +164,16 @@ unionfs_mount(struct mount *mp, const ch
gid = kauth_cred_getgid(cred);
}
- UNIONFSDEBUG("unionfs_mount: uid=%d, gid=%d\n", uid, gid);
- UNIONFSDEBUG("unionfs_mount: udir=0%03o, ufile=0%03o\n", udir, ufile);
- UNIONFSDEBUG("unionfs_mount: copymode=%d\n", copymode);
+ UNIONFSDEBUG("%s: uid=%d, gid=%d\n", __func__, uid, gid);
+ UNIONFSDEBUG("%s: udir=%#03o, ufile=%#03o\n", __func__, udir, ufile);
+ UNIONFSDEBUG("%s: copymode=%d\n", __func__, copymode);
/*
* Find upper node
*/
error = pathbuf_copyin(args->target, );
- if (error) {
+ if (error)
return error;
- }
NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, pb);
if ((error = namei(ndp))) {
pathbuf_destroy(pb);
@@ -190,8 +189,7 @@ unionfs_mount(struct mount *mp, const ch
pathbuf_destroy(pb);
/* create unionfs_mount */
- ump = (struct unionfs_mount *)malloc(sizeof(struct unionfs_mount),
- M_UNIONFSMNT, M_WAITOK | M_ZERO);
+ ump = kmem_zalloc(sizeof(*ump), KM_SLEEP);
/*
* Save reference
@@ -236,9 +234,7 @@ unionfs_mount(struct mount *mp, const ch
vrele(upperrootvp);
} else
vput(ump->um_uppervp);
- free(ump, M_UNIONFSMNT);
- mp->mnt_data = NULL;
- return (error);
+ goto out;
}
}
@@ -256,9 +252,7 @@ unionfs_mount(struct mount *mp, const ch
NULLVP, &(ump->um_rootvp), NULL);
vrele(upperrootvp);
if (error) {
- free(ump, M_UNIONFSMNT);
- mp->mnt_data = NULL;
- return (error);
+ goto out;
}
/*
@@ -277,9 +271,7 @@ unionfs_mount(struct mount *mp, const ch
mp->mnt_op->vfs_name, mp, curlwp);
if (error) {
unionfs_noderem(ump->um_rootvp);
- free(ump, M_UNIONFSMNT);
- mp->mnt_data = NULL;
- return (error);
+ goto out;
}
switch (ump->um_op) {
@@ -290,7 +282,9 @@ unionfs_mount(struct mount *mp, const ch
cp = ":";
break;