|
@@ -42,6 +42,22 @@ const char* btrfs_compress_type2str(enum btrfs_compression_type type)
|
|
|
return NULL;
|
|
return NULL;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+bool btrfs_compress_is_valid_type(const char *str, size_t len)
|
|
|
|
|
+{
|
|
|
|
|
+ int i;
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 1; i < ARRAY_SIZE(btrfs_compress_types); i++) {
|
|
|
|
|
+ size_t comp_len = strlen(btrfs_compress_types[i]);
|
|
|
|
|
+
|
|
|
|
|
+ if (len < comp_len)
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
|
|
+ if (!strncmp(btrfs_compress_types[i], str, comp_len))
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static int btrfs_decompress_bio(struct compressed_bio *cb);
|
|
static int btrfs_decompress_bio(struct compressed_bio *cb);
|
|
|
|
|
|
|
|
static inline int compressed_bio_size(struct btrfs_fs_info *fs_info,
|
|
static inline int compressed_bio_size(struct btrfs_fs_info *fs_info,
|