def inode_path(inode): """ .. c:function:: char *inode_path(struct inode *inode) Return any path of an inode from the root of its filesystem. """ if hlist_empty(inode.i_dentry): return None return dentry_path( container_of(inode.i_dentry.first, 'struct dentry', 'd_u.d_alias'))
def inode_path(inode: Object) -> Optional[bytes]: """ Return any path of an inode from the root of its filesystem. :param inode: ``struct inode *`` :return: Path, or ``None`` if the inode has no aliases. """ if hlist_empty(inode.i_dentry): return None return dentry_path( container_of(inode.i_dentry.first, "struct dentry", "d_u.d_alias"))
def test_hlist_empty(self): self.assertTrue(hlist_empty(self.empty)) self.assertFalse(hlist_empty(self.full))