mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-07 03:40:27 +00:00
DM: adapt dm-monitor and acrnctl to use the helpers
Adapt dm-monitor and acrnctl to use the helper functions and new message definitions in acrn_mngr.h. These jobs must be done in one commit to avoid build problems: 1. message transmission and callback registration code are moved to libacrn-mngr.a, so old functions in dm-monitor could be removed to make code clean; 2. remove unnecessary monior_msg.h; 3. minor changes to acrnctl accordingly. Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Wang, Yu <yu1.wang@intel.com> signed-off-by: Yan Like <like.yan@intel.com> Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
This commit is contained in:
committed by
lijinxia
parent
53ecd932ad
commit
eada59c934
@@ -40,43 +40,7 @@
|
||||
#ifndef MONITOR_H
|
||||
#define MONITOR_H
|
||||
|
||||
#include "monitor_msg.h"
|
||||
|
||||
int monitor_init(struct vmctx *ctx);
|
||||
void monitor_close(void);
|
||||
|
||||
/**
|
||||
* monitor broadcast()
|
||||
* Developer can use monitor_broadcast() inside acrn-dm, send vmm_msg to all client.
|
||||
* @arguements:
|
||||
* @msg: any valid vmm_msg data structure, which you want send
|
||||
*/
|
||||
|
||||
int monitor_broadcast(struct vmm_msg *msg);
|
||||
|
||||
/* msg_sender will be seen/modify by msg handler */
|
||||
struct msg_sender {
|
||||
int fd; /* msg handler can replay to this fd */
|
||||
char name[CLIENT_NAME_LEN]; /* client have a chance to name itsself */
|
||||
int broadcast;
|
||||
};
|
||||
|
||||
/**
|
||||
* monitor_register_handler()
|
||||
* Developer can add vmm_msg handler inside acrn-dm, that means, when a client send a
|
||||
* vmm_msg to acrn-dm, the correspoding callback will be called
|
||||
* @arguements:
|
||||
* @msg: msg->msgid must be set, for which handler will be add.
|
||||
* @callback: when a received message match msg->msgid, callback will be envoked.
|
||||
* And these data are pass in to help developer: (a)msg, the received message, from
|
||||
* socket. (b)sender, tell you who send this message, anything wite to sender->fd
|
||||
* will be able to read out by client socket. Developer should only write valid
|
||||
* vmm_msg. (c)priv, that is what you pass to monitor_add_msg_handler();
|
||||
* @priv, callback will see this value.
|
||||
*/
|
||||
|
||||
int monitor_register_handler(struct vmm_msg *msg,
|
||||
void (*callback) (struct vmm_msg * msg,
|
||||
struct msg_sender * sender,
|
||||
void *priv), void *priv);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user