EFRegion INTERNAL_readRegionAddrNonExcl(long region_addr)
{
lock (region_cache) {
if (region_cache.ContainsKey(region_addr)) {
EFRegion region = region_cache[region_addr].Target;
if (region != null) {
return region;
}
}
System.Console.WriteLine(RangemapManager.altdebug_pad + "zz uncached region");
String filepath = makeFilepath(region_addr);
if (File.Exists(filepath)) {
// open non-exclusive
// TODO: FIX THIS HACK, where we figure out the length by opening the file.. it should be passed
// in when the region is opened...
FileStream reader = File.Open(filepath, FileMode.Open, FileAccess.Read, FileShare.Read);
long length = reader.Length;
reader.Close();
reader.Dispose();
EFRegion newregion = new EFRegion(region_addr, length, filepath, EFRegionMode.READ_ONLY_SHARED);
region_cache[region_addr] = new WeakReference<EFRegion>(newregion);
return newregion;
} else {
throw new RegionMissingException("no such region address: " + region_addr);
}
}
}