summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-06-20Add unit testsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-20simplify and improve canonicalize_nameDavid Oberhollenzer
- Replace scan and memmove with simple automaton - Convert forward to back slashes, lots of file systems treat them equivalenty, this saves us a few more checks down the road - Remove './' path components. We can saveley remove them in a string processing step instead of throwing an error. Also they actually appear often in tar balls, possibly not under user control. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-19Split generic tar code off to static libraryDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-19Cleanup: split up fstree.cDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-19Cleanup fstree codeDavid Oberhollenzer
Replace default_$FIELD with a struct stat. Merge the rest of add_node/add_file into mknode and add by path+stat. Expose the mknode function and replace all the duplicated node pointer arithmetic magic with a call to mknode. Plus a generic cleanup by utlizing new util functions. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-18Cleanup fstree file parserDavid Oberhollenzer
- use generic struct stat based tree node add function - simplify some of the parsing code Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-17tar2sqfs: rewrite parser to fill struct stat, create tree node from thatDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-17libfstree: add generic function to add node from struct statDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-16sqfs2tar: cleanup tar header generationDavid Oberhollenzer
- use struct stat instead of tree node - compact some of the code Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-15libfstree.a: add function to get struct stat from tree nodeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-15Update READMEDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-15Add man page for tar2sqfsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-15Add utility to turn a POSIX/PAX tar archive into a squashfs imageDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-15Add man page for sqfs2tarDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-15Add utility to turn a squashfs image into a POSIX tar archvieDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-15Move super block version check to sqfs_super_readDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-15Move function to padd a file with 0 bytes to libutilDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-15libfstree.a: allow adding a file with no input sourceDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-13Add Makemodule.am for doc/ subdirectoryDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-13Bump versionv0.2David Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: pull out common code pathDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: rdsquashfs: move command line option processing to options.cDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: get rid of unsqfs_info_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11Move file extraction code to generic data_reader_t in libsquashfs.aDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11Cleanup dependency handlingDavid Oberhollenzer
Always try to gather all compressor libraries available, but only complain about missing a one if it has been *explicitly* selected. If a compressor has been explicityl disabled, we can still turn it off after checking. Also, rework gensquashfs to set the default compressor based on what's available. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: simplify rdsquashfs unpacking: use existing utility functionsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: mkfs: remove redundant header inclusionsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: merge rest of block.c into mkfs.cDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: remove rest of sqfs_info_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11Move write_xattr to libsqfs.aDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11Remove sqfs_info_t from xattr writerDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11Move data writer to libsqfs.aDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11Encapsulate data/fragment processing in data_writer_t data structureDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11Split process_file functionDavid Oberhollenzer
Add a generic one that reads and processes N bytes from an input file descriptor. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11Major cleanup of mkfs block processorDavid Oberhollenzer
This commit tries to make the block and fragment processing code a lot more readable by simplifying it as follows. The following pattern is used repeatedly: - Try to compress a block - Write the compressed if smaller (the original otherwise) to a file - Print errors on the way - Set the magic (1 << 24) flag if we wrote the original - Increment the super block byte counter => Move that to a seperate function called "write_compressed" => Move the code to grow the fragment table is moved to a seperate function. => Clearing the fragment buffer is pointless, so remove that The add_fragment/add_block functions are now trivial => Merge them into process_file => Global block counter no longer needed, so remove that too Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: mark input pointer on write_retry as constDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: remove the linked list of fragment relationsDavid Oberhollenzer
Don't need that, we already know the index when we write add the fragment. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11fix: flush the last, unfinished fragment block as wellDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-11cleanup: remove unused prototypesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10cleanup: move tree deserialization to libsqfs.aDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10Rename table.h to highlevel.hDavid Oberhollenzer
The idea is to move various higher level helper functions there. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10Add generic function to produce a full path from an fstree nodeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10cleanup: move entire fstree serialization to libsqfs.aDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10Make sqfs_write_inodes independend of sqfs_info_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10cleanup: move write_inode to separate fileDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10Generate a flat inode table from the fstree ahead of timeDavid Oberhollenzer
Instead of allocating inode numbers as we go, generate and populat an inode table from the fstree ahead of time. This makes processing nodes a little bit simpler and we will need that table anyway for NFS export support later on. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10cleanup: move directory serialization to separate fileDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10gensquashfs: do pushd/popd when needed instead of chdirDavid Oberhollenzer
This commit replaces the chdir to the input directory with pushd/popd when building the fstree and again when packing files. This simplifies handling of other file paths given on the command line that have to be accessed and are relative to the original working directories. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-10Add pushd/popd utilityDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-06-09Add workaround to make empty directories with xattrs workDavid Oberhollenzer
The problem: SquashFS uses extended inode types for inodes with xattrs, so for directories we need to generate an ldir inode. The ldir inode type includes a directory index which cannot be empty (the counter is off by 1, so 0 means 1 entry) and the entry is expected to contain a file name with the same issue (must be at least 1 byte). This has probably not really been thought through. What the mksquashfs actually does is generating an ldir inode without an index. The kernel does not bother to read the index, since the size of the directory is 0. Its a hack that just so happens to work. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>