summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-24 15:59:54 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-24 16:05:01 +0100
commitc8d234ddcf42f4a2d3e30122877d792fabd92f68 (patch)
tree630ecf78f2f22aa1e2bbc6631d5179eab8e52c2e
parent58c012f6fa5bbda88a849b7ecf93519400ee0a43 (diff)
Cleanup: remove the entirely redundant sqfs_has_xattr function
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--CHANGELOG.md3
-rw-r--r--include/sqfs/xattr.h24
-rw-r--r--lib/sqfs/xattr.c5
-rw-r--r--lib/sqfs/xattr_writer.c2
-rw-r--r--tar/tar2sqfs.c2
5 files changed, 6 insertions, 30 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c04fbcd..fb0b9b9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+### Removed
+- Entirely redundant `sqfs_has_xattr` function from `libsquashfs`.
+
### Fixed
- LZO compressor moved out of libsquashfs to avoid licensing problems.
- Make overriding configure variables for LZO library actually work.
diff --git a/include/sqfs/xattr.h b/include/sqfs/xattr.h
index 654fe9c..0f74c94 100644
--- a/include/sqfs/xattr.h
+++ b/include/sqfs/xattr.h
@@ -171,34 +171,12 @@ SQFS_API const char *sqfs_get_xattr_prefix(E_SQFS_XATTR_TYPE id);
* prefix of the key string and storing an enumerator instead to save memory.
*
* This function takes a key and finds the enumerator value that represents
- * its prefix.
- *
- * This function will return a failure value to indicate that the given prefix
- * isn't supported. Another function called @ref sqfs_has_xattr is provided to
- * explicitly check if a prefix is supported.
+ * its prefix. An error value is returned if the given prefix isn't supported.
*
* @return On success an @ref E_SQFS_XATTR_TYPE, -1 if it isn't supported.
*/
SQFS_API int sqfs_get_xattr_prefix_id(const char *key);
-/**
- * @brief Check if a given xattr key can actually be encoded in SquashFS
- *
- * Like many file systems, SquashFS stores xattrs be cutting off the common
- * prefix of the key string and storing an enumerator instead to save memory.
- *
- * However, this means if new prefixes are introduced, they are not immediately
- * supported since SquashFS may not have an enumerator defined for them.
- *
- * This function checks if the @ref sqfs_get_xattr_prefix_id function can
- * translate the prefix of the given key into a coresponding enumerator.
- *
- * If it returns false, this means either that SquashFS doesn't support this
- * prefix, or it has recently been added but the version of libsquashfs you
- * are using doesn't support it.
- */
-SQFS_API bool sqfs_has_xattr(const char *key);
-
#ifdef __cplusplus
}
#endif
diff --git a/lib/sqfs/xattr.c b/lib/sqfs/xattr.c
index 985fc95..6ce6b9a 100644
--- a/lib/sqfs/xattr.c
+++ b/lib/sqfs/xattr.c
@@ -46,8 +46,3 @@ const char *sqfs_get_xattr_prefix(E_SQFS_XATTR_TYPE id)
return NULL;
}
-
-bool sqfs_has_xattr(const char *key)
-{
- return sqfs_get_xattr_prefix_id(key) >= 0;
-}
diff --git a/lib/sqfs/xattr_writer.c b/lib/sqfs/xattr_writer.c
index 18ca657..81ee26c 100644
--- a/lib/sqfs/xattr_writer.c
+++ b/lib/sqfs/xattr_writer.c
@@ -169,7 +169,7 @@ int sqfs_xattr_writer_add(sqfs_xattr_writer_t *xwr, const char *key,
char *value_str;
int err;
- if (!sqfs_has_xattr(key))
+ if (sqfs_get_xattr_prefix_id(key) < 0)
return SQFS_ERROR_UNSUPPORTED;
/* resolve key and value into unique, incremental IDs */
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index 08bb8b5..d0f2851 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -277,7 +277,7 @@ static int copy_xattr(tree_node_t *node, tar_header_decoded_t *hdr)
}
for (xattr = hdr->xattr; xattr != NULL; xattr = xattr->next) {
- if (!sqfs_has_xattr(xattr->key)) {
+ if (sqfs_get_xattr_prefix_id(xattr->key) < 0) {
fprintf(stderr, "%s: squashfs does not "
"support xattr prefix of %s\n",
dont_skip ? "ERROR" : "WARNING",