union_vnops.c (0731e6dfb7593b94af5bf482fbdf383667ca0fbb) union_vnops.c (aec0fb7b40e4cf877bea663f2d86dd07c3524fe8)
1/*
2 * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry.
3 * Copyright (c) 1992, 1993, 1994, 1995
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 1311 unchanged lines hidden (view full) ---

1320 struct vnode *tdvp = ap->a_tdvp;
1321 struct vnode *tvp = ap->a_tvp;
1322
1323 /*
1324 * Figure out what fdvp to pass to our upper or lower vnode. If we
1325 * replace the fdvp, release the original one and ref the new one.
1326 */
1327
1/*
2 * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry.
3 * Copyright (c) 1992, 1993, 1994, 1995
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 1311 unchanged lines hidden (view full) ---

1320 struct vnode *tdvp = ap->a_tdvp;
1321 struct vnode *tvp = ap->a_tvp;
1322
1323 /*
1324 * Figure out what fdvp to pass to our upper or lower vnode. If we
1325 * replace the fdvp, release the original one and ref the new one.
1326 */
1327
1328 if (fdvp->v_op == union_vnodeop_p) { /* always true */
1328 if (fdvp->v_op == &union_vnodeops) { /* always true */
1329 struct union_node *un = VTOUNION(fdvp);
1330 if (un->un_uppervp == NULLVP) {
1331 /*
1332 * this should never happen in normal
1333 * operation but might if there was
1334 * a problem creating the top-level shadow
1335 * directory.
1336 */

--- 5 unchanged lines hidden (view full) ---

1342 vrele(ap->a_fdvp);
1343 }
1344
1345 /*
1346 * Figure out what fvp to pass to our upper or lower vnode. If we
1347 * replace the fvp, release the original one and ref the new one.
1348 */
1349
1329 struct union_node *un = VTOUNION(fdvp);
1330 if (un->un_uppervp == NULLVP) {
1331 /*
1332 * this should never happen in normal
1333 * operation but might if there was
1334 * a problem creating the top-level shadow
1335 * directory.
1336 */

--- 5 unchanged lines hidden (view full) ---

1342 vrele(ap->a_fdvp);
1343 }
1344
1345 /*
1346 * Figure out what fvp to pass to our upper or lower vnode. If we
1347 * replace the fvp, release the original one and ref the new one.
1348 */
1349
1350 if (fvp->v_op == union_vnodeop_p) { /* always true */
1350 if (fvp->v_op == &union_vnodeops) { /* always true */
1351 struct union_node *un = VTOUNION(fvp);
1352#if 0
1353 struct union_mount *um = MOUNTTOUNIONMOUNT(fvp->v_mount);
1354#endif
1355
1356 if (un->un_uppervp == NULLVP) {
1357 switch(fvp->v_type) {
1358 case VREG:

--- 41 unchanged lines hidden (view full) ---

1400 /*
1401 * Figure out what tdvp (destination directory) to pass to the
1402 * lower level. If we replace it with uppervp, we need to vput the
1403 * old one. The exclusive lock is transfered to what we will pass
1404 * down in the VOP_RENAME() and we replace uppervp with a simple
1405 * reference.
1406 */
1407
1351 struct union_node *un = VTOUNION(fvp);
1352#if 0
1353 struct union_mount *um = MOUNTTOUNIONMOUNT(fvp->v_mount);
1354#endif
1355
1356 if (un->un_uppervp == NULLVP) {
1357 switch(fvp->v_type) {
1358 case VREG:

--- 41 unchanged lines hidden (view full) ---

1400 /*
1401 * Figure out what tdvp (destination directory) to pass to the
1402 * lower level. If we replace it with uppervp, we need to vput the
1403 * old one. The exclusive lock is transfered to what we will pass
1404 * down in the VOP_RENAME() and we replace uppervp with a simple
1405 * reference.
1406 */
1407
1408 if (tdvp->v_op == union_vnodeop_p) {
1408 if (tdvp->v_op == &union_vnodeops) {
1409 struct union_node *un = VTOUNION(tdvp);
1410
1411 if (un->un_uppervp == NULLVP) {
1412 /*
1413 * This should never happen in normal
1414 * operation but might if there was
1415 * a problem creating the top-level shadow
1416 * directory.

--- 13 unchanged lines hidden (view full) ---

1430 /*
1431 * Figure out what tvp (destination file) to pass to the
1432 * lower level.
1433 *
1434 * If the uppervp file does not exist, put away the (wrong)
1435 * file and change tvp to NULL.
1436 */
1437
1409 struct union_node *un = VTOUNION(tdvp);
1410
1411 if (un->un_uppervp == NULLVP) {
1412 /*
1413 * This should never happen in normal
1414 * operation but might if there was
1415 * a problem creating the top-level shadow
1416 * directory.

--- 13 unchanged lines hidden (view full) ---

1430 /*
1431 * Figure out what tvp (destination file) to pass to the
1432 * lower level.
1433 *
1434 * If the uppervp file does not exist, put away the (wrong)
1435 * file and change tvp to NULL.
1436 */
1437
1438 if (tvp != NULLVP && tvp->v_op == union_vnodeop_p) {
1438 if (tvp != NULLVP && tvp->v_op == &union_vnodeops) {
1439 struct union_node *un = VTOUNION(tvp);
1440
1441 tvp = union_lock_upper(un, ap->a_tcnp->cn_thread);
1442 vput(ap->a_tvp);
1443 /* note: tvp may be NULL */
1444 }
1445
1446 /*

--- 600 unchanged lines hidden (view full) ---

2047 union_unlock_other(vp, ap->a_td);
2048
2049 return (error);
2050}
2051
2052/*
2053 * Global vfs data structures
2054 */
1439 struct union_node *un = VTOUNION(tvp);
1440
1441 tvp = union_lock_upper(un, ap->a_tcnp->cn_thread);
1442 vput(ap->a_tvp);
1443 /* note: tvp may be NULL */
1444 }
1445
1446 /*

--- 600 unchanged lines hidden (view full) ---

2047 union_unlock_other(vp, ap->a_td);
2048
2049 return (error);
2050}
2051
2052/*
2053 * Global vfs data structures
2054 */
2055vop_t **union_vnodeop_p;
2056static struct vnodeopv_entry_desc union_vnodeop_entries[] = {
2057 { &vop_default_desc, (vop_t *) vop_defaultop },
2058 { &vop_access_desc, (vop_t *) union_access },
2059 { &vop_aclcheck_desc, (vop_t *) union_aclcheck },
2060 { &vop_advlock_desc, (vop_t *) union_advlock },
2061 { &vop_bmap_desc, (vop_t *) vop_eopnotsupp },
2062 { &vop_close_desc, (vop_t *) union_close },
2063 { &vop_closeextattr_desc, (vop_t *) union_closeextattr },
2064 { &vop_create_desc, (vop_t *) union_create },
2065 { &vop_createvobject_desc, (vop_t *) union_createvobject },
2066 { &vop_deleteextattr_desc, (vop_t *) union_deleteextattr },
2067 { &vop_destroyvobject_desc, (vop_t *) union_destroyvobject },
2068 { &vop_fsync_desc, (vop_t *) union_fsync },
2069 { &vop_getattr_desc, (vop_t *) union_getattr },
2070 { &vop_getacl_desc, (vop_t *) union_getacl },
2071 { &vop_getextattr_desc, (vop_t *) union_getextattr },
2072 { &vop_getvobject_desc, (vop_t *) union_getvobject },
2073 { &vop_inactive_desc, (vop_t *) union_inactive },
2074 { &vop_ioctl_desc, (vop_t *) union_ioctl },
2075 { &vop_lease_desc, (vop_t *) union_lease },
2076 { &vop_link_desc, (vop_t *) union_link },
2077 { &vop_listextattr_desc, (vop_t *) union_listextattr },
2078 { &vop_lookup_desc, (vop_t *) union_lookup },
2079 { &vop_mkdir_desc, (vop_t *) union_mkdir },
2080 { &vop_mknod_desc, (vop_t *) union_mknod },
2081 { &vop_open_desc, (vop_t *) union_open },
2082 { &vop_openextattr_desc, (vop_t *) union_openextattr },
2083 { &vop_pathconf_desc, (vop_t *) union_pathconf },
2084 { &vop_poll_desc, (vop_t *) union_poll },
2085 { &vop_print_desc, (vop_t *) union_print },
2086 { &vop_read_desc, (vop_t *) union_read },
2087 { &vop_readdir_desc, (vop_t *) union_readdir },
2088 { &vop_readlink_desc, (vop_t *) union_readlink },
2089 { &vop_getwritemount_desc, (vop_t *) union_getwritemount },
2090 { &vop_reclaim_desc, (vop_t *) union_reclaim },
2091 { &vop_remove_desc, (vop_t *) union_remove },
2092 { &vop_rename_desc, (vop_t *) union_rename },
2093 { &vop_rmdir_desc, (vop_t *) union_rmdir },
2094 { &vop_setacl_desc, (vop_t *) union_setacl },
2095 { &vop_setattr_desc, (vop_t *) union_setattr },
2096 { &vop_setextattr_desc, (vop_t *) union_setextattr },
2097 { &vop_setlabel_desc, (vop_t *) union_setlabel },
2098 { &vop_strategy_desc, (vop_t *) union_strategy },
2099 { &vop_symlink_desc, (vop_t *) union_symlink },
2100 { &vop_whiteout_desc, (vop_t *) union_whiteout },
2101 { &vop_write_desc, (vop_t *) union_write },
2102 { NULL, NULL }
2055struct vop_vector union_vnodeops = {
2056 .vop_default = &default_vnodeops,
2057 .vop_access = union_access,
2058 .vop_aclcheck = union_aclcheck,
2059 .vop_advlock = union_advlock,
2060 .vop_bmap = VOP_EOPNOTSUPP,
2061 .vop_close = union_close,
2062 .vop_closeextattr = union_closeextattr,
2063 .vop_create = union_create,
2064 .vop_createvobject = union_createvobject,
2065 .vop_deleteextattr = union_deleteextattr,
2066 .vop_destroyvobject = union_destroyvobject,
2067 .vop_fsync = union_fsync,
2068 .vop_getattr = union_getattr,
2069 .vop_getacl = union_getacl,
2070 .vop_getextattr = union_getextattr,
2071 .vop_getvobject = union_getvobject,
2072 .vop_inactive = union_inactive,
2073 .vop_ioctl = union_ioctl,
2074 .vop_lease = union_lease,
2075 .vop_link = union_link,
2076 .vop_listextattr = union_listextattr,
2077 .vop_lookup = union_lookup,
2078 .vop_mkdir = union_mkdir,
2079 .vop_mknod = union_mknod,
2080 .vop_open = union_open,
2081 .vop_openextattr = union_openextattr,
2082 .vop_pathconf = union_pathconf,
2083 .vop_poll = union_poll,
2084 .vop_print = union_print,
2085 .vop_read = union_read,
2086 .vop_readdir = union_readdir,
2087 .vop_readlink = union_readlink,
2088 .vop_getwritemount = union_getwritemount,
2089 .vop_reclaim = union_reclaim,
2090 .vop_remove = union_remove,
2091 .vop_rename = union_rename,
2092 .vop_rmdir = union_rmdir,
2093 .vop_setacl = union_setacl,
2094 .vop_setattr = union_setattr,
2095 .vop_setextattr = union_setextattr,
2096 .vop_setlabel = union_setlabel,
2097 .vop_strategy = union_strategy,
2098 .vop_symlink = union_symlink,
2099 .vop_whiteout = union_whiteout,
2100 .vop_write = union_write,
2103};
2101};
2104static struct vnodeopv_desc union_vnodeop_opv_desc =
2105 { &union_vnodeop_p, union_vnodeop_entries };
2106
2107VNODEOP_SET(union_vnodeop_opv_desc);