def createBlockDPMap(): global MapTtoNT global MapTtoT global blockAllocatedContents setBlockDPMap(MapTtoNT) setBlockDPMap(MapTtoT) markLeafBlocks(MapTtoNT) # required to set all leaf Blocks with 'U' blockAllocatedContents = getAllocatedBytes('/tmp/testfs.py') # for block,contents in blockAllocatedContents.items(): # print block, contents markUnallocatedBytes()
def createBlockDPMap(): global MapTtoNT global MapTtoT global blockAllocatedContents discardMap = defaultdict(list) setBlockDPMap(MapTtoNT) setBlockDPMap(MapTtoT) markLeafBlocks(MapTtoNT) # required to set all leaf Blocks with 'U' (blockAllocatedContents,discardMap) = getAllocatedBytes(traceFile) # for block,contents in blockAllocatedContents.items(): # print block, contents markUnallocatedBytes()
def createBlockDPMap(): global MapTtoNT global MapTtoT global blockAllocatedContents discardMap = defaultdict(list) setBlockDPMap(MapTtoNT) setBlockDPMap(MapTtoT) markLeafBlocks(MapTtoNT) # required to set all leaf Blocks with 'U' (blockAllocatedContents, discardMap) = getAllocatedBytes(traceFile) # for block,contents in blockAllocatedContents.items(): # print block, contents markUnallocatedBytes()
if __name__ == "__main__": """ Main Start """ if os.path.isfile(traceFile) is 0: print "Did not find /tmp/testfs.py. did you run ./init.sh? " exit nonTypedBlocks = [] typedBlocks = [] taintBlockMap = {} #print "processing getAllocatedBytes" (blockContents, blockIntervalSet, blockAllocationCountSet) = getAllocatedBytes(traceFile) #blockIntervalSet = removeDuplicates(blockIntervalSet) print "processing get Type Info" (typedBlocks, nonTypedBlocks, taintBlockMap) = getTypeInfo() print "get Maps" (MapTtoT, MapTtoNT) = generatePointerMaps(typedBlocks, nonTypedBlocks) print "get Field Annotations" MapAll = dict(MapTtoT.items() + MapTtoNT.items()) fieldAnnotations = getFieldAnnotation(MapAll, taintBlockMap) #fieldAnnotations = removeDuplicates(fieldAnnotations) printFSStructSizes(blockIntervalSet, blockAllocationCountSet, nonTypedBlocks, typedBlocks, MapAll)
dupMap[key] = set(dupMap[key]) return dupMap if __name__ == "__main__": """ Main Start """ if os.path.isfile(traceFile) is 0: print "Did not find /tmp/testfs.py. did you run ./init.sh? " exit nonTypedBlocks = [] typedBlocks = [] taintBlockMap = {} #print "processing getAllocatedBytes" (blockContents, blockIntervalSet, blockAllocationCountSet) = getAllocatedBytes(traceFile) #blockIntervalSet = removeDuplicates(blockIntervalSet) print "processing get Type Info" (typedBlocks,nonTypedBlocks,taintBlockMap) = getTypeInfo() print "get Maps" (MapTtoT, MapTtoNT) = generatePointerMaps(typedBlocks,nonTypedBlocks) print "get Field Annotations" MapAll = dict(MapTtoT.items() + MapTtoNT.items()) fieldAnnotations = getFieldAnnotation(MapAll, taintBlockMap) #fieldAnnotations = removeDuplicates(fieldAnnotations) printFSStructSizes(blockIntervalSet, blockAllocationCountSet ,nonTypedBlocks,typedBlocks, MapAll) createFSStructs(blockIntervalSet, blockAllocationCountSet, nonTypedBlocks, typedBlocks, MapAll)