aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2019-10-07Cleanup: Move padd_file function to libtarDavid Oberhollenzer
It's only ever used for padding tarballs. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-07Add an implementation for an sqfs_file_t writing to stdoutDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-07Rename libsqfshelper to libcommonDavid Oberhollenzer
That is IMO less confusing and express what it is (i.e. what it has become) more clearly, i.e. common code shared by the utilities. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-07Rename "hihglevel.h" to the more appropriate "common.h"David Oberhollenzer
It only contains helpers for _common_ stuff for all the utilities. The actual high level stuff has been moved to libsquashfs a while ago. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-07Fix spelling of "align"David Oberhollenzer
Before the misspelled version has a chance to become stable API. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-07Improve ABI backward & forward compatibillityDavid Oberhollenzer
- Padd the compressor config union - 128 bytes aught to be enough for everyone, i.e. future compressors. - Insist that the padding space is initialized to 0. If a field gets added to an existing compressor, it can test for 0 as a sentinel value. - Add a size field to the hook structure, aka "the Microsoft way". - The explanation is in the comment. - Don't make the Microsoft mistake of checking for >=, insist on *exact* size match. Future users will need a fallback if their hooks are rejected. But at least they will be rejected instead of silently not being used. - Add an unsupported flag check to the dir tree reader. - Add a basic abi unit test that, for now, checks the size of the compressor config struct fields. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-06Fix missing stdlib.h includeDavid Oberhollenzer
Problem only showed up on a different machine and went unnoticed earlier. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-06Cleanup: move padd_sqfs to helper libraryDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-06Fix resource leaks reported by coverityDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-06Improve error reporting for sqfs2tar, rdsquashfs, sqfsdiffDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-05Set sane defaults for backlog and job countDavid Oberhollenzer
Instead of defaulting to -j 1 and -Q 10 times the job count if no option is provided, let tar2sqfs and gensquashfs use all available CPUs and about roughly half the available RAM, if this information can be gathered. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-05Add more diagnostic messagesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-05Improve error reporting for tar2sqfs and gensquashfsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-05Add a perror like function for libsquashfs error codesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-05Merge all the common code for generating imagesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-03Cleanup: simplify tree_node_to_inodeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-03Remove accidental internal use of stdint typesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-03Add a counter-part to sqfs_inode_get_xattr_indexDavid Oberhollenzer
Combines all the type depenend attribute setting and inode type promotion into a single function. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-03Cleanup: merge common code paths in tree serializationDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-03Move tree_node_to_inode function to fstree serialization codeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-03Store directory index in generic inode structureDavid Oberhollenzer
This commit modifies the dir writer to store the directory index directly in the payload area of the inode it creates. The size of the index in bytes is stored in a seperate field. Storing the index is moved to the write inode function. The read inode function is in turn also modified to read the directory index from disk and actually store it in the inode structure in memory for later use. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-30Add flag field to directory writer begin for future expansionDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-29Cleanup: rename "compress.h" to "compressor.h"David Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-29Fix str_table_t error behaviour, commentsDavid Oberhollenzer
- str_table_t is used by libsquashfs; Don't write to stderr, report an error code instead. - Fix the comments about that and fix the SPDX license identifier while we're at it. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-29Fix inode numbering: always start with 1, use 0 as parent for the rootDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-29Fix inode writer: do not store the file mode, only permissionsDavid Oberhollenzer
SquashFS restores the file mode from the type, so those bits are completely redundant. On a side note: this also reduces entropy, allowing the compressor to *maybe* squeeze a few more bytes out. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-29Cleanup: fstree no longer has any use for the block sizeDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-29Cleanup: fstree_from_file does not need to change working directoryDavid Oberhollenzer
The file_info_t no longer stores the size or other such information, so there is no need to do a stat on the input file. This also means that gensquashfs no longer needs to change the working directory when using the function. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-29Bring back the don't fragment flagDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-29Make the data writer padding hookableDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-29Fix data writer: remember where we stored the paddingDavid Oberhollenzer
If we don't store the padding location in the deduplication list, the block deduplication might try to deduplicate across two files with padding in between, which can't be done. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Cleanup: remove string allocation helper functionDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Replace fstree/sqfshelper xattr code with sqfs_xattr_writer_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Move fstree selinux code to gensquashfsDavid Oberhollenzer
Same rational as for the dir-scanner code: It's actually the only user and it is going to get a lot closer integerated with libsquashfs. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Move fstree_from_dir to gensquashfs codeDavid Oberhollenzer
It's actually the only user and the dir-scanner xattr code is going to get a lot closer integerated with libsquashfs. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Fix xattr writer: don't generate an xattr table if there is noneDavid Oberhollenzer
If there were no key-value pairs recoreded during the lifetime of the xattr writer, take a short cut out of the flush function and set the super block values to indicate that. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Fix xattr writer: handle the case that no attributes where addedDavid Oberhollenzer
If begin/end was called without recording *any* attributes, simply set the resulting index to the 0xFFFFFFFF sentinel. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Fix dir writer size accountingDavid Oberhollenzer
Count the *corrent* entry structure size, i.e. the on-disk one, not the in-memory one. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Fix dir writer: the index size is stored off-by-oneDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Implement flush function that generates all the tablesDavid Oberhollenzer
Mostly straight copy-pasta from the sqfshelper code, except it doesn't use the fstree functions. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Add recoding implementation for the xattr writerDavid Oberhollenzer
This commit implements the part of the API responsible for recoding and deduplicating xattr key-value blocks. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Add header with declarations for the sqfs_xattr_writer_tDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Move declarations for sqfs_xattr_reader_t to a seperate headerDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Fix missing mutex unlick in data writer error pathDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Fix out of bounds check in lzo_compressor_createDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Fix lzma2 VLI filter testingDavid Oberhollenzer
Starting out with 0, makes the loop condition evaluate to false and none of the filters are tested. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Fix memory leak in meta reader read inode functionDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Fix unwanted sign extension in lzma decompressorDavid Oberhollenzer
First extend the uint8_t to size_t, then do the arithmetic, otherwise there is an addtional implicit conversion to int, possibly resulting in unwanted sign extension. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-28Make coverity happyDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-27Add a header for platform compatibillity fluffDavid Oberhollenzer
- We don't have "endian.h" everywhere. On some BSDs its in sys and on some BSDs the macros have different names. - We definitely don't have sysmacros.h on non-Unix-like systems. - Likewise for sys/types.h, sys/stat.h and their contents. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>