# HG changeset patch # User Damien Riegel <damien.rie...@gmail.com> # Date 1462465911 14400 # Thu May 05 12:31:51 2016 -0400 # Node ID 385adc8ca7bb4355f05a4553ea5435273a496ff9 # Parent 54af62db9cf839c6c1cc3cd4978e7e0dedb65693 mmdf: populate probe callback
For now, we rely on mx_get_magic to not make the implementation too cumbersome. The point is to get rid of this "magic" anyway. We need to create a dedicated mx_ops structure for that as the probe function is different of the one for mbox. diff -r 54af62db9cf8 -r 385adc8ca7bb mbox.c --- a/mbox.c Thu May 05 12:31:16 2016 -0400 +++ b/mbox.c Thu May 05 12:31:51 2016 -0400 @@ -421,11 +421,21 @@ return 0; } +static int mmdf_probe(const char *path) +{ + return mx_get_magic(path) == M_MMDF; +} + struct mx_ops mx_mbox_ops = { .probe = mbox_probe, .close = mbox_close_mailbox, }; +struct mx_ops mx_mmdf_ops = { + .probe = mmdf_probe, + .close = mbox_close_mailbox, +}; + /* open a mbox or mmdf style mailbox */ int mbox_open_mailbox (CONTEXT *ctx) {