Home | History | Annotate | Download | only in common
      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, Version 1.0 only
      6  * (the "License").  You may not use this file except in compliance
      7  * with the License.
      8  *
      9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10  * or http://www.opensolaris.org/os/licensing.
     11  * See the License for the specific language governing permissions
     12  * and limitations under the License.
     13  *
     14  * When distributing Covered Code, include this CDDL HEADER in each
     15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16  * If applicable, add the following below this CDDL HEADER, with the
     17  * fields enclosed by brackets "[]" replaced with your own identifying
     18  * information: Portions Copyright [yyyy] [name of copyright owner]
     19  *
     20  * CDDL HEADER END
     21  */
     22 /*
     23  *	Copyright (c) 1998 by Sun Microsystems, Inc.
     24  */
     25 #ifndef	_CACHE_DOT_H
     26 #define	_CACHE_DOT_H
     27 
     28 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     29 
     30 /*
     31  * ld.so directory caching
     32  */
     33 #include	<sys/types.h>
     34 
     35 /*
     36  * Shared object lookup performance in the run-time link editor is
     37  * enhanced through the use of caches for directories that the editor
     38  * searches.  A given "cache" describes the contents of a single directory,
     39  * and each cache entry contains the canonical name for a shared object
     40  * as well as its absolute pathname.
     41  *
     42  * Within a cache, "pointers" are really relative addresses to some absolute
     43  * address (often the base address of the containing database).
     44  */
     45 
     46 /*
     47  * Relative pointer macros.
     48  */
     49 #define	RELPTR(base, absptr) ((long)(absptr) - (long)(base))
     50 #define	AP(base) ((caddr_t)base)
     51 
     52 /*
     53  * Definitions for cache structures.
     54  */
     55 #define	DB_HASH		11		/* number of hash buckets in caches */
     56 #define	LD_CACHE_MAGIC 	0x041155	/* cookie to identify data structure */
     57 #define	LD_CACHE_VERSION 0		/* version number of cache structure */
     58 
     59 struct	dbe	{			/* element of a directory cache */
     60 	long	dbe_next;		/* (rp) next element on this list */
     61 	long	dbe_lop;		/* (rp) canonical name for object */
     62 	long	dbe_name;		/* (rp) absolute name */
     63 };
     64 
     65 struct	db	{			/* directory cache database */
     66 	long	db_name;		/* (rp) directory contained here */
     67 	struct	dbe db_hash[DB_HASH];	/* hash buckets */
     68 	caddr_t	db_chain;		/* private to database mapping */
     69 };
     70 
     71 struct dbf 	{			/* cache file image */
     72 	long dbf_magic;			/* identifying cookie */
     73 	long dbf_version;		/* version no. of these dbs */
     74 	long dbf_machtype;		/* machine type */
     75 	long dbf_db;		/* directory cache dbs */
     76 };
     77 
     78 /*
     79  * Structures used to describe and access a database.
     80  */
     81 struct	dbd	{			/* data base descriptor */
     82 	struct	dbd *dbd_next;		/* next one on this list */
     83 	struct	db *dbd_db;		/* data base described by this */
     84 };
     85 
     86 struct	dd	{			/* directory descriptor */
     87 	struct	dd *dd_next;		/* next one on this list */
     88 	struct	db *dd_db;		/* data base described by this */
     89 };
     90 
     91 /*
     92  * Interfaces imported/exported by the lookup code.
     93  */
     94 
     95 char	*ask_db();			/* ask db for highest minor number */
     96 struct	db *lo_cache();			/* obtain cache for directory name */
     97 
     98 #endif
     99