aboutsummaryrefslogtreecommitdiff
path: root/include/sqfs/inode.h
AgeCommit message (Collapse)Author
2020-02-23Unify the payload counters in the sqfs_inode_generic_tDavid Oberhollenzer
Instead of having seperate counters for blocks, dir index bytes and having to fiddle out the link target size, simply use a single value that stores the number of payload bytes used. A seperate "payload bytes available" is used for dynamically growing inodes during processing. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2020-01-19Cleanup: remove the payload pointers from sqfs_inode_generic_tDavid Oberhollenzer
There are 3 types of extra payload: - Directory index - File block sizes - Symlink target This commit removes the type specific pointers and modifies the code to use the payload area directly. To simplify the file block case and mitigate alignment issues, the type of the extra field is changed to sqfs_u32. For symlink target, the extra field can simply be cast to a character pointer (it had to be cast anyway for most uses). For block sizes, probably the most common usecase, it can be used as is. For directory indices, there is a helper function anyway. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2020-01-19Update explanation on directory index accountingDavid Oberhollenzer
Tests with the Debian image (which is generated with squashfs-tools, so should be interpreted as ground truth) have showed that the count is not stored off-by-one. The code was already doing the right thing, but the documentation was wrong. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2020-01-19Add a helper function to unpack directory index entriesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2020-01-12Add an inode deep copy helper function to libsquashfsDavid 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-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-27Add enum with inode permissions for compatibility with non-POSIX systemsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-27Cleanup: replace fixed with data types with typedefsDavid Oberhollenzer
This is a fully automated search and replace, i.e. I ran this: git grep -l uint8_t | xargs sed -i 's/uint8_t/sqfs_u8/g' git grep -l uint16_t | xargs sed -i 's/uint16_t/sqfs_u16/g' git grep -l uint32_t | xargs sed -i 's/uint32_t/sqfs_u32/g' git grep -l uint64_t | xargs sed -i 's/uint64_t/sqfs_u64/g' git grep -l int8_t | xargs sed -i 's/int8_t/sqfs_s8/g' git grep -l int16_t | xargs sed -i 's/int16_t/sqfs_s16/g' git grep -l int32_t | xargs sed -i 's/int32_t/sqfs_s32/g' git grep -l int64_t | xargs sed -i 's/int64_t/sqfs_s64/g' and than added the appropriate definitions to sqfs/predef.h The whole point being better compatibillity with platforms that may not have an stdint.h with the propper definitions. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-22Add helper functions for working with inodesDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-09Add doxygen annotations to all public headersDavid Oberhollenzer
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-07Move meta reader/writer functions to respective headersDavid Oberhollenzer
The dir.h and inode.h headers contained meta data reader/writer related functions. This commit moves them to the propper headers. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-07Move data structure forward declarations to predef headerDavid Oberhollenzer
This in turn allows for removing most of the header inclusions within the public headers. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-07Remove config.h inclusions from public headersDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-05Cleanup: move inclusion of type headers to predef.hDavid Oberhollenzer
Instead of including stddef/stdint/stdbool etc... all over the place, move it to predef.h which is included from all other headers. 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-05Cleanup: add sqfs_* prefix to meta readerDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-05Cleanup: add sqfs_* prefix to meta writerDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-04Store number of file blocks in generic inode structDavid Oberhollenzer
This simplifies things a little bit. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-04Split fstree inode serialization, move independend part to libsquashfs.soDavid Oberhollenzer
This commit adds a function to libsquashfs.so for writing generic inodes to a meta writer and another function to libsqfshelper.a that turns a tree node to an inode. That way, the tree serialization code can be expressed in terms of those functions and a bulk of the independend code can be moved over to libsquashfs.so Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-01Add C++ gurads to publicly exported functionsDavid Oberhollenzer
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-01API cleanup: Shuffle declarations aroundDavid Oberhollenzer
Move declarations for stuff that is defined in libsquashfs.so into the public headers and declarations for stuff that isn't, out of there. Also move the meta reader/writer helper functions to their respective headers. 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>