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 2006 Sun Microsystems, Inc. All rights reserved. 24 // Use is subject to license terms. 25 // 26 // Check various assertons that could not be checked at compile time. 27 // 28 29 #pragma ident "@(#)pxfs_check.cc 1.20 08/05/20 SMI" 30 31 #ifdef DEBUG 32 33 #include <sys/vnode.h> 34 #include <sys/acl.h> 35 #include <sys/statvfs.h> 36 37 #include <h/sol.h> 38 #include <sys/os.h> 39 40 #include <sys/sol_version.h> 41 42 #if SOL_VERSION >= __s10 43 #ifndef BUG_4954775 44 #define BUG_4954775 45 #endif 46 #endif 47 48 static void check_sol_vtype(void); 49 static void check_fobj_attr(void); 50 static void check_statvfs(void); 51 52 void 53 pxfs_check_assertions() 54 { 55 check_sol_vtype(); 56 check_fobj_attr(); 57 check_statvfs(); 58 } 59 60 static void 61 check_sol_vtype() 62 { 63 // 64 // PXFS requires that the sol.idl vtype_t and Solaris vnode type 65 // values match. 66 // 67 #ifdef BUG_4954775 68 if ((vtype)sol::VNON != VNON || (vtype)sol::VREG != VREG || 69 (vtype)sol::VDIR != VDIR || (vtype)sol::VBLK != VBLK || 70 (vtype)sol::VCHR != VCHR || (vtype)sol::VLNK != VLNK || 71 (vtype)sol::VFIFO != VFIFO || (vtype)sol::VDOOR != VDOOR || 72 (vtype)sol::VPRC != VPROC || (vtype)sol::VSOCK != VSOCK || 73 (vtype)sol::VBAD != VBAD || (vtype)sol::VPORT != VPORT) { 74 os::panic("check_sol_vtype"); 75 } 76 #else 77 if ((vtype)sol::VNON != VNON || (vtype)sol::VREG != VREG || 78 (vtype)sol::VDIR != VDIR || (vtype)sol::VBLK != VBLK || 79 (vtype)sol::VCHR != VCHR || (vtype)sol::VLNK != VLNK || 80 (vtype)sol::VFIFO != VFIFO || (vtype)sol::VDOOR != VDOOR || 81 (vtype)sol::VPRC != VPROC || (vtype)sol::VSOCK != VSOCK || 82 (vtype)sol::VBAD != VBAD) { 83 os::panic("check_sol_vtype"); 84 } 85 #endif 86 } 87 88 static void 89 check_fobj_attr() 90 { 91 // 92 // fobj_impl::get_attributes and fobj_impl::set_attributes depend 93 // on the layout of the type sol::vattr_t being equal to the 94 // layout of vattr_t. 95 // 96 if (sizeof (sol::vattr_t) != sizeof (vattr_t)) { 97 os::panic("check_sol_vattr_t"); 98 } 99 // 100 // XXX - perhaps we should check the offset of each field 101 // 102 103 // 104 // fobj_ii::get_secattributes() and fobj_ii::set_secattributes() 105 // depend on the layout of sol::aclent_t being the same as 106 // struct aclent. 107 // 108 if (sizeof (sol::aclent_t) != sizeof (struct acl)) { 109 os::panic("check_sol_aclent_t"); 110 } 111 } 112 113 static void 114 check_statvfs() 115 { 116 if (sizeof (sol::statvfs64_t) != sizeof (statvfs64_t)) { 117 os::panic("check_statvfs"); 118 } 119 // 120 // XXX - perhaps we should check the offset of each field 121 // 122 } 123 124 #endif /* DEBUG */ 125