Lines Matching defs:hdr
446 decmpfs_header *hdr = NULL;
459 hdr = (decmpfs_header*)data;
460 hdr->attr_size = sizeof(decmpfs_disk_header);
461 hdr->compression_magic = DECMPFS_MAGIC;
462 hdr->compression_type = cp->cmp_type;
463 hdr->uncompressed_size = decmpfs_cnode_get_vnode_cached_size(cp);
476 MALLOC(data, char *, attr_size + sizeof(hdr->attr_size), M_TEMP, M_WAITOK);
484 uio_addiov(attr_uio, CAST_USER_ADDR_T(data + sizeof(hdr->attr_size)), attr_size);
493 hdr = (decmpfs_header*)data;
494 hdr->attr_size = attr_size;
496 hdr->compression_magic = OSSwapLittleToHostInt32(hdr->compression_magic);
497 hdr->compression_type = OSSwapLittleToHostInt32(hdr->compression_type);
498 hdr->uncompressed_size = OSSwapLittleToHostInt64(hdr->uncompressed_size);
501 if (hdr->compression_magic != DECMPFS_MAGIC) {
502 ErrorLog("invalid compression_magic 0x%08x, should be 0x%08x\n", hdr->compression_magic, DECMPFS_MAGIC);
507 if (hdr->compression_type >= CMP_MAX) {
512 ErrorLog("compression_type %d out of range\n", hdr->compression_type);
524 *hdrOut = hdr;
588 decmpfs_header *hdr = NULL;
589 errno_t err = decmpfs_fetch_compressed_header(vp, cp, &hdr, 0);
600 decmpfs_validate_compressed_file_func validate = decmp_get_func(hdr->compression_type, validate);
603 err = validate(vp, decmpfs_ctx, hdr);
604 } else if (decmp_get_func(hdr->compression_type, fetch) == NULL) {
613 if (hdr) FREE(hdr, M_TEMP);
637 decmpfs_header *hdr = NULL;
707 error = decmpfs_fetch_compressed_header(vp, cp, &hdr, 1);
708 if ((hdr != NULL) && (error == ERANGE)) {
724 if (((ret == FILE_IS_COMPRESSED) || saveInvalid) && hdr) {
738 decmpfs_cnode_set_vnode_cached_size(cp, hdr->uncompressed_size);
740 decmpfs_cnode_set_vnode_cmp_type(cp, hdr->compression_type, 1);
742 if (hdr->attr_size == sizeof(decmpfs_disk_header)) {
747 ubc_setsize(vp, hdr->uncompressed_size);
751 decmpfs_get_decompression_flags_func get_flags = decmp_get_func(hdr->compression_type, get_flags);
753 decompression_flags = get_flags(vp, decmpfs_ctx, hdr);
765 if (hdr) FREE(hdr, M_TEMP);
815 decmpfs_header *hdr = NULL;
816 error = decmpfs_fetch_compressed_header(vp, NULL, &hdr, 1);
830 if (hdr) FREE(hdr, M_TEMP);
968 compression_type_valid(decmpfs_header *hdr)
975 if (decmp_get_func(hdr->compression_type, fetch) != NULL) {
986 decmpfs_fetch_uncompressed_data(vnode_t vp, decmpfs_cnode *cp, decmpfs_header *hdr, off_t offset, user_ssize_t size, int nvec, decmpfs_vector *vec, uint64_t *bytes_read)
994 if ((uint64_t)offset >= hdr->uncompressed_size) {
1004 if ((uint64_t)(offset + size) > hdr->uncompressed_size) {
1006 size = hdr->uncompressed_size - offset;
1015 decmpfs_fetch_uncompressed_data_func fetch = decmp_get_func(hdr->compression_type, fetch);
1017 err = fetch(vp, decmpfs_ctx, hdr, offset, size, nvec, vec, bytes_read);
1079 decmpfs_header *hdr = NULL;
1094 err = decmpfs_fetch_compressed_header(vp, cp, &hdr, 0);
1099 cachedSize = hdr->uncompressed_size;
1101 if (!compression_type_valid(hdr)) {
1149 err = decmpfs_fetch_uncompressed_data(vp, cp, hdr, uplPos, uplSize, 1, &vec, &did_read);
1193 if (hdr) FREE(hdr, M_TEMP);
1221 decmpfs_header *hdr = NULL;
1259 err = decmpfs_fetch_compressed_header(vp, cp, &hdr, 0);
1263 if (!compression_type_valid(hdr)) {
1276 decmpfs_adjust_fetch_region_func adjust_fetch = decmp_get_func(hdr->compression_type, adjust_fetch);
1279 adjust_fetch(vp, decmpfs_ctx, hdr, &uplPos, &uplSize);
1363 err = decmpfs_fetch_uncompressed_data(vp, cp, hdr, curUplPos, curUplSize, 1, &vec, &did_read);
1433 if (hdr) FREE(hdr, M_TEMP);
1456 decmpfs_header *hdr = NULL;
1457 int err = decmpfs_fetch_compressed_header(vp, cp, &hdr, 0);
1462 decmpfs_free_compressed_data_func free_data = decmp_get_func(hdr->compression_type, free_data);
1464 err = free_data(vp, decmpfs_ctx, hdr);
1483 if (hdr) FREE(hdr, M_TEMP);
1528 decmpfs_header *hdr = NULL;
1575 err = decmpfs_fetch_compressed_header(vp, cp, &hdr, 0);
1580 uncompressed_size = hdr->uncompressed_size;
1582 toSize = hdr->uncompressed_size;
1587 } else if ((uint64_t)toSize > hdr->uncompressed_size) {
1589 toSize = hdr->uncompressed_size;
1619 err = decmpfs_fetch_uncompressed_data(vp, cp, hdr, offset, vec.size, 1, &vec, &bytes_read);
1707 if (hdr) FREE(hdr, M_TEMP);
1740 decmpfs_validate_compressed_file_Type1(__unused vnode_t vp, __unused vfs_context_t ctx, decmpfs_header *hdr)
1744 if (hdr->uncompressed_size + sizeof(decmpfs_disk_header) != (uint64_t)hdr->attr_size) {
1753 decmpfs_fetch_uncompressed_data_Type1(__unused vnode_t vp, __unused vfs_context_t ctx, decmpfs_header *hdr, off_t offset, user_ssize_t size, int nvec, decmpfs_vector *vec, uint64_t *bytes_read)
1759 if (hdr->uncompressed_size + sizeof(decmpfs_disk_header) != (uint64_t)hdr->attr_size) {
1775 memcpy(vec[i].buf, hdr->attr_bytes + offset, curCopy);