Home | History | Annotate | Download | only in client
      1 //
      2 // CDDL HEADER START
      3 //
      4 // The contents of this file are subject to the terms of the
      5 // Common Development and Distribution License (the License).
      6 // You may not use this file except in compliance with the License.
      7 //
      8 // You can obtain a copy of the license at usr/src/CDDL.txt
      9 // or http://www.opensolaris.org/os/licensing.
     10 // See the License for the specific language governing permissions
     11 // and limitations under the License.
     12 //
     13 // When distributing Covered Code, include this CDDL HEADER in each
     14 // file and include the License file at usr/src/CDDL.txt.
     15 // If applicable, add the following below this CDDL HEADER, with the
     16 // fields enclosed by brackets [] replaced with your own identifying
     17 // information: Portions Copyright [yyyy] [name of copyright owner]
     18 //
     19 // CDDL HEADER END
     20 //
     21 
     22 //
     23 // Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     24 // Use is subject to license terms.
     25 //
     26 
     27 #pragma ident	"@(#)px_vnops.cc	1.13	08/05/20 SMI"
     28 
     29 #include <sys/types.h>
     30 #include <sys/cred.h>
     31 #include <sys/vfs.h>
     32 #include <sys/vnode.h>
     33 #include <sys/flock.h>
     34 #include <sys/uio.h>
     35 #include <sys/debug.h>
     36 #include <sys/fs_subr.h>
     37 #include <sys/swap.h>
     38 
     39 #include <vm/page.h>
     40 #include <vm/as.h>
     41 #include <vm/seg.h>
     42 #include <pxfs/common/pxfslib.h>
     43 
     44 #include "../version.h"
     45 #include <pxfs/client/pxfobj.h>
     46 
     47 //
     48 // This file implements the vnodeops table for the vnode interface for PXFS
     49 // file systems. Its basic job is to convert "C" calls to "C++" calls.
     50 //
     51 
     52 #if	SOL_VERSION >= __s11
     53 static int px_open(vnode **, int, cred *, caller_context_t *);
     54 static int px_close(vnode *, int, int, offset_t, cred *, caller_context_t *);
     55 #else
     56 static int px_open(vnode **, int, cred *);
     57 static int px_close(vnode *, int, int, offset_t, cred *);
     58 #endif
     59 #if	SOL_VERSION >= __s10
     60 static int px_read(vnode *, uio *, int, cred *, caller_context *);
     61 static int px_write(vnode *, uio *, int, cred *, caller_context *);
     62 #else
     63 static int px_read(vnode *, uio *, int, cred *);
     64 static int px_write(vnode *, uio *, int, cred *);
     65 #endif
     66 #if	SOL_VERSION >= __s11
     67 static int px_ioctl(vnode *, int, intptr_t, int, cred *, int *,
     68     caller_context *);
     69 static int px_getattr(vnode *, vattr *, int, cred *, caller_context *);
     70 #else
     71 static int px_ioctl(vnode *, int, intptr_t, int, cred *, int *);
     72 static int px_getattr(vnode *, vattr *, int, cred *);
     73 #endif
     74 
     75 //
     76 // An extra argument caller_context is added to VOP_SPACE, VOP_SETATTR,
     77 // VOP_RWLOCK and VOP_RWUNLOCK to support NFSv4 delegations in
     78 // accordance with PSARC 2004/172. Caller_context is used to identify
     79 // caller of the operation whether it is NFS server or local process.
     80 // When passed to PxFS, caller_context structure is not used. Hence
     81 // it is explicitely set to NULL in PxFS client and server.
     82 //
     83 
     84 #if	SOL_VERSION >= __s10
     85 static int px_setattr(vnode *, vattr *, int, cred *, caller_context *);
     86 static int px_space(vnode *, int, struct flock64 *, int, offset_t, cred *,
     87     caller_context *);
     88 static void px_rwlock(vnode *, int, caller_context *);
     89 static void px_rwunlock(vnode *, int, caller_context *);
     90 #else
     91 static int px_setattr(vnode *, vattr *, int, cred *);
     92 static int px_space(vnode *, int, struct flock64 *, int, offset_t, cred *);
     93 static void px_rwlock(vnode *, int);
     94 static void px_rwunlock(vnode *, int);
     95 #endif
     96 
     97 #if	SOL_VERSION >= __s11
     98 static int px_access(vnode *, int, int, cred *, caller_context *);
     99 #else
    100 static int px_access(vnode *, int, int, cred *);
    101 #endif
    102 
    103 #if	SOL_VERSION >= __s11
    104 static int px_lookup(vnode *, char *, vnode **, pathname *, int, vnode *,
    105 		cred *, caller_context_t *, int *, struct pathname *);
    106 #else
    107 static int px_lookup(vnode *, char *, vnode **, pathname *, int, vnode *,
    108 		cred *);
    109 #endif
    110 
    111 #if	SOL_VERSION >= __s11
    112 static int px_create(vnode *, char *, vattr *, enum vcexcl, int, vnode **,
    113 		cred *, int, caller_context_t *, vsecattr_t *);
    114 #else
    115 static int px_create(vnode *, char *, vattr *, enum vcexcl, int, vnode **,
    116 		cred *, int);
    117 #endif
    118 
    119 #if	SOL_VERSION >= __s11
    120 static int px_remove(vnode *, char *, cred *, caller_context_t *, int);
    121 static int px_link(vnode *, vnode *, char *, cred *, caller_context_t *, int);
    122 static int px_rename(vnode *, char *, vnode *, char *, cred *,
    123     caller_context_t *, int);
    124 #else
    125 static int px_remove(vnode *, char *, cred *);
    126 static int px_link(vnode *, vnode *, char *, cred *);
    127 static int px_rename(vnode *, char *, vnode *, char *, cred *);
    128 #endif
    129 
    130 #if	SOL_VERSION >= __s11
    131 static int px_mkdir(vnode *, char *, vattr *, vnode **, cred *,
    132     caller_context_t *, int, vsecattr_t *);
    133 #else
    134 static int px_mkdir(vnode *, char *, vattr *, vnode **, cred *);
    135 #endif
    136 
    137 #if	SOL_VERSION >= __s11
    138 static int px_rmdir(vnode *, char *, vnode *, cred *, caller_context_t *, int);
    139 #else
    140 static int px_rmdir(vnode *, char *, vnode *, cred *);
    141 #endif
    142 
    143 #if	SOL_VERSION >= __s11
    144 static int px_readdir(vnode *, uio *, cred *, int *, caller_context_t *, int);
    145 static int px_symlink(vnode *, char *, vattr *, char *, cred *,
    146     caller_context_t *, int);
    147 #else
    148 static int px_readdir(vnode *, uio *, cred *, int *);
    149 static int px_symlink(vnode *, char *, vattr *, char *, cred *);
    150 #endif
    151 
    152 #if	SOL_VERSION >= __s11
    153 static int px_readlink(vnode *, uio *, cred *, caller_context_t *);
    154 static int px_fsync(vnode *, int, cred *, caller_context_t *);
    155 static void px_inactive(vnode *, cred *, caller_context_t *);
    156 static int px_fid(vnode *, fid *, caller_context_t *);
    157 static int px_seek(vnode *, offset_t, offset_t *, caller_context_t *);
    158 static int px_cmp(struct vnode *vp1, struct vnode *vp2, caller_context_t *);
    159 #else
    160 static int px_readlink(vnode *, uio *, cred *);
    161 static int px_fsync(vnode *, int, cred *);
    162 static void px_inactive(vnode *, cred *);
    163 static int px_fid(vnode *, fid *);
    164 static int px_seek(vnode *, offset_t, offset_t *);
    165 static int px_cmp(struct vnode *vp1, struct vnode *vp2);
    166 #endif
    167 
    168 #if	SOL_VERSION >= __s11
    169 static int px_frlock(vnode *, int, struct flock64 *, int, offset_t,
    170     flk_callback_t *, cred *, caller_context_t *);
    171 #else
    172 #if	SOL_VERSION >= __s9 /* new s9 frlock interface */
    173 static int px_frlock(vnode *, int, struct flock64 *, int, offset_t,
    174     flk_callback_t *, cred *);
    175 #else
    176 static int px_frlock(vnode *, int, struct flock64 *, int, offset_t, cred *);
    177 #endif
    178 #endif
    179 
    180 #if	SOL_VERSION >= __s11
    181 static int px_realvp(vnode *, vnode **, caller_context_t *);
    182 static int px_getpage(vnode *, offset_t, size_t, uint_t *, page **, size_t,
    183     seg *, caddr_t, enum seg_rw, cred *, caller_context_t *);
    184 static int px_putpage(vnode *, offset_t, size_t, int, cred *,
    185     caller_context_t *);
    186 static int px_map(vnode *, offset_t, as *, caddr_t *, size_t, uchar_t, uchar_t,
    187     uint_t, cred *, caller_context_t *);
    188 static int px_addmap(vnode *, offset_t, as *, caddr_t, size_t, uchar_t, uchar_t,
    189     uint_t, cred *, caller_context_t *);
    190 static int px_delmap(vnode *, offset_t, as *, caddr_t, size_t, uint_t, uint_t,
    191     uint_t, cred *, caller_context_t *);
    192 static int px_dump(vnode_t *, caddr_t, int, int, caller_context_t *);
    193 static int px_pathconf(vnode *, int, ulong_t *, cred *, caller_context_t *);
    194 static int px_pageio(vnode *, page *, u_offset_t, size_t, int, cred *,
    195     caller_context_t *);
    196 static int px_dumpctl(vnode_t *, int, int *, caller_context_t *);
    197 static void px_dispose(vnode_t *, page_t *, int, int, struct cred *,
    198     caller_context_t *);
    199 static int px_setsecattr(vnode *, vsecattr_t *, int, struct cred *,
    200     caller_context_t *);
    201 static int px_getsecattr(vnode *, vsecattr_t *, int, struct cred *,
    202     caller_context_t *);
    203 #else
    204 static int px_realvp(vnode *, vnode **);
    205 static int px_getpage(vnode *, offset_t, size_t, uint_t *, page **, size_t,
    206 		seg *, caddr_t, enum seg_rw, cred *);
    207 static int px_putpage(vnode *, offset_t, size_t, int, cred *);
    208 static int px_map(vnode *, offset_t, as *, caddr_t *, size_t, uchar_t, uchar_t,
    209 		uint_t, cred *);
    210 static int px_addmap(vnode *, offset_t, as *, caddr_t, size_t, uchar_t, uchar_t,
    211 		uint_t, cred *);
    212 static int px_delmap(vnode *, offset_t, as *, caddr_t, size_t, uint_t, uint_t,
    213 		uint_t, cred *);
    214 static int px_dump(vnode_t *, caddr_t, int, int);
    215 static int px_pathconf(vnode *, int, ulong_t *, cred *);
    216 static int px_pageio(vnode *, page *, u_offset_t, size_t, int, cred *);
    217 static int px_dumpctl(vnode_t *, int, int *);
    218 static void px_dispose(vnode_t *, page_t *, int, int, struct cred *);
    219 static int px_setsecattr(vnode *, vsecattr_t *, int, struct cred *);
    220 static int px_getsecattr(vnode *, vsecattr_t *, int, struct cred *);
    221 #endif
    222 
    223 #if	SOL_VERSION >= __s11
    224 static int px_shrlock(vnode *, int, shrlock *, int, cred *, caller_context_t *);
    225 #else
    226 #if	SOL_VERSION >= __s10
    227 static int px_shrlock(vnode *, int, shrlock *, int, cred *);
    228 #else
    229 static int px_shrlock(vnode *, int, shrlock *, int);
    230 #endif
    231 #endif
    232 
    233 #ifdef FSI
    234 
    235 struct vnodeops *px_vnodeopsp = NULL;
    236 
    237 fs_operation_def_t px_vnodeops_template[] = {
    238 	VOPNAME_OPEN, (fs_generic_func_p)px_open,
    239 	VOPNAME_CLOSE, (fs_generic_func_p)px_close,
    240 	VOPNAME_READ, (fs_generic_func_p)px_read,
    241 	VOPNAME_WRITE, (fs_generic_func_p)px_write,
    242 	VOPNAME_IOCTL, (fs_generic_func_p)px_ioctl,
    243 	VOPNAME_SETFL, (fs_generic_func_p)fs_setfl,
    244 	VOPNAME_GETATTR, (fs_generic_func_p)px_getattr,
    245 	VOPNAME_SETATTR, (fs_generic_func_p)px_setattr,
    246 	VOPNAME_ACCESS, (fs_generic_func_p)px_access,
    247 	VOPNAME_LOOKUP, (fs_generic_func_p)px_lookup,
    248 	VOPNAME_CREATE, (fs_generic_func_p)px_create,
    249 	VOPNAME_REMOVE, (fs_generic_func_p)px_remove,
    250 	VOPNAME_LINK, (fs_generic_func_p)px_link,
    251 	VOPNAME_RENAME, (fs_generic_func_p)px_rename,
    252 	VOPNAME_MKDIR, (fs_generic_func_p)px_mkdir,
    253 	VOPNAME_RMDIR, (fs_generic_func_p)px_rmdir,
    254 	VOPNAME_READDIR, (fs_generic_func_p)px_readdir,
    255 	VOPNAME_SYMLINK, (fs_generic_func_p)px_symlink,
    256 	VOPNAME_READLINK, (fs_generic_func_p)px_readlink,
    257 	VOPNAME_FSYNC, (fs_generic_func_p)px_fsync,
    258 	VOPNAME_INACTIVE, (fs_generic_func_p)px_inactive,
    259 	VOPNAME_FID, (fs_generic_func_p)px_fid,
    260 	VOPNAME_RWLOCK, (fs_generic_func_p)px_rwlock,
    261 	VOPNAME_RWUNLOCK, (fs_generic_func_p)px_rwunlock,
    262 	VOPNAME_SEEK, (fs_generic_func_p)px_seek,
    263 	VOPNAME_CMP, (fs_generic_func_p)px_cmp,
    264 	VOPNAME_FRLOCK, (fs_generic_func_p)px_frlock,
    265 	VOPNAME_SPACE, (fs_generic_func_p)px_space,
    266 	VOPNAME_REALVP, (fs_generic_func_p)px_realvp,
    267 	VOPNAME_GETPAGE, (fs_generic_func_p)px_getpage,
    268 	VOPNAME_PUTPAGE, (fs_generic_func_p)px_putpage,
    269 	VOPNAME_MAP, (fs_generic_func_p)px_map,
    270 	VOPNAME_ADDMAP, (fs_generic_func_p)px_addmap,
    271 	VOPNAME_DELMAP, (fs_generic_func_p)px_delmap,
    272 	VOPNAME_POLL, (fs_generic_func_p)fs_poll,
    273 	VOPNAME_DUMP, (fs_generic_func_p)px_dump,
    274 	VOPNAME_PATHCONF, (fs_generic_func_p)px_pathconf,
    275 	VOPNAME_PAGEIO, (fs_generic_func_p)px_pageio,
    276 	VOPNAME_DUMPCTL, (fs_generic_func_p)px_dumpctl,
    277 	VOPNAME_DISPOSE, (fs_generic_func_p)px_dispose,
    278 	VOPNAME_GETSECATTR, (fs_generic_func_p)px_getsecattr,
    279 	VOPNAME_SETSECATTR, (fs_generic_func_p)px_setsecattr,
    280 	VOPNAME_SHRLOCK, (fs_generic_func_p)px_shrlock,
    281 	NULL, NULL
    282 };
    283 
    284 //
    285 // px_vn_init - initializes the vnode data structure (operations vector)
    286 // for pxfs.
    287 //
    288 int
    289 px_vn_init(char *namep)
    290 {
    291 	int	error;
    292 
    293 	error = vn_make_ops(namep, px_vnodeops_template, &px_vnodeopsp);
    294 	return (error);
    295 }
    296 
    297 //
    298 // px_vn_uninit - uninitializes the vnode data structure (operations vector)
    299 // for pxfs.
    300 //
    301 void
    302 px_vn_uninit()
    303 {
    304 	if (px_vnodeopsp != NULL) {
    305 		vn_freevnodeops(px_vnodeopsp);
    306 	}
    307 }
    308 
    309 #else
    310 
    311 struct vnodeops px_vnodeops = {
    312 	px_open,
    313 	px_close,
    314 	px_read,
    315 	px_write,
    316 	px_ioctl,
    317 	fs_setfl,
    318 	px_getattr,
    319 	px_setattr,
    320 	px_access,
    321 	px_lookup,
    322 	px_create,
    323 	px_remove,
    324 	px_link,
    325 	px_rename,
    326 	px_mkdir,
    327 	px_rmdir,
    328 	px_readdir,
    329 	px_symlink,
    330 	px_readlink,
    331 	px_fsync,
    332 	px_inactive,
    333 	px_fid,
    334 	px_rwlock,
    335 	px_rwunlock,
    336 	px_seek,
    337 	px_cmp,
    338 	px_frlock,
    339 	px_space,
    340 	px_realvp,
    341 	px_getpage,
    342 	px_putpage,
    343 	px_map,
    344 	px_addmap,
    345 	px_delmap,
    346 	fs_poll,
    347 	px_dump,
    348 	px_pathconf,
    349 	px_pageio,
    350 	px_dumpctl,
    351 	px_dispose,
    352 	px_setsecattr,
    353 	px_getsecattr,
    354 	px_shrlock
    355 };
    356 
    357 struct vnodeops *px_vnodeopsp = &px_vnodeops;
    358 
    359 #endif
    360 
    361 static int
    362 #if	SOL_VERSION >= __s11
    363 px_open(struct vnode **vpp, int flag, struct cred *cr, caller_context_t *)
    364 #else
    365 px_open(struct vnode **vpp, int flag, struct cred *cr)
    366 #endif
    367 {
    368 	//
    369 	// Swapon to a pxfs file isn't supported so
    370 	// fail the open if VISSWAP is set.
    371 	//
    372 	if ((*vpp)->v_flag & VISSWAP)
    373 		return (EINVAL);
    374 	else
    375 		return (pxnode::VTOPX(*vpp)->open(vpp, flag, cr));
    376 }
    377 
    378 static int
    379 #if	SOL_VERSION >= __s11
    380 px_close(struct vnode *vp, int flag, int count, offset_t offset,
    381     struct cred *cr, caller_context_t *)
    382 #else
    383 px_close(struct vnode *vp, int flag, int count, offset_t offset,
    384     struct cred *cr)
    385 #endif
    386 {
    387 	return (pxnode::VTOPX(vp)->close(flag, count, offset, cr));
    388 }
    389 
    390 static int
    391 #if	SOL_VERSION >= __s10
    392 px_read(struct vnode *vp, struct uio *uiop, int ioflag, struct cred *cr,
    393     caller_context *)
    394 #else
    395 px_read(struct vnode *vp, struct uio *uiop, int ioflag, struct cred *cr)
    396 #endif
    397 {
    398 	return (pxnode::VTOPX(vp)->read(uiop, ioflag, cr));
    399 }
    400 
    401 static int
    402 #if	SOL_VERSION >= __s10
    403 px_write(struct vnode *vp, struct uio *uiop, int ioflag, struct cred *cr,
    404     caller_context *)
    405 #else
    406 px_write(struct vnode *vp, struct uio *uiop, int ioflag, struct cred *cr)
    407 #endif
    408 {
    409 	return (pxnode::VTOPX(vp)->write(uiop, ioflag, cr));
    410 }
    411 
    412 static int
    413 #if	SOL_VERSION >= __s11
    414 px_ioctl(struct vnode *vp, int cmd, intptr_t arg, int flag, struct cred *cr,
    415     int *rvalp, caller_context_t *)
    416 #else
    417 px_ioctl(struct vnode *vp, int cmd, intptr_t arg, int flag, struct cred *cr,
    418     int *rvalp)
    419 #endif
    420 {
    421 	return (pxnode::VTOPX(vp)->ioctl(cmd, arg, flag, cr, rvalp));
    422 }
    423 
    424 static int
    425 #if	SOL_VERSION >= __s11
    426 px_getattr(struct vnode *vp, struct vattr *vap, int flags, struct cred *cr,
    427     caller_context_t *)
    428 #else
    429 px_getattr(struct vnode *vp, struct vattr *vap, int flags, struct cred *cr)
    430 #endif
    431 {
    432 	return (pxnode::VTOPX(vp)->getattr(vap, flags, cr));
    433 }
    434 
    435 static int
    436 #if	SOL_VERSION >= __s10
    437 px_setattr(struct vnode *vp, struct vattr *vap, int flags, struct cred *cr,
    438     caller_context *)
    439 #else
    440 px_setattr(struct vnode *vp, struct vattr *vap, int flags, struct cred *cr)
    441 #endif
    442 {
    443 	return (pxnode::VTOPX(vp)->setattr(vap, flags, cr));
    444 }
    445 
    446 static int
    447 #if	SOL_VERSION >= __s11
    448 px_access(struct vnode *vp, int mode, int flags, struct cred *cr,
    449     caller_context_t *)
    450 #else
    451 px_access(struct vnode *vp, int mode, int flags, struct cred *cr)
    452 #endif
    453 {
    454 	return (pxnode::VTOPX(vp)->access(mode, flags, cr));
    455 }
    456 
    457 static int
    458 #if	SOL_VERSION >= __s11
    459 px_readlink(struct vnode *vp, struct uio *uiop, struct cred *cr,
    460     caller_context_t *)
    461 #else
    462 px_readlink(struct vnode *vp, struct uio *uiop, struct cred *cr)
    463 #endif
    464 {
    465 	return (pxnode::VTOPX(vp)->readlink(uiop, cr));
    466 }
    467 
    468 static int
    469 #if	SOL_VERSION >= __s11
    470 px_fsync(struct vnode *vp, int syncflag, struct cred *cr, caller_context_t *)
    471 #else
    472 px_fsync(struct vnode *vp, int syncflag, struct cred *cr)
    473 #endif
    474 {
    475 	return (pxnode::VTOPX(vp)->fsync(syncflag, cr));
    476 }
    477 
    478 static void
    479 #if	SOL_VERSION >= __s11
    480 px_inactive(struct vnode *vp, struct cred *, caller_context_t *)
    481 #else
    482 px_inactive(struct vnode *vp, struct cred *)
    483 #endif
    484 {
    485 	pxnode::VTOPX(vp)->inactive();
    486 }
    487 
    488 static int
    489 #if	SOL_VERSION >= __s11
    490 px_lookup(struct vnode *dvp, char *nm, struct vnode **vpp,
    491     struct pathname *pnp, int flags, struct vnode *rdir, struct cred *cr,
    492     caller_context_t *, int *, struct pathname *)
    493 #else
    494 px_lookup(struct vnode *dvp, char *nm, struct vnode **vpp,
    495 	struct pathname *pnp, int flags, struct vnode *rdir, struct cred *cr)
    496 #endif
    497 {
    498 	return (pxnode::VTOPX(dvp)->lookup(nm, vpp, pnp, flags, rdir, cr));
    499 }
    500 
    501 static int
    502 #if	SOL_VERSION >= __s11
    503 px_create(struct vnode *dvp, char *name, struct vattr *vap, enum vcexcl excl,
    504     int mode, struct vnode **vpp, struct cred *cr, int flag,
    505     caller_context_t *, vsecattr_t *)
    506 #else
    507 px_create(struct vnode *dvp, char *name, struct vattr *vap, enum vcexcl excl,
    508 	int mode, struct vnode **vpp, struct cred *cr, int flag)
    509 #endif
    510 {
    511 	return (pxnode::VTOPX(dvp)->create(name, vap, excl, mode, vpp,
    512 	    cr, flag));
    513 }
    514 
    515 static int
    516 #if	SOL_VERSION >= __s11
    517 px_remove(struct vnode *dvp, char *nm, struct cred *cr, caller_context_t *, int)
    518 #else
    519 px_remove(struct vnode *dvp, char *nm, struct cred *cr)
    520 #endif
    521 {
    522 	return (pxnode::VTOPX(dvp)->remove(nm, cr));
    523 }
    524 
    525 static int
    526 #if	SOL_VERSION >= __s11
    527 px_link(struct vnode *tdvp, struct vnode *svp, char *tnm, struct cred *cr,
    528     caller_context_t *, int)
    529 #else
    530 px_link(struct vnode *tdvp, struct vnode *svp, char *tnm, struct cred *cr)
    531 #endif
    532 {
    533 	return (pxnode::VTOPX(tdvp)->link(svp, tnm, cr));
    534 }
    535 
    536 static int
    537 #if	SOL_VERSION >= __s11
    538 px_rename(struct vnode *sdvp, char *snm, struct vnode *tdvp, char *tnm,
    539     struct cred *cr, caller_context_t *, int)
    540 #else
    541 px_rename(struct vnode *sdvp, char *snm, struct vnode *tdvp, char *tnm,
    542     struct cred *cr)
    543 #endif
    544 {
    545 	return (pxnode::VTOPX(sdvp)->rename(snm, tdvp, tnm, cr));
    546 }
    547 
    548 static int
    549 #if	SOL_VERSION >= __s11
    550 px_mkdir(struct vnode *dvp, char *nm, struct vattr *vap, struct vnode **vpp,
    551     struct cred *cr, caller_context_t *, int, vsecattr_t *)
    552 #else
    553 px_mkdir(struct vnode *dvp, char *nm, struct vattr *vap, struct vnode **vpp,
    554     struct cred *cr)
    555 #endif
    556 {
    557 	return (pxnode::VTOPX(dvp)->mkdir(nm, vap, vpp, cr));
    558 }
    559 
    560 static int
    561 #if	SOL_VERSION >= __s11
    562 px_rmdir(struct vnode *dvp, char *nm, struct vnode *cdir, struct cred *cr,
    563     caller_context_t *, int)
    564 #else
    565 px_rmdir(struct vnode *dvp, char *nm, struct vnode *cdir, struct cred *cr)
    566 #endif
    567 {
    568 	return (pxnode::VTOPX(dvp)->rmdir(nm, cdir, cr));
    569 }
    570 
    571 static int
    572 #if	SOL_VERSION >= __s11
    573 px_readdir(struct vnode *vp, struct uio *uiop, struct cred *cr, int *eofp,
    574     caller_context_t *, int)
    575 #else
    576 px_readdir(struct vnode *vp, struct uio *uiop, struct cred *cr, int *eofp)
    577 #endif
    578 {
    579 	int dummy_eof;
    580 
    581 	return (pxnode::VTOPX(vp)->readdir(uiop, cr, eofp == NULL ?
    582 	    dummy_eof : *eofp));
    583 }
    584 
    585 static int
    586 #if	SOL_VERSION >= __s11
    587 px_symlink(struct vnode *dvp, char *linkname, struct vattr *vap,
    588     char *target, struct cred *cr, caller_context_t *, int)
    589 #else
    590 px_symlink(struct vnode *dvp, char *linkname, struct vattr *vap,
    591     char *target, struct cred *cr)
    592 #endif
    593 {
    594 	return (pxnode::VTOPX(dvp)->symlink(linkname, vap, target, cr));
    595 }
    596 
    597 static int
    598 #if	SOL_VERSION >= __s11
    599 px_fid(struct vnode *vp, struct fid *fidp, caller_context_t *)
    600 #else
    601 px_fid(struct vnode *vp, struct fid *fidp)
    602 #endif
    603 {
    604 	return (pxnode::VTOPX(vp)->vop_fid(fidp));
    605 }
    606 
    607 static void
    608 #if	SOL_VERSION >= __s10
    609 px_rwlock(struct vnode *vp, int write_lock, caller_context *)
    610 #else
    611 px_rwlock(struct vnode *vp, int write_lock)
    612 #endif
    613 {
    614 	pxnode::VTOPX(vp)->rwlock(write_lock);
    615 }
    616 
    617 static void
    618 #if	SOL_VERSION >= __s10
    619 px_rwunlock(struct vnode *vp, int write_lock, caller_context *)
    620 #else
    621 px_rwunlock(struct vnode *vp, int write_lock)
    622 #endif
    623 {
    624 	pxnode::VTOPX(vp)->rwunlock(write_lock);
    625 }
    626 
    627 static int
    628 #if	SOL_VERSION >= __s11
    629 px_seek(struct vnode *vp, offset_t ooff, offset_t *noffp, caller_context_t *)
    630 #else
    631 px_seek(struct vnode *vp, offset_t ooff, offset_t *noffp)
    632 #endif
    633 {
    634 	return (pxnode::VTOPX(vp)->seek(ooff, noffp));
    635 }
    636 
    637 static int
    638 #if	SOL_VERSION >= __s11
    639 px_cmp(struct vnode *vp1, struct vnode *vp2, caller_context_t *)
    640 #else
    641 px_cmp(struct vnode *vp1, struct vnode *vp2)
    642 #endif
    643 {
    644 	vnode_t *realvp;
    645 
    646 	//
    647 	// if this request for the compare comes in from lofs
    648 	// there is no guarantee that this is really pxnode.
    649 	// So we check first before calling px_realvp(),
    650 	// otherwise we risk panicing the node  because realvp()
    651 	// is a pxnode class method (unique to a pxnode)
    652 	//
    653 	if (vp1->v_op != vp2->v_op)
    654 		return (0);
    655 
    656 	if (vp2->v_type == VCHR) {
    657 #if	SOL_VERSION >= __s11
    658 		if (px_realvp(vp2, &realvp, NULL) == 0) {
    659 #else
    660 		if (px_realvp(vp2, &realvp) == 0) {
    661 #endif
    662 			return (vp1 == realvp);
    663 		}
    664 	}
    665 	return (vp1 == vp2);
    666 }
    667 
    668 #if	SOL_VERSION >= __s11
    669 static int
    670 px_frlock(struct vnode *vp, int cmd, struct flock64 *bfp, int flag,
    671     offset_t offset, flk_callback_t *flk_cb, cred_t *cr, caller_context_t *)
    672 {
    673 	return (pxnode::VTOPX(vp)->frlock(cmd, bfp, flag, offset, flk_cb, cr));
    674 }
    675 #else
    676 #if	SOL_VERSION >= __s9 /* new s9 frlock interface */
    677 static int
    678 px_frlock(struct vnode *vp, int cmd, struct flock64 *bfp, int flag,
    679 	offset_t offset, flk_callback_t *flk_cb, cred_t *cr)
    680 {
    681 	return (pxnode::VTOPX(vp)->frlock(cmd, bfp, flag, offset, flk_cb, cr));
    682 }
    683 #else
    684 static int
    685 px_frlock(struct vnode *vp, int cmd, struct flock64 *bfp, int flag,
    686 	offset_t offset, cred_t *cr)
    687 {
    688 	return (pxnode::VTOPX(vp)->frlock(cmd, bfp, flag, offset, cr));
    689 }
    690 #endif
    691 #endif
    692 
    693 static int
    694 #if	SOL_VERSION >= __s10
    695 px_space(struct vnode *vp, int cmd, struct flock64 *bfp, int flag,
    696     offset_t offset, struct cred *cr, caller_context *)
    697 #else
    698 px_space(struct vnode *vp, int cmd, struct flock64 *bfp, int flag,
    699     offset_t offset, struct cred *cr)
    700 #endif
    701 {
    702 	return (pxnode::VTOPX(vp)->space(cmd, bfp, flag, offset, cr));
    703 }
    704 
    705 static int
    706 #if	SOL_VERSION >= __s11
    707 px_realvp(struct vnode *vp, struct vnode **vpp, caller_context_t *)
    708 #else
    709 px_realvp(struct vnode *vp, struct vnode **vpp)
    710 #endif
    711 {
    712 	return (pxnode::VTOPX(vp)->realvp(vpp));
    713 }
    714 
    715 static int
    716 #if	SOL_VERSION >= __s11
    717 px_getpage(struct vnode *vp, offset_t off, size_t len, uint_t *protp,
    718 	page_t *plarr[], size_t plsz, struct seg *segp, caddr_t addr,
    719 	enum seg_rw rw, struct cred *cr, caller_context_t *)
    720 #else
    721 px_getpage(struct vnode *vp, offset_t off, size_t len, uint_t *protp,
    722 	page_t *plarr[], size_t plsz, struct seg *segp, caddr_t addr,
    723 	enum seg_rw rw, struct cred *cr)
    724 #endif
    725 {
    726 	return (pxnode::VTOPX(vp)->getpage(off, len, protp, plarr, plsz, segp,
    727 	    addr, rw, cr));
    728 }
    729 
    730 static int
    731 #if	SOL_VERSION >= __s11
    732 px_putpage(struct vnode *vp, offset_t off, size_t len, int flags,
    733 	struct cred *cr, caller_context_t *)
    734 #else
    735 px_putpage(struct vnode *vp, offset_t off, size_t len, int flags,
    736 	struct cred *cr)
    737 #endif
    738 {
    739 	return (pxnode::VTOPX(vp)->putpage(off, len, flags, cr));
    740 }
    741 
    742 static int
    743 #if	SOL_VERSION >= __s11
    744 px_map(struct vnode *vp, offset_t off, struct as *asp, caddr_t *addrp,
    745 	size_t len, uchar_t prot, uchar_t maxprot, uint_t flags,
    746 	struct cred *cr, caller_context_t *)
    747 #else
    748 px_map(struct vnode *vp, offset_t off, struct as *asp, caddr_t *addrp,
    749 	size_t len, uchar_t prot, uchar_t maxprot, uint_t flags,
    750 	struct cred *cr)
    751 #endif
    752 {
    753 	return (pxnode::VTOPX(vp)->map(off, asp, addrp, len, prot,
    754 	    maxprot, flags, cr));
    755 }
    756 
    757 static int
    758 #if	SOL_VERSION >= __s11
    759 px_addmap(struct vnode *vp, offset_t off, struct as *asp, caddr_t addr,
    760 	size_t len, uchar_t  prot, uchar_t maxprot, uint_t flags,
    761 	struct cred *cr, caller_context_t *)
    762 #else
    763 px_addmap(struct vnode *vp, offset_t off, struct as *asp, caddr_t addr,
    764 	size_t len, uchar_t  prot, uchar_t maxprot, uint_t flags,
    765 	struct cred *cr)
    766 #endif
    767 {
    768 	return (pxnode::VTOPX(vp)->addmap(off, asp, addr, len, prot, maxprot,
    769 	    flags, cr));
    770 }
    771 
    772 static int
    773 #if	SOL_VERSION >= __s11
    774 px_delmap(struct vnode *vp, offset_t off, struct as *asp, caddr_t addr,
    775 	size_t len, uint_t prot, uint_t maxprot, uint_t flags, struct cred *cr,
    776 	caller_context_t *)
    777 #else
    778 px_delmap(struct vnode *vp, offset_t off, struct as *asp, caddr_t addr,
    779 	size_t len, uint_t prot, uint_t maxprot, uint_t flags, struct cred *cr)
    780 #endif
    781 {
    782 	return (pxnode::VTOPX(vp)->delmap(off, asp, addr, len, prot, maxprot,
    783 	    flags, cr));
    784 }
    785 
    786 static int
    787 #if	SOL_VERSION >= __s11
    788 px_pathconf(struct vnode *vp, int cmd, ulong_t *valp, struct cred *cr,
    789     caller_context_t *)
    790 #else
    791 px_pathconf(struct vnode *vp, int cmd, ulong_t *valp, struct cred *cr)
    792 #endif
    793 {
    794 	return (pxnode::VTOPX(vp)->pathconf(cmd, valp, cr));
    795 }
    796 
    797 static int
    798 #if	SOL_VERSION >= __s11
    799 px_pageio(struct vnode *, page_t *, u_offset_t, size_t, int, cred_t *,
    800     caller_context_t *)
    801 #else
    802 px_pageio(struct vnode *, page_t *, u_offset_t, size_t, int, cred_t *)
    803 #endif
    804 {
    805 	return (ENOTSUP);
    806 }
    807 
    808 static int
    809 #if	SOL_VERSION >= __s11
    810 px_dump(vnode_t *, caddr_t, int, int, caller_context_t *)
    811 #else
    812 px_dump(vnode_t *, caddr_t, int, int)
    813 #endif
    814 {
    815 	return (ENOTSUP);
    816 }
    817 
    818 static int
    819 #if	SOL_VERSION >= __s11
    820 px_dumpctl(vnode_t *, int, int *, caller_context_t *)
    821 #else
    822 px_dumpctl(vnode_t *, int, int *)
    823 #endif
    824 {
    825 	return (ENOTSUP);
    826 }
    827 
    828 static void
    829 #if	SOL_VERSION >= __s11
    830 px_dispose(struct vnode *vp, page_t *pp, int fl, int dn, struct cred *cr,
    831     caller_context_t *)
    832 #else
    833 px_dispose(struct vnode *vp, page_t *pp, int fl, int dn, struct cred *cr)
    834 #endif
    835 {
    836 	pxnode::VTOPX(vp)->dispose(pp, fl, dn, cr);
    837 }
    838 
    839 static int
    840 #if	SOL_VERSION >= __s11
    841 px_setsecattr(vnode *vp, vsecattr_t *vsap, int flag, struct cred *cr,
    842     caller_context_t *)
    843 #else
    844 px_setsecattr(vnode *vp, vsecattr_t *vsap, int flag, struct cred *cr)
    845 #endif
    846 {
    847 	return (pxnode::VTOPX(vp)->setsecattr(vsap, flag, cr));
    848 }
    849 
    850 static int
    851 #if	SOL_VERSION >= __s11
    852 px_getsecattr(vnode *vp, vsecattr_t *vsap, int flag, struct cred *cr,
    853     caller_context_t *)
    854 #else
    855 px_getsecattr(vnode *vp, vsecattr_t *vsap, int flag, struct cred *cr)
    856 #endif
    857 {
    858 	return (pxnode::VTOPX(vp)->getsecattr(vsap, flag, cr));
    859 }
    860 
    861 static int
    862 #if	SOL_VERSION >= __s11
    863 px_shrlock(vnode *vp, int cmd, shrlock *bfp, int flag, cred *cr,
    864     caller_context_t *)
    865 {
    866 	return (pxnode::VTOPX(vp)->vop_shrlock(cmd, bfp, flag, cr));
    867 }
    868 #else
    869 #if	SOL_VERSION >= __s10
    870 px_shrlock(vnode *vp, int cmd, shrlock *bfp, int flag, cred *cr)
    871 {
    872 	return (pxnode::VTOPX(vp)->vop_shrlock(cmd, bfp, flag, cr));
    873 }
    874 #else
    875 px_shrlock(vnode *vp, int cmd, shrlock *bfp, int flag)
    876 {
    877 	return (pxnode::VTOPX(vp)->vop_shrlock(cmd, bfp, flag, NULL));
    878 }
    879 #endif
    880 #endif
    881