]> dgit.raspbian.org Git - dovecot.git/commitdiff
[PATCH 3/7] lib-sieve: Rename on-disk header rusage fields to unused_*
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 3 Jun 2026 12:10:46 +0000 (12:10 +0000)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
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

pigeonhole/src/lib-sieve/sieve-binary-file.c
pigeonhole/src/lib-sieve/sieve-binary-private.h

index db998848a47758484b947a14fb07791fc5da94f6..58e5158527029826f50d07bda13e547a6ec80395 100644 (file)
@@ -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 */
index 695d0a2b1f445ec4f33cfc2a67726c268649b2d5..526ce195c4d46353c3ad1e5ee5a0582f361ef08a 100644 (file)
@@ -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 {