def readdir(self, path, offset=0): print "in readdir(%s,0x%x)" % (path, offset) ptr = vfs_dir.lookup(self.fs, self.root, path) if ptr == None: raise IOError, "directory not found" return coll = Collector() vfs_dir.enum(self.fs, ptr, coll, offset) for name, hash in coll.result: x = fuse.Direntry(name) x.ino = hash yield x
self.this_time = 0 self.seen = [] def test_cb(self, name, path, idx): self.last_seen = idx print "enum %s => %s (0x%x)" % (repr(name), repr(path), idx) self.this_time += 1 self.seen.append(name) if self.this_time % 12: return 0 self.this_time = 0 return 1 et = enum_test() while not vfs_dir.enum(fs, "enum", et.test_cb, et.last_seen): print "got partial result, last_seen = 0x%x" % et.last_seen if "." not in et.seen: print ". missing from result list" status = "FAILED" if ".." not in et.seen: print ". missing from result list" status = "FAILED" for i in range(1000): path = "file%d" % i if path not in et.seen: print "%s missing from result list" % path status = "FAILED" if len(et.seen) != 1002: print "wrong size %d for result list" % len(et.seen)