Exemple #1
0
 def readdir(self, fh, off):
     assert self._initialized
     dir_inode = self.forest.inodes.get_by_value(fh)
     pln = None
     for i, ln in enumerate(dir_inode.node.get_leaves(), 1):
         # Additions may screw up the tree bit
         if (pln is not None and pln.key > ln.key) or not ln.name:
             pass
         else:
             pln = ln
             if i > off:
                 a = self._leaf_attributes(ln)
                 t = (ln.name, a, i)
                 # If we already have inode for this, we can use it.
                 # If not, we synthesize one that is highly unique
                 # but not really usable anywhere elsewhere (sigh)
                 inode = self.forest.inodes.getdefault_by_leaf_node(ln)
                 if inode:
                     a.st_ino = inode.value
                 else:
                     sbits = self.forest.inodes.max_value.bit_length() + 1
                     ino_bits = llfuse.get_ino_t_bits()
                     if sbits < ino_bits / 2:
                         sbits = ino_bits // 2
                     a.st_ino = (i << sbits) | dir_inode.value
                 assert a.st_ino  # otherwise not visible in e.g. ls!
                 yield t
Exemple #2
0
 def readdir(self, fh, off):
     assert self._initialized
     dir_inode = self.forest.inodes.get_by_value(fh)
     pln = None
     for i, ln in enumerate(dir_inode.node.get_leaves(), 1):
         # Additions may screw up the tree bit
         if (pln is not None and pln.key > ln.key) or not ln.name:
             pass
         else:
             pln = ln
             if i > off:
                 a = self._leaf_attributes(ln)
                 t = (ln.name, a, i)
                 # If we already have inode for this, we can use it.
                 # If not, we synthesize one that is highly unique
                 # but not really usable anywhere elsewhere (sigh)
                 inode = self.forest.inodes.getdefault_by_leaf_node(ln)
                 if inode:
                     a.st_ino = inode.value
                 else:
                     sbits = self.forest.inodes.max_value.bit_length() + 1
                     ino_bits = llfuse.get_ino_t_bits()
                     if sbits < ino_bits / 2:
                         sbits = ino_bits // 2
                     a.st_ino = (i << sbits) | dir_inode.value
                 assert a.st_ino  # otherwise not visible in e.g. ls!
                 yield t
Exemple #3
0
def test_inquire_bits():
    assert 0 < llfuse.get_ino_t_bits() < 256
    assert 0 < llfuse.get_off_t_bits() < 256
Exemple #4
0
def test_inquire_bits():
    assert 0 < llfuse.get_ino_t_bits() < 256
    assert 0 < llfuse.get_off_t_bits() < 256