예제 #1
0
static int decompress(char *inbuf, char *outbuf, u64 compress_len,
		      u64 *decompress_len, int compress)
{
	switch (compress) {
	case BTRFS_COMPRESS_ZLIB:
		return decompress_zlib(inbuf, outbuf, compress_len,
				       *decompress_len);
	case BTRFS_COMPRESS_LZO:
		return decompress_lzo((unsigned char *)inbuf, outbuf, compress_len,
				      decompress_len);
	default:
		break;
	}

	fprintf(stderr, "invalid compression type: %d\n", compress);
	return -1;
}
예제 #2
0
static int decompress(struct btrfs_root *root, char *inbuf, char *outbuf,
			u64 compress_len, u64 *decompress_len, int compress)
{
	switch (compress) {
	case BTRFS_COMPRESS_ZLIB:
		return decompress_zlib(inbuf, outbuf, compress_len,
				       *decompress_len);
	case BTRFS_COMPRESS_LZO:
		return decompress_lzo(root, (unsigned char *)inbuf, outbuf,
					compress_len, decompress_len);
	default:
		break;
	}

	error("invalid compression type: %d", compress);
	return -1;
}
예제 #3
0
/* This function is very hot. It's called on every file when zip is enabled. */
void* decompress(const ag_compression_type zip_type, const void* buf, const int buf_len,
                 const char* dir_full_path, int* new_buf_len) {

    switch(zip_type) {
        case AG_GZIP:
             return decompress_zlib(buf, buf_len, dir_full_path, new_buf_len);
        case AG_COMPRESS:
             return decompress_lwz(buf, buf_len, dir_full_path, new_buf_len);
        case AG_ZIP:
             return decompress_zip(buf, buf_len, dir_full_path, new_buf_len);
        case AG_NO_COMPRESSION:
            log_err("File %s is not compressed", dir_full_path);
            break;
        default:
            log_err("Unsupported compression type: %d", zip_type);
    }

    *new_buf_len = 0;
    return NULL;
}