10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*3446Smrj * Common Development and Distribution License (the "License"). 6*3446Smrj * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*3446Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 26*3446Smrj #ifndef _LIST_H 27*3446Smrj #define _LIST_H 28*3446Smrj 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 31*3446Smrj #ifdef __cplusplus 32*3446Smrj extern "C" { 33*3446Smrj #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* 360Sstevel@tonic-gate * Constants 370Sstevel@tonic-gate */ 380Sstevel@tonic-gate #define MAXNAME 256 390Sstevel@tonic-gate #define TYPESIZE 32 400Sstevel@tonic-gate 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* 430Sstevel@tonic-gate * find_elem flags 440Sstevel@tonic-gate */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate #define FOLLOW_LINK 1 470Sstevel@tonic-gate #define NO_FOLLOW_LINK 0 480Sstevel@tonic-gate 490Sstevel@tonic-gate /* 500Sstevel@tonic-gate * elem_list types 510Sstevel@tonic-gate */ 520Sstevel@tonic-gate #define PROTOLIST_LIST 1 530Sstevel@tonic-gate #define PROTODIR_LIST 2 540Sstevel@tonic-gate #define EXCEPTION_LIST 3 550Sstevel@tonic-gate 560Sstevel@tonic-gate 570Sstevel@tonic-gate /* 580Sstevel@tonic-gate * file types 590Sstevel@tonic-gate */ 600Sstevel@tonic-gate 610Sstevel@tonic-gate #define CHAR_DEV_T 'c' 620Sstevel@tonic-gate #define BLOCK_DEV_T 'b' 630Sstevel@tonic-gate #define DIR_T 'd' 640Sstevel@tonic-gate #define FILE_T 'f' 650Sstevel@tonic-gate #define EDIT_T 'e' 660Sstevel@tonic-gate #define VOLATILE_T 'v' 670Sstevel@tonic-gate #define SYM_LINK_T 's' 680Sstevel@tonic-gate #define LINK_T 'l' 690Sstevel@tonic-gate 700Sstevel@tonic-gate /* 710Sstevel@tonic-gate * Arch Values 720Sstevel@tonic-gate */ 730Sstevel@tonic-gate 740Sstevel@tonic-gate /* sparc */ 750Sstevel@tonic-gate #define P_SPARC 1 760Sstevel@tonic-gate #define P_SUN4 2 770Sstevel@tonic-gate #define P_SUN4c 3 780Sstevel@tonic-gate #define P_SUN4d 4 790Sstevel@tonic-gate #define P_SUN4e 5 800Sstevel@tonic-gate #define P_SUN4m 6 810Sstevel@tonic-gate #define P_SUN4u 7 820Sstevel@tonic-gate #define P_SUN4v 8 830Sstevel@tonic-gate 840Sstevel@tonic-gate /* x86 values */ 850Sstevel@tonic-gate #define P_I386 101 860Sstevel@tonic-gate #define P_I86PC 102 870Sstevel@tonic-gate 880Sstevel@tonic-gate /* ppc values */ 890Sstevel@tonic-gate #define P_PPC 201 900Sstevel@tonic-gate #define P_PREP 202 910Sstevel@tonic-gate 920Sstevel@tonic-gate #if defined(sparc) 930Sstevel@tonic-gate #define P_ISA P_SPARC 940Sstevel@tonic-gate #elif defined(i386) 950Sstevel@tonic-gate #define P_ISA P_I386 960Sstevel@tonic-gate #elif defined(__ppc) 970Sstevel@tonic-gate #define P_ISA P_PPC 980Sstevel@tonic-gate #else 990Sstevel@tonic-gate #error "Unknown instruction set" 1000Sstevel@tonic-gate #endif 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate #define P_ALL P_ISA 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate /* 1050Sstevel@tonic-gate * typedefs 1060Sstevel@tonic-gate */ 1070Sstevel@tonic-gate typedef struct pkg_list { 1080Sstevel@tonic-gate char pkg_name[MAXNAME]; 1090Sstevel@tonic-gate struct pkg_list *next; 1100Sstevel@tonic-gate } pkg_list; 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate typedef struct elem { 1130Sstevel@tonic-gate int inode; 1140Sstevel@tonic-gate short perm; 1150Sstevel@tonic-gate int ref_cnt; 1160Sstevel@tonic-gate short flag; 1170Sstevel@tonic-gate short major; 1180Sstevel@tonic-gate short minor; 1190Sstevel@tonic-gate short arch; 1200Sstevel@tonic-gate struct elem *next; 1210Sstevel@tonic-gate struct elem *link_parent; 1220Sstevel@tonic-gate struct elem *link_sib; 1230Sstevel@tonic-gate pkg_list *pkgs; 1240Sstevel@tonic-gate char *symsrc; 1250Sstevel@tonic-gate char name[MAXNAME]; 1260Sstevel@tonic-gate char owner[TYPESIZE]; 1270Sstevel@tonic-gate char group[TYPESIZE]; 1280Sstevel@tonic-gate char file_type; 1290Sstevel@tonic-gate } elem; 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate 1320Sstevel@tonic-gate typedef struct { 1330Sstevel@tonic-gate int num_of_buckets; 1340Sstevel@tonic-gate elem **list; 1350Sstevel@tonic-gate short type; 1360Sstevel@tonic-gate } elem_list; 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate #define HASH_SIZE 4093 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate /* 1410Sstevel@tonic-gate * Funcs 1420Sstevel@tonic-gate */ 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate extern void add_elem(elem_list*, elem *); 1460Sstevel@tonic-gate extern pkg_list *add_pkg(pkg_list *, const char *); 1470Sstevel@tonic-gate extern elem *find_elem(elem_list *, elem *, int); 1480Sstevel@tonic-gate extern elem *find_elem_mach(elem_list *, elem *, int); 1490Sstevel@tonic-gate extern elem *find_elem_isa(elem_list *, elem *, int); 1500Sstevel@tonic-gate extern void init_list(elem_list *, int); 1510Sstevel@tonic-gate extern unsigned int hash(const char *str); 1520Sstevel@tonic-gate extern int processed_package(const char *pkgname); 1530Sstevel@tonic-gate extern void mark_processed(const char *pkgname); 1540Sstevel@tonic-gate #ifdef DEBUG 1550Sstevel@tonic-gate extern void examine_list(elem_list *list); 1560Sstevel@tonic-gate extern void print_list(elem_list *); 1570Sstevel@tonic-gate extern void print_type_list(elem_list *list, char file_type); 1580Sstevel@tonic-gate #endif 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate /* Global statistics */ 1610Sstevel@tonic-gate extern int max_list_depth; 162*3446Smrj 163*3446Smrj #ifdef __cplusplus 164*3446Smrj } 165*3446Smrj #endif 166*3446Smrj 167*3446Smrj #endif /* _LIST_H */ 168