1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate /* 30*0Sstevel@tonic-gate * The intent of this file is to contain any data that must remain 31*0Sstevel@tonic-gate * resident in the kernel. 32*0Sstevel@tonic-gate * 33*0Sstevel@tonic-gate * space_store(), space_fetch(), and space_free() have been added to 34*0Sstevel@tonic-gate * easily store and retrieve kernel resident data. 35*0Sstevel@tonic-gate * These functions are recommended rather than adding new variables to 36*0Sstevel@tonic-gate * this file. 37*0Sstevel@tonic-gate * 38*0Sstevel@tonic-gate * Note that it's possible for name collisions to occur. In order to 39*0Sstevel@tonic-gate * prevent collisions, it's recommended that the convention in 40*0Sstevel@tonic-gate * PSARC/1997/389 be used. If a collision occurs, then space_store will 41*0Sstevel@tonic-gate * fail. 42*0Sstevel@tonic-gate */ 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate #include <sys/types.h> 45*0Sstevel@tonic-gate #include <sys/param.h> 46*0Sstevel@tonic-gate #include <sys/var.h> 47*0Sstevel@tonic-gate #include <sys/proc.h> 48*0Sstevel@tonic-gate #include <sys/signal.h> 49*0Sstevel@tonic-gate #include <sys/utsname.h> 50*0Sstevel@tonic-gate #include <sys/buf.h> 51*0Sstevel@tonic-gate #include <sys/cred.h> 52*0Sstevel@tonic-gate #include <sys/vfs.h> 53*0Sstevel@tonic-gate #include <sys/vnode.h> 54*0Sstevel@tonic-gate #include <sys/sysinfo.h> 55*0Sstevel@tonic-gate #include <sys/t_lock.h> 56*0Sstevel@tonic-gate #include <sys/vmem.h> 57*0Sstevel@tonic-gate #include <sys/modhash.h> 58*0Sstevel@tonic-gate #include <sys/cmn_err.h> 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate #include <sys/strredir.h> 61*0Sstevel@tonic-gate #include <sys/kbio.h> 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate struct buf bfreelist; /* Head of the free list of buffers */ 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate sysinfo_t sysinfo; 66*0Sstevel@tonic-gate vminfo_t vminfo; /* VM stats protected by sysinfolock mutex */ 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate #ifdef lint 69*0Sstevel@tonic-gate int __lintzero; /* Alway zero for shutting up lint */ 70*0Sstevel@tonic-gate #endif 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate /* 73*0Sstevel@tonic-gate * The following describe the physical memory configuration. 74*0Sstevel@tonic-gate * 75*0Sstevel@tonic-gate * physmem - The amount of physical memory configured 76*0Sstevel@tonic-gate * in pages. ptob(physmem) is the amount 77*0Sstevel@tonic-gate * of physical memory in bytes. Defined in 78*0Sstevel@tonic-gate * .../os/startup.c. 79*0Sstevel@tonic-gate * 80*0Sstevel@tonic-gate * physmax - The highest numbered physical page in memory. 81*0Sstevel@tonic-gate * 82*0Sstevel@tonic-gate * maxmem - Maximum available memory, in pages. Defined 83*0Sstevel@tonic-gate * in main.c. 84*0Sstevel@tonic-gate * 85*0Sstevel@tonic-gate * physinstalled 86*0Sstevel@tonic-gate * - Pages of physical memory installed; 87*0Sstevel@tonic-gate * includes use by PROM/boot not counted in 88*0Sstevel@tonic-gate * physmem. 89*0Sstevel@tonic-gate */ 90*0Sstevel@tonic-gate 91*0Sstevel@tonic-gate pfn_t physmax; 92*0Sstevel@tonic-gate pgcnt_t physinstalled; 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate struct var v; 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate #include <sys/systm.h> 97*0Sstevel@tonic-gate #include <sys/conf.h> 98*0Sstevel@tonic-gate #include <sys/kmem.h> 99*0Sstevel@tonic-gate #include <sys/sysmacros.h> 100*0Sstevel@tonic-gate #include <sys/bootconf.h> 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate /* 103*0Sstevel@tonic-gate * Data from swapgeneric.c that must be resident. 104*0Sstevel@tonic-gate */ 105*0Sstevel@tonic-gate struct vnode *rootvp; /* vnode of the root device */ 106*0Sstevel@tonic-gate dev_t rootdev; /* dev_t of the root device */ 107*0Sstevel@tonic-gate int root_is_svm; /* root is a mirrored device flag */ 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate int netboot; 110*0Sstevel@tonic-gate int obpdebug; 111*0Sstevel@tonic-gate char *dhcack; /* Used to cache ascii form of DHCPACK handed up by boot */ 112*0Sstevel@tonic-gate char *netdev_path; /* Used to cache the netdev_path handed up by boot */ 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate /* 115*0Sstevel@tonic-gate * Data from arp.c that must be resident. 116*0Sstevel@tonic-gate */ 117*0Sstevel@tonic-gate #include <sys/socket.h> 118*0Sstevel@tonic-gate #include <sys/errno.h> 119*0Sstevel@tonic-gate #include <sys/sockio.h> 120*0Sstevel@tonic-gate #include <sys/stream.h> 121*0Sstevel@tonic-gate #include <sys/stropts.h> 122*0Sstevel@tonic-gate #include <sys/dlpi.h> 123*0Sstevel@tonic-gate #include <net/if.h> 124*0Sstevel@tonic-gate #include <net/if_arp.h> 125*0Sstevel@tonic-gate #include <netinet/in.h> 126*0Sstevel@tonic-gate #include <netinet/in_var.h> 127*0Sstevel@tonic-gate #include <netinet/if_ether.h> 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate ether_addr_t etherbroadcastaddr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 130*0Sstevel@tonic-gate 131*0Sstevel@tonic-gate /* 132*0Sstevel@tonic-gate * Data from timod that must be resident 133*0Sstevel@tonic-gate */ 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate /* 136*0Sstevel@tonic-gate * state transition table for TI interface 137*0Sstevel@tonic-gate */ 138*0Sstevel@tonic-gate #include <sys/tihdr.h> 139*0Sstevel@tonic-gate 140*0Sstevel@tonic-gate #define nr 127 /* not reachable */ 141*0Sstevel@tonic-gate 142*0Sstevel@tonic-gate char ti_statetbl[TE_NOEVENTS][TS_NOSTATES] = { 143*0Sstevel@tonic-gate /* STATES */ 144*0Sstevel@tonic-gate /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ 145*0Sstevel@tonic-gate 146*0Sstevel@tonic-gate { 1, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 147*0Sstevel@tonic-gate {nr, nr, nr, 2, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 148*0Sstevel@tonic-gate {nr, nr, nr, 4, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 149*0Sstevel@tonic-gate {nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 150*0Sstevel@tonic-gate {nr, nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 151*0Sstevel@tonic-gate {nr, 0, 3, nr, 3, 3, nr, nr, 7, nr, nr, nr, 6, 7, 9, 10, 11}, 152*0Sstevel@tonic-gate {nr, nr, 0, nr, nr, 6, nr, nr, nr, nr, nr, nr, 3, nr, 3, 3, 3}, 153*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, 9, nr, nr, nr, nr, 3, nr, nr, nr}, 154*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, 3, nr, nr, nr, nr, 3, nr, nr, nr}, 155*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, 7, nr, nr, nr, nr, 7, nr, nr, nr}, 156*0Sstevel@tonic-gate {nr, nr, nr, 5, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 157*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, 8, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 158*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, 12, 13, nr, 14, 15, 16, nr, nr, nr, nr, nr}, 159*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, nr, 11, nr, nr, nr, nr, nr}, 160*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, nr, 11, nr, nr, nr, nr, nr}, 161*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 10, nr, 3, nr, nr, nr, nr, nr}, 162*0Sstevel@tonic-gate {nr, nr, nr, 7, nr, nr, nr, 7, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 163*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, 9, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 164*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, 10, nr, nr, nr, nr, nr, nr}, 165*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 9, 10, nr, nr, nr, nr, nr, nr}, 166*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, nr, nr, 11, 3, nr, nr, nr, nr, nr, nr}, 167*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, 3, nr, nr, 3, 3, 3, nr, nr, nr, nr, nr}, 168*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 169*0Sstevel@tonic-gate {nr, nr, nr, nr, nr, nr, nr, 7, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 170*0Sstevel@tonic-gate {nr, nr, nr, 9, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 171*0Sstevel@tonic-gate {nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 172*0Sstevel@tonic-gate {nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 173*0Sstevel@tonic-gate {nr, nr, nr, 3, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr, nr}, 174*0Sstevel@tonic-gate }; 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate 177*0Sstevel@tonic-gate #include <sys/sad.h> 178*0Sstevel@tonic-gate #include <sys/tty.h> 179*0Sstevel@tonic-gate #include <sys/ptyvar.h> 180*0Sstevel@tonic-gate 181*0Sstevel@tonic-gate static void store_fetch_initspace(); 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gate /* 184*0Sstevel@tonic-gate * Allocate tunable structures at runtime. 185*0Sstevel@tonic-gate */ 186*0Sstevel@tonic-gate void 187*0Sstevel@tonic-gate space_init(void) 188*0Sstevel@tonic-gate { 189*0Sstevel@tonic-gate sad_initspace(); 190*0Sstevel@tonic-gate pty_initspace(); 191*0Sstevel@tonic-gate store_fetch_initspace(); 192*0Sstevel@tonic-gate } 193*0Sstevel@tonic-gate 194*0Sstevel@tonic-gate int ts_dispatch_extended = -1; /* set in ts_getdptbl or set_platform_default */ 195*0Sstevel@tonic-gate 196*0Sstevel@tonic-gate /* 197*0Sstevel@tonic-gate * Previously defined in consmsconf.c ... 198*0Sstevel@tonic-gate */ 199*0Sstevel@tonic-gate dev_t kbddev = NODEV; 200*0Sstevel@tonic-gate dev_t mousedev = NODEV; 201*0Sstevel@tonic-gate dev_t stdindev = NODEV; 202*0Sstevel@tonic-gate struct vnode *wsconsvp; 203*0Sstevel@tonic-gate 204*0Sstevel@tonic-gate dev_t fbdev = NODEV; 205*0Sstevel@tonic-gate struct vnode *fbvp; 206*0Sstevel@tonic-gate dev_info_t *fbdip; 207*0Sstevel@tonic-gate 208*0Sstevel@tonic-gate /* 209*0Sstevel@tonic-gate * moved from cons.c because they must be resident in the kernel. 210*0Sstevel@tonic-gate */ 211*0Sstevel@tonic-gate vnode_t *rconsvp; 212*0Sstevel@tonic-gate dev_t rconsdev; 213*0Sstevel@tonic-gate dev_t uconsdev = NODEV; 214*0Sstevel@tonic-gate 215*0Sstevel@tonic-gate /* 216*0Sstevel@tonic-gate * This flag, when set marks rconsvp in a transition state. 217*0Sstevel@tonic-gate */ 218*0Sstevel@tonic-gate 219*0Sstevel@tonic-gate int cn_conf; 220*0Sstevel@tonic-gate 221*0Sstevel@tonic-gate /* 222*0Sstevel@tonic-gate * Moved from sad_conf.c because of the usual in loadable modules 223*0Sstevel@tonic-gate */ 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gate #ifndef NSTRPHASH 226*0Sstevel@tonic-gate #define NSTRPHASH 128 227*0Sstevel@tonic-gate #endif 228*0Sstevel@tonic-gate struct autopush **strpcache; 229*0Sstevel@tonic-gate int strpmask = NSTRPHASH - 1; 230*0Sstevel@tonic-gate 231*0Sstevel@tonic-gate /* 232*0Sstevel@tonic-gate * Moved here from wscons.c 233*0Sstevel@tonic-gate * Package the redirection-related routines into an ops vector of the form 234*0Sstevel@tonic-gate * that the redirecting driver expects. 235*0Sstevel@tonic-gate */ 236*0Sstevel@tonic-gate extern int wcvnget(); 237*0Sstevel@tonic-gate extern void wcvnrele(); 238*0Sstevel@tonic-gate srvnops_t wscons_srvnops = { 239*0Sstevel@tonic-gate wcvnget, 240*0Sstevel@tonic-gate wcvnrele 241*0Sstevel@tonic-gate }; 242*0Sstevel@tonic-gate 243*0Sstevel@tonic-gate /* 244*0Sstevel@tonic-gate * consconfig() in autoconf.c sets this; it's the vnode of the distinguished 245*0Sstevel@tonic-gate * keyboard/frame buffer combination, aka the workstation console. 246*0Sstevel@tonic-gate */ 247*0Sstevel@tonic-gate 248*0Sstevel@tonic-gate vnode_t *rwsconsvp; 249*0Sstevel@tonic-gate dev_t rwsconsdev; 250*0Sstevel@tonic-gate 251*0Sstevel@tonic-gate /* 252*0Sstevel@tonic-gate * Platform console abort policy. 253*0Sstevel@tonic-gate * Platforms may override the default software policy, if such hardware 254*0Sstevel@tonic-gate * (e.g. keyswitches with a secure position) exists. 255*0Sstevel@tonic-gate */ 256*0Sstevel@tonic-gate int abort_enable = KIOCABORTENABLE; 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gate /* from iwscons.c */ 259*0Sstevel@tonic-gate 260*0Sstevel@tonic-gate kthread_id_t iwscn_thread; /* thread that is allowed to push redirm */ 261*0Sstevel@tonic-gate wcm_data_t *iwscn_wcm_data; /* allocated data for redirm */ 262*0Sstevel@tonic-gate 263*0Sstevel@tonic-gate /* from cpc.c */ 264*0Sstevel@tonic-gate uint_t kcpc_key; /* TSD key for CPU performance counter context */ 265*0Sstevel@tonic-gate 266*0Sstevel@tonic-gate /* 267*0Sstevel@tonic-gate * storing and retrieving data by string key 268*0Sstevel@tonic-gate * 269*0Sstevel@tonic-gate * this mechanism allows a consumer to store and retrieve by name a pointer 270*0Sstevel@tonic-gate * to some space maintained by the consumer. 271*0Sstevel@tonic-gate * For example, a driver or module may want to have persistent data 272*0Sstevel@tonic-gate * over unloading/loading cycles. The pointer is typically to some 273*0Sstevel@tonic-gate * kmem_alloced space and it should not be pointing to data that will 274*0Sstevel@tonic-gate * be destroyed when the module is unloaded. 275*0Sstevel@tonic-gate */ 276*0Sstevel@tonic-gate static mod_hash_t *space_hash; 277*0Sstevel@tonic-gate static char *space_hash_name = "space_hash"; 278*0Sstevel@tonic-gate static size_t space_hash_nchains = 8; 279*0Sstevel@tonic-gate 280*0Sstevel@tonic-gate static void 281*0Sstevel@tonic-gate store_fetch_initspace() 282*0Sstevel@tonic-gate { 283*0Sstevel@tonic-gate space_hash = mod_hash_create_strhash(space_hash_name, 284*0Sstevel@tonic-gate space_hash_nchains, mod_hash_null_valdtor); 285*0Sstevel@tonic-gate ASSERT(space_hash); 286*0Sstevel@tonic-gate } 287*0Sstevel@tonic-gate 288*0Sstevel@tonic-gate int 289*0Sstevel@tonic-gate space_store(char *key, uintptr_t ptr) 290*0Sstevel@tonic-gate { 291*0Sstevel@tonic-gate char *s; 292*0Sstevel@tonic-gate int rval; 293*0Sstevel@tonic-gate size_t l; 294*0Sstevel@tonic-gate 295*0Sstevel@tonic-gate /* some sanity checks first */ 296*0Sstevel@tonic-gate if (key == NULL) { 297*0Sstevel@tonic-gate return (-1); 298*0Sstevel@tonic-gate } 299*0Sstevel@tonic-gate l = (size_t)strlen(key); 300*0Sstevel@tonic-gate if (l == 0) { 301*0Sstevel@tonic-gate return (-1); 302*0Sstevel@tonic-gate } 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gate /* increment for null terminator */ 305*0Sstevel@tonic-gate l++; 306*0Sstevel@tonic-gate 307*0Sstevel@tonic-gate /* alloc space for the string, mod_hash_insert will deallocate */ 308*0Sstevel@tonic-gate s = kmem_alloc(l, KM_SLEEP); 309*0Sstevel@tonic-gate bcopy(key, s, l); 310*0Sstevel@tonic-gate 311*0Sstevel@tonic-gate rval = mod_hash_insert(space_hash, 312*0Sstevel@tonic-gate (mod_hash_key_t)s, (mod_hash_val_t)ptr); 313*0Sstevel@tonic-gate 314*0Sstevel@tonic-gate switch (rval) { 315*0Sstevel@tonic-gate case 0: 316*0Sstevel@tonic-gate break; 317*0Sstevel@tonic-gate #ifdef DEBUG 318*0Sstevel@tonic-gate case MH_ERR_DUPLICATE: 319*0Sstevel@tonic-gate cmn_err(CE_WARN, "space_store: duplicate key %s", key); 320*0Sstevel@tonic-gate rval = -1; 321*0Sstevel@tonic-gate break; 322*0Sstevel@tonic-gate case MH_ERR_NOMEM: 323*0Sstevel@tonic-gate cmn_err(CE_WARN, "space_store: no mem for key %s", key); 324*0Sstevel@tonic-gate rval = -1; 325*0Sstevel@tonic-gate break; 326*0Sstevel@tonic-gate default: 327*0Sstevel@tonic-gate cmn_err(CE_WARN, "space_store: unspecified error for key %s", 328*0Sstevel@tonic-gate key); 329*0Sstevel@tonic-gate rval = -1; 330*0Sstevel@tonic-gate break; 331*0Sstevel@tonic-gate #else 332*0Sstevel@tonic-gate default: 333*0Sstevel@tonic-gate rval = -1; 334*0Sstevel@tonic-gate break; 335*0Sstevel@tonic-gate #endif 336*0Sstevel@tonic-gate } 337*0Sstevel@tonic-gate 338*0Sstevel@tonic-gate return (rval); 339*0Sstevel@tonic-gate } 340*0Sstevel@tonic-gate 341*0Sstevel@tonic-gate uintptr_t 342*0Sstevel@tonic-gate space_fetch(char *key) 343*0Sstevel@tonic-gate { 344*0Sstevel@tonic-gate uintptr_t ptr = 0; 345*0Sstevel@tonic-gate mod_hash_val_t val; 346*0Sstevel@tonic-gate int rval; 347*0Sstevel@tonic-gate 348*0Sstevel@tonic-gate if (key) { 349*0Sstevel@tonic-gate rval = mod_hash_find(space_hash, (mod_hash_key_t)key, &val); 350*0Sstevel@tonic-gate if (rval == 0) { 351*0Sstevel@tonic-gate ptr = (uintptr_t)val; 352*0Sstevel@tonic-gate } 353*0Sstevel@tonic-gate } 354*0Sstevel@tonic-gate 355*0Sstevel@tonic-gate return (ptr); 356*0Sstevel@tonic-gate } 357*0Sstevel@tonic-gate 358*0Sstevel@tonic-gate void 359*0Sstevel@tonic-gate space_free(char *key) 360*0Sstevel@tonic-gate { 361*0Sstevel@tonic-gate if (key) { 362*0Sstevel@tonic-gate (void) mod_hash_destroy(space_hash, (mod_hash_key_t)key); 363*0Sstevel@tonic-gate } 364*0Sstevel@tonic-gate } 365*0Sstevel@tonic-gate 366*0Sstevel@tonic-gate /* 367*0Sstevel@tonic-gate * Support for CRC32. At present all calculations are done in simple 368*0Sstevel@tonic-gate * macros, so all we need is somewhere to declare the global lookup table. 369*0Sstevel@tonic-gate */ 370*0Sstevel@tonic-gate 371*0Sstevel@tonic-gate #include <sys/crc32.h> 372*0Sstevel@tonic-gate 373*0Sstevel@tonic-gate const uint32_t crc32_table[256] = { CRC32_TABLE }; 374