dfltcc.h (4cc06c9afbb4dbed007f06450127ab745d6dc450) | dfltcc.h (9fec9f8ea51c782d58a8b86f8e868fc06c782386) |
---|---|
1// SPDX-License-Identifier: Zlib 2#ifndef DFLTCC_H 3#define DFLTCC_H 4 5#include "../zlib_deflate/defutil.h" 6#include <asm/facility.h> 7#include <asm/setup.h> 8 --- 79 unchanged lines hidden (view full) --- 88#define HTT_DYNAMIC 1 89 90/* 91 * Extension of inflate_state and deflate_state for DFLTCC. 92 */ 93struct dfltcc_state { 94 struct dfltcc_param_v0 param; /* Parameter block */ 95 struct dfltcc_qaf_param af; /* Available functions */ | 1// SPDX-License-Identifier: Zlib 2#ifndef DFLTCC_H 3#define DFLTCC_H 4 5#include "../zlib_deflate/defutil.h" 6#include <asm/facility.h> 7#include <asm/setup.h> 8 --- 79 unchanged lines hidden (view full) --- 88#define HTT_DYNAMIC 1 89 90/* 91 * Extension of inflate_state and deflate_state for DFLTCC. 92 */ 93struct dfltcc_state { 94 struct dfltcc_param_v0 param; /* Parameter block */ 95 struct dfltcc_qaf_param af; /* Available functions */ |
96 char msg[64]; /* Buffer for strm->msg */ 97}; 98 99/* 100 * Extension of inflate_state and deflate_state for DFLTCC. 101 */ 102struct dfltcc_deflate_state { 103 struct dfltcc_state common; /* Parameter block */ |
|
96 uLong level_mask; /* Levels on which to use DFLTCC */ 97 uLong block_size; /* New block each X bytes */ 98 uLong block_threshold; /* New block after total_in > X */ 99 uLong dht_threshold; /* New block only if avail_in >= X */ | 104 uLong level_mask; /* Levels on which to use DFLTCC */ 105 uLong block_size; /* New block each X bytes */ 106 uLong block_threshold; /* New block after total_in > X */ 107 uLong dht_threshold; /* New block only if avail_in >= X */ |
100 char msg[64]; /* Buffer for strm->msg */ | |
101}; 102 103#define ALIGN_UP(p, size) (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1)) 104/* Resides right after inflate_state or deflate_state */ 105#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((char *)(state) + ALIGN_UP(sizeof(*state), 8))) 106 | 108}; 109 110#define ALIGN_UP(p, size) (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1)) 111/* Resides right after inflate_state or deflate_state */ 112#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((char *)(state) + ALIGN_UP(sizeof(*state), 8))) 113 |
107/* External functions */ 108int dfltcc_can_deflate(z_streamp strm); 109int dfltcc_deflate(z_streamp strm, 110 int flush, 111 block_state *result); 112void dfltcc_reset(z_streamp strm, uInt size); 113int dfltcc_can_inflate(z_streamp strm); 114typedef enum { 115 DFLTCC_INFLATE_CONTINUE, 116 DFLTCC_INFLATE_BREAK, 117 DFLTCC_INFLATE_SOFTWARE, 118} dfltcc_inflate_action; 119dfltcc_inflate_action dfltcc_inflate(z_streamp strm, 120 int flush, int *ret); | 114void dfltcc_reset_state(struct dfltcc_state *dfltcc_state); 115 |
121static inline int is_dfltcc_enabled(void) 122{ 123return (zlib_dfltcc_support != ZLIB_DFLTCC_DISABLED && 124 test_facility(DFLTCC_FACILITY)); 125} 126 | 116static inline int is_dfltcc_enabled(void) 117{ 118return (zlib_dfltcc_support != ZLIB_DFLTCC_DISABLED && 119 test_facility(DFLTCC_FACILITY)); 120} 121 |
127#define DEFLATE_RESET_HOOK(strm) \ 128 dfltcc_reset((strm), sizeof(deflate_state)) 129 130#define DEFLATE_HOOK dfltcc_deflate 131 132#define DEFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_deflate((strm))) 133 | |
134#define DEFLATE_DFLTCC_ENABLED() is_dfltcc_enabled() 135 | 122#define DEFLATE_DFLTCC_ENABLED() is_dfltcc_enabled() 123 |
136#define INFLATE_RESET_HOOK(strm) \ 137 dfltcc_reset((strm), sizeof(struct inflate_state)) 138 139#define INFLATE_TYPEDO_HOOK(strm, flush) \ 140 if (dfltcc_can_inflate((strm))) { \ 141 dfltcc_inflate_action action; \ 142\ 143 RESTORE(); \ 144 action = dfltcc_inflate((strm), (flush), &ret); \ 145 LOAD(); \ 146 if (action == DFLTCC_INFLATE_CONTINUE) \ 147 break; \ 148 else if (action == DFLTCC_INFLATE_BREAK) \ 149 goto inf_leave; \ 150 } 151 152#define INFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_inflate((strm))) 153 154#define INFLATE_NEED_UPDATEWINDOW(strm) (!dfltcc_can_inflate((strm))) 155 | |
156#endif /* DFLTCC_H */ | 124#endif /* DFLTCC_H */ |