summaryrefslogtreecommitdiffstats
path: root/mbox.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2018-07-25 17:52:40 -0700
committerKevin McCarthy <kevin@8t8.us>2018-07-25 18:21:40 -0700
commit9806d24984eeb09d249d25a8654626c713edb180 (patch)
tree99b62beb037ac2d32d72705e202fcffe9a6a935f /mbox.c
parent7b99841610124b2985b4828104f4dd303b5851b9 (diff)
Add mx_ops.msg_padding_size to return the padding for a mx type.
Mbox pads with a 1 byte, while mmdf pads with 10. Because compress depends on the child type, we create a mx_ops, which allows compress.c to delegate to the child ops.
Diffstat (limited to 'mbox.c')
-rw-r--r--mbox.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mbox.c b/mbox.c
index 265398ae..0f07cc49 100644
--- a/mbox.c
+++ b/mbox.c
@@ -1385,6 +1385,16 @@ int mbox_check_empty (const char *path)
return ((st.st_size == 0));
}
+static int mbox_msg_padding_size (CONTEXT *ctx)
+{
+ return 1;
+}
+
+static int mmdf_msg_padding_size (CONTEXT *ctx)
+{
+ return 10;
+}
+
struct mx_ops mx_mbox_ops = {
.open = mbox_open_mailbox,
.open_append = mbox_open_mailbox_append,
@@ -1395,6 +1405,7 @@ struct mx_ops mx_mbox_ops = {
.open_new_msg = mbox_open_new_message,
.check = mbox_check_mailbox,
.sync = mbox_sync_mailbox,
+ .msg_padding_size = mbox_msg_padding_size,
};
struct mx_ops mx_mmdf_ops = {
@@ -1407,4 +1418,5 @@ struct mx_ops mx_mmdf_ops = {
.open_new_msg = mbox_open_new_message,
.check = mbox_check_mailbox,
.sync = mbox_sync_mailbox,
+ .msg_padding_size = mmdf_msg_padding_size,
};