vasi / squashfuse

FUSE filesystem to mount squashfs archives
Other
291 stars 66 forks source link

Document SQUASHFS_LREG_TYPE, SQUASHFS_LDIR_TYPE #19

Closed probonopd closed 7 years ago

probonopd commented 7 years ago

I have written code that extracts squashfs. When trying to extract some (rare) files, I get:

TODO: Implement inode.base.inode_type 9
TODO: Implement inode.base.inode_type 8

According to squashfs_fs.h,

#define SQUASHFS_LDIR_TYPE      8
#define SQUASHFS_LREG_TYPE      9

Whatever that means.

What are ldir, lreg? Something to do with sparse and xattr?

vasi commented 7 years ago

Thanks for using squashfuse. The different inode types are pretty internal, which is why they're undocumented.

The different L types are just longer forms. They're used when there's extra data that's uncommon, so it's not worth storing in the usual case. Eg: xattrs, or files with lengths over 32 bits, etc.

probonopd commented 7 years ago

Thanks @vasi

The question is what would I have to change in my code to get rid of the placeholders so that instead of printing out

TODO: Implement inode.base.inode_type 9
TODO: Implement inode.base.inode_type 8

it would actually work?

vasi commented 7 years ago

Probably just change your if statements to include the extra types:

} else if(inode.base.inode_type == SQUASHFS_REG_TYPE || inode.base.node_type == SQUASHFS_LREG_TYPE){

You might want to use a switch/case statement instead of an if, to make it easier to read.

probonopd commented 7 years ago

Thanks, it is working now.