def _handle_broken_scan(self, entries, fib_key): log_lock.warning("first ExNext() does not start at Examine()d lock! Broken Code!! lock_key=%08x fib_key=%08x (%s)", self.key, fib_key, self.name) # we shrink the dir list to start after the given key # and simulate a continued scan as AmigaOS' FFS would do it while len(entries) > 0: entry = entries.pop(0) e_path = os.path.join(self.sys_path, entry) e_key = self.keygen(e_path) if e_key == fib_key: break return entries
def _handle_broken_scan(self, entries, fib_key): log_lock.warning( "first ExNext() does not start at Examine()d lock! Broken Code!! lock_key=%08x fib_key=%08x (%s)", self.key, fib_key, self.name) # we shrink the dir list to start after the given key # and simulate a continued scan as AmigaOS' FFS would do it while len(entries) > 0: entry = entries.pop(0) e_path = os.path.join(self.sys_path, entry) e_key = self.keygen(e_path) if e_key == fib_key: break return entries
def _register_lock(self, lock): # look up volume volume_name = self.path_mgr.ami_volume_of_path(lock.ami_path) log_lock.debug("fl_Volume: looking up volume '%s' of %s",volume_name,lock) volume = self.dos_list.get_entry_by_name(volume_name) if volume is None: vol_baddr = 0 log_lock.warning("lock volume? volume=%s lock=%s",volume,lock) else: vol_baddr = volume.mem.addr # allocate lock struct b_addr = lock.alloc(self.alloc, vol_baddr, self.generate_key) self.locks_by_baddr[b_addr] = lock log_lock.info("registered: %s" % lock)
def _check_disk_key(self, fib_mem): # make sure its a dir entry dirEntryType = fib_mem.r_s("fib_DirEntryType") if dirEntryType != 2: log_lock.warning("fib type is not dir on first ExNext()!") # make sure fib_key is mine fib_key = fib_mem.r_s("fib_DiskKey") if fib_key != self.key: log_lock.warning( "first ExNext() does not start at Examine()d lock!" " Broken Code!! lock_key=%08x fib_key=%08x (%s)", self.key, fib_key, self.name, ) return False else: return True
def _register_lock(self, lock): # look up volume volume_name = self.path_mgr.ami_volume_of_path(lock.ami_path) log_lock.debug("fl_Volume: looking up volume '%s' of %s", volume_name, lock) volume = self.dos_list.get_entry_by_name(volume_name) if volume is None: vol_baddr = 0 log_lock.warning("lock volume? volume=%s lock=%s", volume, lock) else: vol_baddr = volume.mem.addr # is key already assigned to sys_path? lock_key = self.sys_path_to_key_map.get(lock.sys_path) if not lock_key: # allocate new slot id lock_key = LockKey(lock.sys_path) slot_id = self.keys.alloc(lock_key) log_lock.debug( "allocate log key slot %s for sys_path '%s'", slot_id, lock.sys_path ) if slot_id is None: log_lock.error("no more lock slots! max=%d", len(self.keys)) return None lock_key.slot_id = slot_id else: slot_id = lock_key.slot_id log_lock.debug( "found log key slot %s for sys_path '%s'", slot_id, lock.sys_path ) # allocate lock struct and use slot_id for key lock.alloc(self.alloc, vol_baddr, slot_id) # register lock in key (with baddr allocated above) lock_key.add_lock(lock) log_lock.info("registered: %s" % lock) return lock