cryptodeflate: Drop z_stream zbuf.state->dummy from SDT probe.

For older versions of zlib, dummy was a workaround for compilers that do not
handle opaque type definition well; on FreeBSD, it's representing a value
that is not really useful for monitoring purposes, and the field would be gone
in newer zlib versions.

PR:		229763
Submitted by:	Yoshihiro Ota <ota at j.email.ne.jp>
Differential Revision:	https://reviews.freebsd.org/D20222
This commit is contained in:
Xin LI 2019-05-24 02:44:15 +00:00
parent 22554a341e
commit a49818787d

View File

@ -50,10 +50,10 @@ __FBSDID("$FreeBSD$");
SDT_PROVIDER_DECLARE(opencrypto); SDT_PROVIDER_DECLARE(opencrypto);
SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, entry, SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, entry,
"int", "u_int32_t"); "int", "u_int32_t");
SDT_PROBE_DEFINE5(opencrypto, deflate, deflate_global, bad, SDT_PROBE_DEFINE6(opencrypto, deflate, deflate_global, bad,
"int", "int", "int", "int", "int"); "int", "int", "int", "int", "int", "int");
SDT_PROBE_DEFINE5(opencrypto, deflate, deflate_global, iter, SDT_PROBE_DEFINE6(opencrypto, deflate, deflate_global, iter,
"int", "int", "int", "int", "int"); "int", "int", "int", "int", "int", "int");
SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, return, SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, return,
"int", "u_int32_t"); "int", "u_int32_t");
@ -105,8 +105,8 @@ deflate_global(data, size, decomp, out)
bufh = bufp = malloc(sizeof(*bufp) + (size_t)(size * i), bufh = bufp = malloc(sizeof(*bufp) + (size_t)(size * i),
M_CRYPTO_DATA, M_NOWAIT); M_CRYPTO_DATA, M_NOWAIT);
if (bufp == NULL) { if (bufp == NULL) {
SDT_PROBE5(opencrypto, deflate, deflate_global, bad, SDT_PROBE6(opencrypto, deflate, deflate_global, bad,
decomp, 0, __LINE__, 0, 0); decomp, 0, __LINE__, 0, 0, 0);
goto bad2; goto bad2;
} }
bufp->next = NULL; bufp->next = NULL;
@ -125,8 +125,8 @@ deflate_global(data, size, decomp, out)
deflateInit2(&zbuf, Z_DEFAULT_COMPRESSION, Z_METHOD, deflateInit2(&zbuf, Z_DEFAULT_COMPRESSION, Z_METHOD,
window_deflate, Z_MEMLEVEL, Z_DEFAULT_STRATEGY); window_deflate, Z_MEMLEVEL, Z_DEFAULT_STRATEGY);
if (error != Z_OK) { if (error != Z_OK) {
SDT_PROBE5(opencrypto, deflate, deflate_global, bad, SDT_PROBE6(opencrypto, deflate, deflate_global, bad,
decomp, error, __LINE__, 0, 0); decomp, error, __LINE__, 0, 0, 0);
goto bad; goto bad;
} }
@ -134,24 +134,14 @@ deflate_global(data, size, decomp, out)
error = decomp ? inflate(&zbuf, Z_SYNC_FLUSH) : error = decomp ? inflate(&zbuf, Z_SYNC_FLUSH) :
deflate(&zbuf, Z_FINISH); deflate(&zbuf, Z_FINISH);
if (error != Z_OK && error != Z_STREAM_END) { if (error != Z_OK && error != Z_STREAM_END) {
/* SDT_PROBE6(opencrypto, deflate, deflate_global, bad,
* Unfortunately we are limited to 5 arguments,
* thus use two probes.
*/
SDT_PROBE5(opencrypto, deflate, deflate_global, bad,
decomp, error, __LINE__, decomp, error, __LINE__,
zbuf.avail_in, zbuf.avail_out); zbuf.avail_in, zbuf.avail_out, zbuf.total_out);
SDT_PROBE5(opencrypto, deflate, deflate_global, bad,
decomp, error, __LINE__,
zbuf.state->dummy, zbuf.total_out);
goto bad; goto bad;
} }
SDT_PROBE5(opencrypto, deflate, deflate_global, iter, SDT_PROBE6(opencrypto, deflate, deflate_global, iter,
decomp, error, __LINE__, decomp, error, __LINE__,
zbuf.avail_in, zbuf.avail_out); zbuf.avail_in, zbuf.avail_out, zbuf.total_out);
SDT_PROBE5(opencrypto, deflate, deflate_global, iter,
decomp, error, __LINE__,
zbuf.state->dummy, zbuf.total_out);
if (decomp && zbuf.avail_in == 0 && error == Z_STREAM_END) { if (decomp && zbuf.avail_in == 0 && error == Z_STREAM_END) {
/* Done. */ /* Done. */
break; break;
@ -165,8 +155,8 @@ deflate_global(data, size, decomp, out)
p = malloc(sizeof(*p) + (size_t)(size * i), p = malloc(sizeof(*p) + (size_t)(size * i),
M_CRYPTO_DATA, M_NOWAIT); M_CRYPTO_DATA, M_NOWAIT);
if (p == NULL) { if (p == NULL) {
SDT_PROBE5(opencrypto, deflate, deflate_global, SDT_PROBE6(opencrypto, deflate, deflate_global,
bad, decomp, 0, __LINE__, 0, 0); bad, decomp, 0, __LINE__, 0, 0, 0);
goto bad; goto bad;
} }
p->next = NULL; p->next = NULL;
@ -177,16 +167,9 @@ deflate_global(data, size, decomp, out)
zbuf.avail_out = bufp->size; zbuf.avail_out = bufp->size;
} else { } else {
/* Unexpect result. */ /* Unexpect result. */
/* SDT_PROBE6(opencrypto, deflate, deflate_global, bad,
* Unfortunately we are limited to 5 arguments,
* thus, again, use two probes.
*/
SDT_PROBE5(opencrypto, deflate, deflate_global, bad,
decomp, error, __LINE__, decomp, error, __LINE__,
zbuf.avail_in, zbuf.avail_out); zbuf.avail_in, zbuf.avail_out, zbuf.total_out);
SDT_PROBE5(opencrypto, deflate, deflate_global, bad,
decomp, error, __LINE__,
zbuf.state->dummy, zbuf.total_out);
goto bad; goto bad;
} }
} }
@ -195,8 +178,8 @@ deflate_global(data, size, decomp, out)
*out = malloc(result, M_CRYPTO_DATA, M_NOWAIT); *out = malloc(result, M_CRYPTO_DATA, M_NOWAIT);
if (*out == NULL) { if (*out == NULL) {
SDT_PROBE5(opencrypto, deflate, deflate_global, bad, SDT_PROBE6(opencrypto, deflate, deflate_global, bad,
decomp, 0, __LINE__, 0, 0); decomp, 0, __LINE__, 0, 0, 0);
goto bad; goto bad;
} }
if (decomp) if (decomp)