diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2018-03-26 14:36:43 +1030 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2018-04-04 17:27:31 +0930 |
commit | efb09def5e21959972adde9f5c092f1840eff908 (patch) | |
tree | c8509e238395315024124c63ced2cf31de00f6be /mboxd_msg.c | |
parent | 30bcf84c932a579532e5f8417af549494e11b6e9 (diff) | |
download | phosphor-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 'mboxd_msg.c')
-rw-r--r-- | mboxd_msg.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mboxd_msg.c b/mboxd_msg.c index 46679b8..4ca8e24 100644 --- a/mboxd_msg.c +++ b/mboxd_msg.c @@ -33,9 +33,6 @@ static int mbox_handle_flush_window(struct mbox_context *context, union mbox_regs *req, struct mbox_msg *resp); -typedef int (*mboxd_mbox_handler)(struct mbox_context *, union mbox_regs *, - struct mbox_msg *); - /* * write_bmc_event_reg() - Write to the BMC controlled status register (reg 15) * @context: The mbox context pointer @@ -754,7 +751,8 @@ static int handle_mbox_req(struct mbox_context *context, union mbox_regs *req) resp.response = -rc; } else { /* Commands start at 1 so we have to subtract 1 from the cmd */ - rc = mbox_handlers[req->msg.command - 1](context, req, &resp); + mboxd_mbox_handler h = context->handlers[req->msg.command - 1]; + rc = h(context, req, &resp); if (rc < 0) { MSG_ERR("Error handling mbox cmd: %d\n", req->msg.command); @@ -835,6 +833,8 @@ int __init_mbox_dev(struct mbox_context *context, const char *path) { int fd; + context->handlers = mbox_handlers; + /* Open MBOX Device */ fd = open(path, O_RDWR | O_NONBLOCK); if (fd < 0) { |