summaryrefslogtreecommitdiffstats
path: root/test/mbox.c
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-03-26 14:36:43 +1030
committerAndrew Jeffery <andrew@aj.id.au>2018-04-04 17:27:31 +0930
commitefb09def5e21959972adde9f5c092f1840eff908 (patch)
treec8509e238395315024124c63ced2cf31de00f6be /test/mbox.c
parent30bcf84c932a579532e5f8417af549494e11b6e9 (diff)
downloadphosphor-mboxd-efb09def5e21959972adde9f5c092f1840eff908.tar.gz
phosphor-mboxd-efb09def5e21959972adde9f5c092f1840eff908.zip
mbox_msg: Move handler table to struct mbox_context
This allows us to provide alternative implementations for the handlers as necessary. The vpnor feature, which enforces the read-only property of FFS partitions, requires this for handling CREATE_WRITE_WINDOW. Change-Id: Ia969a6f085244b194c500e66b62adca5e10bacba Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Diffstat (limited to 'test/mbox.c')
-rw-r--r--test/mbox.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/mbox.c b/test/mbox.c
index 932c4d7..3daf493 100644
--- a/test/mbox.c
+++ b/test/mbox.c
@@ -232,9 +232,14 @@ struct mbox_context *mbox_create_test_context(int n_windows, size_t len)
test.context.windows.default_size = len;
/*
- * We need to control MBOX_FD, so don't call __init_mbox_dev().
- * Instead, insert our temporary file's fd directly into the context
+ * We need to call __init_mbox_dev() to initialise the handler table.
+ * However, afterwards we need to discard the fd of the clearly useless
+ * /dev/null and replace it with our own fd for mbox device emulation
+ * by the test framework.
*/
+ __init_mbox_dev(&test.context, "/dev/null");
+ rc = close(test.context.fds[MBOX_FD].fd);
+ assert(rc == 0);
test.context.fds[MBOX_FD].fd = test.mbox.fd;
rc = init_flash_dev(&test.context);
OpenPOWER on IntegriCloud