summaryrefslogtreecommitdiff
path: root/lib/sqfs/read_super.c
AgeCommit message (Collapse)Author
2020-06-03Cleanup: Add defines for minimum and maximum block sizeDavid Oberhollenzer
This commit adds propper defines in the super block header and removes some of the hard coded constants. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-11-25Cleanup: move overflow safe alloc code into libsquashfsDavid Oberhollenzer
There were only a hand full of instances outside libsquashfs that used the alloc code. In most cases, the thing allocated hat its size derived from something already in memory anyway, so it is safe to assume its size fits into a size_t. At the same time, the opencoded Windows path conversion functions are all unified into a single helper function. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-11-24Fix check of block size in super blockDavid Oberhollenzer
The check needs to include 1M, which is still a valid block size. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-07Cleanup: move libutil related headers to "util" sub directoryDavid 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>
2019-09-09Change license of libsquashfs.soDavid Oberhollenzer
This this commit, the code that is compiled and linked to produce libsquashfs.so (and *only* libsquashfs.so) is released under the terms and conditions of the GNU Lesser General Public license, allowing 3rd party programs to dynamically link against it and still being able to release their programs under a license of their choosing. The libutil library is also relicensed, because it is statically linked into libsquashfs.so. This does not affect the command line programs that remain under the GPLv3. At the current time, the two libraries do not contain any 3rd party contributions and thus do not require anybodys consent other than mine to change the licensing terms (unlike e.g. libfstree.a). The libfstree.a and libsqfshelper.a utility libraries will also remain under the GPLv3 license. Going forward, some parts of libsqfshelper.a will be moved to libsquashfs.so. The parts absorbed by libsquashfs.so will then also have their licensing conditions changed *at that time*. For the public headers, this commit adds the full boiler-plate comment about the license, for the source files and internal headers, only the SPDX identifier is changed. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-08Replace direct file I/O with abstraction layerDavid Oberhollenzer
This should make it easier to use libsquashfs with custom setups that embedd a squashfs image inside something else. Also, it should make it easier to port to non unix-like platforms. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-07Remove printing to stderr in libsquashfs with returning error numbersDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-05Fix API visibility for libsquashfs.soDavid Oberhollenzer
This commit adds a "predef.h" header to libsquashfs that exposes two macros, SQFS_API and SQFS_INTERNAL that are used to explicilty set the visibiliy of stuff that ends up in libsquashfs to default or hidden. For compatibillity with Windows which may at some point eventually be considered, the SQFS_API define is set to dllexport IF the cpp symbol SQFS_BUILDING_DLL is defined and set to import otherwise. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-01Break up squashfs.h into topic related headersDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-01Install libsquashfs.so headers on the system in "sqfs" subdirectoryDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-30Add propper copyright headers to all source filesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-25Fix checks of super block block sizeDavid Oberhollenzer
Make sure range is checked when reading a block and that the check is made correctly. Also make the block log check a little more strict. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-25Replace reads in squashfs with positional readsDavid Oberhollenzer
In most cases, we know exactely where the data that we want to read is on disk, so instead of using read() on the squashfs (or lseek + read), the code can in many places be cleaned up to use the pread wrapper read_data_at instead. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-24Enable largefile supportMatt Turner
Requires that config.h be included before other headers, since the macro _FILE_OFFSET_BITS changes the definitions of things like 'struct stat'. I chose to simply include it at the top of every C file and at immediately after the double-inclusion guards of every header. Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-16cleanup: move error handling into read_retryDavid Oberhollenzer
If read_retry fails to read the expected amount of data (EOF or otherwise), it is almost always an error. This commit renames read_retry to read_data and moves error handling into the function, making a lot of error handling code redundant. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-09Sanity check id table size read from super blockDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-07-04Fix: check block_log range before deriving block size from itDavid 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-05-02Add unsquashfs stubDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>