17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*ae115bc7Smrj * Common Development and Distribution License (the "License"). 6*ae115bc7Smrj * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*ae115bc7Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 26*ae115bc7Smrj #ifndef _LIST_H 27*ae115bc7Smrj #define _LIST_H 287c478bd9Sstevel@tonic-gate 29*ae115bc7Smrj #ifdef __cplusplus 30*ae115bc7Smrj extern "C" { 31*ae115bc7Smrj #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Constants 357c478bd9Sstevel@tonic-gate */ 367c478bd9Sstevel@tonic-gate #define MAXNAME 256 377c478bd9Sstevel@tonic-gate #define TYPESIZE 32 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * find_elem flags 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #define FOLLOW_LINK 1 457c478bd9Sstevel@tonic-gate #define NO_FOLLOW_LINK 0 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * elem_list types 497c478bd9Sstevel@tonic-gate */ 507c478bd9Sstevel@tonic-gate #define PROTOLIST_LIST 1 517c478bd9Sstevel@tonic-gate #define PROTODIR_LIST 2 527c478bd9Sstevel@tonic-gate #define EXCEPTION_LIST 3 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * file types 577c478bd9Sstevel@tonic-gate */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate #define CHAR_DEV_T 'c' 607c478bd9Sstevel@tonic-gate #define BLOCK_DEV_T 'b' 617c478bd9Sstevel@tonic-gate #define DIR_T 'd' 627c478bd9Sstevel@tonic-gate #define FILE_T 'f' 637c478bd9Sstevel@tonic-gate #define EDIT_T 'e' 647c478bd9Sstevel@tonic-gate #define VOLATILE_T 'v' 657c478bd9Sstevel@tonic-gate #define SYM_LINK_T 's' 667c478bd9Sstevel@tonic-gate #define LINK_T 'l' 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * Arch Values 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate /* sparc */ 737c478bd9Sstevel@tonic-gate #define P_SPARC 1 747c478bd9Sstevel@tonic-gate #define P_SUN4 2 757c478bd9Sstevel@tonic-gate #define P_SUN4c 3 767c478bd9Sstevel@tonic-gate #define P_SUN4d 4 777c478bd9Sstevel@tonic-gate #define P_SUN4e 5 787c478bd9Sstevel@tonic-gate #define P_SUN4m 6 797c478bd9Sstevel@tonic-gate #define P_SUN4u 7 807c478bd9Sstevel@tonic-gate #define P_SUN4v 8 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /* x86 values */ 837c478bd9Sstevel@tonic-gate #define P_I386 101 847c478bd9Sstevel@tonic-gate #define P_I86PC 102 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate /* ppc values */ 877c478bd9Sstevel@tonic-gate #define P_PPC 201 887c478bd9Sstevel@tonic-gate #define P_PREP 202 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #if defined(sparc) 917c478bd9Sstevel@tonic-gate #define P_ISA P_SPARC 927c478bd9Sstevel@tonic-gate #elif defined(i386) 937c478bd9Sstevel@tonic-gate #define P_ISA P_I386 947c478bd9Sstevel@tonic-gate #elif defined(__ppc) 957c478bd9Sstevel@tonic-gate #define P_ISA P_PPC 967c478bd9Sstevel@tonic-gate #else 977c478bd9Sstevel@tonic-gate #error "Unknown instruction set" 987c478bd9Sstevel@tonic-gate #endif 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #define P_ALL P_ISA 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate /* 1037c478bd9Sstevel@tonic-gate * typedefs 1047c478bd9Sstevel@tonic-gate */ 1057c478bd9Sstevel@tonic-gate typedef struct pkg_list { 1067c478bd9Sstevel@tonic-gate char pkg_name[MAXNAME]; 1077c478bd9Sstevel@tonic-gate struct pkg_list *next; 1087c478bd9Sstevel@tonic-gate } pkg_list; 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate typedef struct elem { 1117c478bd9Sstevel@tonic-gate int inode; 1127c478bd9Sstevel@tonic-gate short perm; 1137c478bd9Sstevel@tonic-gate int ref_cnt; 1147c478bd9Sstevel@tonic-gate short flag; 1157c478bd9Sstevel@tonic-gate short major; 1167c478bd9Sstevel@tonic-gate short minor; 1177c478bd9Sstevel@tonic-gate short arch; 1187c478bd9Sstevel@tonic-gate struct elem *next; 1197c478bd9Sstevel@tonic-gate struct elem *link_parent; 1207c478bd9Sstevel@tonic-gate struct elem *link_sib; 1217c478bd9Sstevel@tonic-gate pkg_list *pkgs; 1227c478bd9Sstevel@tonic-gate char *symsrc; 1237c478bd9Sstevel@tonic-gate char name[MAXNAME]; 1247c478bd9Sstevel@tonic-gate char owner[TYPESIZE]; 1257c478bd9Sstevel@tonic-gate char group[TYPESIZE]; 1267c478bd9Sstevel@tonic-gate char file_type; 1277c478bd9Sstevel@tonic-gate } elem; 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate typedef struct { 1317c478bd9Sstevel@tonic-gate int num_of_buckets; 1327c478bd9Sstevel@tonic-gate elem **list; 1337c478bd9Sstevel@tonic-gate short type; 1347c478bd9Sstevel@tonic-gate } elem_list; 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate #define HASH_SIZE 4093 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate /* 1397c478bd9Sstevel@tonic-gate * Funcs 1407c478bd9Sstevel@tonic-gate */ 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate extern void add_elem(elem_list*, elem *); 1447c478bd9Sstevel@tonic-gate extern pkg_list *add_pkg(pkg_list *, const char *); 1457c478bd9Sstevel@tonic-gate extern elem *find_elem(elem_list *, elem *, int); 1467c478bd9Sstevel@tonic-gate extern elem *find_elem_mach(elem_list *, elem *, int); 1477c478bd9Sstevel@tonic-gate extern elem *find_elem_isa(elem_list *, elem *, int); 1487c478bd9Sstevel@tonic-gate extern void init_list(elem_list *, int); 1497c478bd9Sstevel@tonic-gate extern unsigned int hash(const char *str); 1507c478bd9Sstevel@tonic-gate extern int processed_package(const char *pkgname); 1517c478bd9Sstevel@tonic-gate extern void mark_processed(const char *pkgname); 1527c478bd9Sstevel@tonic-gate #ifdef DEBUG 1537c478bd9Sstevel@tonic-gate extern void examine_list(elem_list *list); 1547c478bd9Sstevel@tonic-gate extern void print_list(elem_list *); 1557c478bd9Sstevel@tonic-gate extern void print_type_list(elem_list *list, char file_type); 1567c478bd9Sstevel@tonic-gate #endif 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate /* Global statistics */ 1597c478bd9Sstevel@tonic-gate extern int max_list_depth; 160*ae115bc7Smrj 161*ae115bc7Smrj #ifdef __cplusplus 162*ae115bc7Smrj } 163*ae115bc7Smrj #endif 164*ae115bc7Smrj 165*ae115bc7Smrj #endif /* _LIST_H */ 166