- Timestamp:
- 04/29/08 14:17:48 (17 years ago)
- Location:
- trunk/lib
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Makefile
r98 r108 3 3 ################################################################################ 4 4 5 FILES=regfi.o smb_deps.o void_stack.o range_list.o 5 FILES=regfi.o smb_deps.o void_stack.o range_list.o lru_cache.o 6 6 7 7 all: $(FILES) … … 19 19 $(CC) $(CFLAGS) $(OPTS) $(INC) -c -o $@ range_list.c 20 20 21 lru_cache.o: lru_cache.c 22 $(CC) $(CFLAGS) $(OPTS) $(INC) -c -o $@ lru_cache.c 23 21 24 clean: 22 25 rm -f $(FILES) -
trunk/lib/regfi.c
r107 r108 682 682 683 683 /******************************************************************* 684 *******************************************************************/ 685 static REGF_SK_REC* find_sk_record_by_offset( REGF_FILE *file, uint32 offset ) 686 { 687 REGF_SK_REC *p_sk; 688 689 for ( p_sk=file->sec_desc_list; p_sk; p_sk=p_sk->next ) { 690 if ( p_sk->sk_off == offset ) 691 return p_sk; 692 } 693 694 return NULL; 695 } 696 697 698 /******************************************************************* 699 *******************************************************************/ 684 700 685 static REGF_SK_REC* find_sk_record_by_sec_desc( REGF_FILE *file, SEC_DESC *sd ) 701 686 { … … 707 692 } 708 693 709 /* failure */710 694 711 695 return NULL; 712 696 } 713 697 *******************************************************************/ 714 698 715 699 /******************************************************************* … … 798 782 /* get the security descriptor. First look if we have already parsed it */ 799 783 if((nk->sk_off!=REGF_OFFSET_NONE) 800 && !(nk->sec_desc = find_sk_record_by_offset( file, nk->sk_off ))) 784 && !(nk->sec_desc = (REGF_SK_REC*)lru_cache_find(file->sk_recs, 785 &nk->sk_off, 4))) 801 786 { 802 787 sub_hbin = hbin; … … 826 811 nk->sec_desc->sk_off = nk->sk_off; 827 812 828 /* add to the list of security descriptors (ref_count has been read from the files) */ 829 /* XXX: this kind of caching needs to be re-evaluated */ 830 DLIST_ADD( file->sec_desc_list, nk->sec_desc ); 813 lru_cache_update(file->sk_recs, &nk->sk_off, 4, nk->sec_desc); 831 814 } 832 815 … … 919 902 return NULL; 920 903 } 904 905 /* TODO: come up with a better secret. */ 906 rb->sk_recs = lru_cache_create(127, 0xDEADBEEF, true); 921 907 922 908 rla = true; … … 955 941 free(range_list_get(file->unalloc_cells, i)->data); 956 942 range_list_free(file->unalloc_cells); 943 944 lru_cache_destroy(file->sk_recs); 957 945 958 946 free(file);
Note: See TracChangeset
for help on using the changeset viewer.