From: Timo Sirainen Date: Wed, 3 Jun 2026 12:10:46 +0000 (+0000) Subject: [PATCH 3/7] lib-sieve: Rename on-disk header rusage fields to unused_* X-Git-Tag: archive/raspbian/1%2.4.1+dfsg1-6+rpi1+deb13u7^2~112 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=fa01351c243cc67b0934420c02cf20b6a28f8be7;p=dovecot.git [PATCH 3/7] lib-sieve: Rename on-disk header rusage fields to unused_* The .svbin header's resource_usage fields no longer carry data: they are zeroed on save and discarded on load. Cumulative CPU tracking lives in the per-user sieve-rusage file, and the in-memory carry-over lives in sbin->persisted_rusage. Flatten the nested resource_usage struct and rename the fields to unused_update_time and unused_cpu_time_msecs so it is obvious the fields are kept only for on-disk format compatibility. The memory layout of struct sieve_binary_header is unchanged. Gbp-Pq: Name 0003-lib-sieve-Rename-on-disk-header-rusage-fields-to-unu.patch --- diff --git a/pigeonhole/src/lib-sieve/sieve-binary-file.c b/pigeonhole/src/lib-sieve/sieve-binary-file.c index db99884..58e5158 100644 --- a/pigeonhole/src/lib-sieve/sieve-binary-file.c +++ b/pigeonhole/src/lib-sieve/sieve-binary-file.c @@ -147,13 +147,14 @@ sieve_binary_file_read_header(struct sieve_binary *sbin, int fd, return 0; } -/* The on-disk binary header carries an unused resource_usage struct for +/* The on-disk binary header carries unused resource_usage fields for backward compatibility. Tracking lives in the per-user sieve-rusage file. */ static void sieve_binary_file_zero_header_rusage(struct sieve_binary *sbin) { struct sieve_binary_header *header = &sbin->header; - i_zero(&header->resource_usage); + header->unused_update_time = 0; + header->unused_cpu_time_msecs = 0; sieve_resource_usage_init(&sbin->rusage); sbin->rusage_updated = FALSE; } @@ -834,7 +835,8 @@ _sieve_binary_open(struct sieve_binary *sbin, enum sieve_error *error_code_r) /* Resource usage tracking is no longer kept in the binary file; discard any data from older versions. */ - i_zero(&sbin->header.resource_usage); + sbin->header.unused_update_time = 0; + sbin->header.unused_cpu_time_msecs = 0; sbin->header.flags &= ENUM_NEGATE(SIEVE_BINARY_FLAG_RESOURCE_LIMIT); /* Load block index */ diff --git a/pigeonhole/src/lib-sieve/sieve-binary-private.h b/pigeonhole/src/lib-sieve/sieve-binary-private.h index 695d0a2..526ce19 100644 --- a/pigeonhole/src/lib-sieve/sieve-binary-private.h +++ b/pigeonhole/src/lib-sieve/sieve-binary-private.h @@ -26,10 +26,11 @@ struct sieve_binary_header { uint32_t hdr_size; uint32_t flags; - struct { - uint64_t update_time; - uint32_t cpu_time_msecs; - } resource_usage; + /* Resource usage tracking moved to per-user sieve-rusage file. These + fields are kept zeroed and present only for on-disk format + compatibility with older .svbin files. */ + uint64_t unused_update_time; + uint32_t unused_cpu_time_msecs; }; struct sieve_binary_file {