aboutsummaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 19:08:10 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 19:08:10 +0200
commitf8a92529ec04b560b5b9e647b976892412f78134 (patch)
tree5308d7f500df46ef64423708ed40a37675f4020c /include/util.h
parent320ae4f8e752f6652c7b5c8201d7267cd4de17c1 (diff)
Fix API visibility for libsquashfs.so
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>
Diffstat (limited to 'include/util.h')
-rw-r--r--include/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index 651a958..93b8a04 100644
--- a/include/util.h
+++ b/include/util.h
@@ -8,6 +8,7 @@
#define UTIL_H
#include "config.h"
+#include "sqfs/predef.h"
#include <sys/types.h>
#include <stdint.h>
@@ -52,6 +53,7 @@ typedef struct sparse_map_t {
on success. Writes to stderr on failure using 'errstr' as a perror style
error prefix.
*/
+SQFS_INTERNAL
int write_data(const char *errstr, int fd, const void *data, size_t size);
/*
@@ -60,11 +62,13 @@ int write_data(const char *errstr, int fd, const void *data, size_t size);
on success. Writes to stderr on failure using 'errstr' as a perror style
error prefix.
*/
+SQFS_INTERNAL
int read_data(const char *errstr, int fd, void *buffer, size_t size);
/*
Similar to read_data but wrapps pread() instead of read().
*/
+SQFS_INTERNAL
int read_data_at(const char *errstr, off_t location,
int fd, void *buffer, size_t size);
@@ -74,6 +78,7 @@ int read_data_at(const char *errstr, off_t location,
Prints out version information. The program name is extracted from the
BSD style __progname global variable.
*/
+SQFS_INTERNAL
void print_version(void);
/*
@@ -82,21 +87,26 @@ void print_version(void);
Returns 0 on success.
*/
+SQFS_INTERNAL
int mkdir_p(const char *path);
/* Returns 0 on success. On failure, prints error message to stderr. */
+SQFS_INTERNAL
int pushd(const char *path);
/* Same as pushd, but the string doesn't have to be null-terminated. */
+SQFS_INTERNAL
int pushdn(const char *path, size_t len);
/* Returns 0 on success. On failure, prints error message to stderr. */
+SQFS_INTERNAL
int popd(void);
/*
Write zero bytes to an output file to padd it to specified block size.
Returns 0 on success. On failure, prints error message to stderr.
*/
+SQFS_INTERNAL
int padd_file(int outfd, uint64_t size, size_t blocksize);
/*
@@ -107,12 +117,15 @@ int padd_file(int outfd, uint64_t size, size_t blocksize);
Iternally checks for arithmetic overflows when allocating the combined thing.
*/
+SQFS_INTERNAL
void *alloc_flex(size_t base_size, size_t item_size, size_t nmemb);
/* Basically the same as calloc, but *ALWAYS* does overflow checking */
+SQFS_INTERNAL
void *alloc_array(size_t item_size, size_t nmemb);
/* allocates len + 1 (for the null-terminator) and does overflow checking */
+SQFS_INTERNAL
void *alloc_string(size_t len);
#endif /* UTIL_H */