mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-16 22:51:55 -06:00
xen: Rename xen_be_printf to xen_pv_printf
Prepare xen_be_printf to be used by both backend and frontends: * xen_be_printf -> xen_pv_printf Signed-off-by: Emil Condrea <emilcondrea@gmail.com> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Quan Xu <xuquan8@huawei.com> Acked-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
parent
ecf7981891
commit
96c77dba6f
10 changed files with 117 additions and 117 deletions
|
@ -100,7 +100,7 @@ int xen_be_set_state(struct XenDevice *xendev, enum xenbus_state state)
|
|||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
xen_be_printf(xendev, 1, "backend state: %s -> %s\n",
|
||||
xen_pv_printf(xendev, 1, "backend state: %s -> %s\n",
|
||||
xenbus_strstate(xendev->be_state), xenbus_strstate(state));
|
||||
xendev->be_state = state;
|
||||
return 0;
|
||||
|
@ -136,7 +136,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
|
|||
|
||||
xendev->evtchndev = xenevtchn_open(NULL, 0);
|
||||
if (xendev->evtchndev == NULL) {
|
||||
xen_be_printf(NULL, 0, "can't open evtchn device\n");
|
||||
xen_pv_printf(NULL, 0, "can't open evtchn device\n");
|
||||
g_free(xendev);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
|
|||
if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
|
||||
xendev->gnttabdev = xengnttab_open(NULL, 0);
|
||||
if (xendev->gnttabdev == NULL) {
|
||||
xen_be_printf(NULL, 0, "can't open gnttab device\n");
|
||||
xen_pv_printf(NULL, 0, "can't open gnttab device\n");
|
||||
xenevtchn_close(xendev->evtchndev);
|
||||
g_free(xendev);
|
||||
return NULL;
|
||||
|
@ -178,7 +178,7 @@ static void xen_be_backend_changed(struct XenDevice *xendev, const char *node)
|
|||
}
|
||||
|
||||
if (node) {
|
||||
xen_be_printf(xendev, 2, "backend update: %s\n", node);
|
||||
xen_pv_printf(xendev, 2, "backend update: %s\n", node);
|
||||
if (xendev->ops->backend_changed) {
|
||||
xendev->ops->backend_changed(xendev, node);
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ static void xen_be_frontend_changed(struct XenDevice *xendev, const char *node)
|
|||
fe_state = XenbusStateUnknown;
|
||||
}
|
||||
if (xendev->fe_state != fe_state) {
|
||||
xen_be_printf(xendev, 1, "frontend state: %s -> %s\n",
|
||||
xen_pv_printf(xendev, 1, "frontend state: %s -> %s\n",
|
||||
xenbus_strstate(xendev->fe_state),
|
||||
xenbus_strstate(fe_state));
|
||||
}
|
||||
|
@ -204,13 +204,13 @@ static void xen_be_frontend_changed(struct XenDevice *xendev, const char *node)
|
|||
g_free(xendev->protocol);
|
||||
xendev->protocol = xenstore_read_fe_str(xendev, "protocol");
|
||||
if (xendev->protocol) {
|
||||
xen_be_printf(xendev, 1, "frontend protocol: %s\n",
|
||||
xen_pv_printf(xendev, 1, "frontend protocol: %s\n",
|
||||
xendev->protocol);
|
||||
}
|
||||
}
|
||||
|
||||
if (node) {
|
||||
xen_be_printf(xendev, 2, "frontend update: %s\n", node);
|
||||
xen_pv_printf(xendev, 2, "frontend update: %s\n", node);
|
||||
if (xendev->ops->frontend_changed) {
|
||||
xendev->ops->frontend_changed(xendev, node);
|
||||
}
|
||||
|
@ -234,26 +234,26 @@ static int xen_be_try_setup(struct XenDevice *xendev)
|
|||
int be_state;
|
||||
|
||||
if (xenstore_read_be_int(xendev, "state", &be_state) == -1) {
|
||||
xen_be_printf(xendev, 0, "reading backend state failed\n");
|
||||
xen_pv_printf(xendev, 0, "reading backend state failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (be_state != XenbusStateInitialising) {
|
||||
xen_be_printf(xendev, 0, "initial backend state is wrong (%s)\n",
|
||||
xen_pv_printf(xendev, 0, "initial backend state is wrong (%s)\n",
|
||||
xenbus_strstate(be_state));
|
||||
return -1;
|
||||
}
|
||||
|
||||
xendev->fe = xenstore_read_be_str(xendev, "frontend");
|
||||
if (xendev->fe == NULL) {
|
||||
xen_be_printf(xendev, 0, "reading frontend path failed\n");
|
||||
xen_pv_printf(xendev, 0, "reading frontend path failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* setup frontend watch */
|
||||
snprintf(token, sizeof(token), "fe:%p", xendev);
|
||||
if (!xs_watch(xenstore, xendev->fe, token)) {
|
||||
xen_be_printf(xendev, 0, "watching frontend path (%s) failed\n",
|
||||
xen_pv_printf(xendev, 0, "watching frontend path (%s) failed\n",
|
||||
xendev->fe);
|
||||
return -1;
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ static int xen_be_try_init(struct XenDevice *xendev)
|
|||
int rc = 0;
|
||||
|
||||
if (!xendev->online) {
|
||||
xen_be_printf(xendev, 1, "not online\n");
|
||||
xen_pv_printf(xendev, 1, "not online\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ static int xen_be_try_init(struct XenDevice *xendev)
|
|||
rc = xendev->ops->init(xendev);
|
||||
}
|
||||
if (rc != 0) {
|
||||
xen_be_printf(xendev, 1, "init() failed\n");
|
||||
xen_pv_printf(xendev, 1, "init() failed\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -308,9 +308,9 @@ static int xen_be_try_initialise(struct XenDevice *xendev)
|
|||
if (xendev->fe_state != XenbusStateInitialised &&
|
||||
xendev->fe_state != XenbusStateConnected) {
|
||||
if (xendev->ops->flags & DEVOPS_FLAG_IGNORE_STATE) {
|
||||
xen_be_printf(xendev, 2, "frontend not ready, ignoring\n");
|
||||
xen_pv_printf(xendev, 2, "frontend not ready, ignoring\n");
|
||||
} else {
|
||||
xen_be_printf(xendev, 2, "frontend not ready (yet)\n");
|
||||
xen_pv_printf(xendev, 2, "frontend not ready (yet)\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ static int xen_be_try_initialise(struct XenDevice *xendev)
|
|||
rc = xendev->ops->initialise(xendev);
|
||||
}
|
||||
if (rc != 0) {
|
||||
xen_be_printf(xendev, 0, "initialise() failed\n");
|
||||
xen_pv_printf(xendev, 0, "initialise() failed\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -340,9 +340,9 @@ static void xen_be_try_connected(struct XenDevice *xendev)
|
|||
|
||||
if (xendev->fe_state != XenbusStateConnected) {
|
||||
if (xendev->ops->flags & DEVOPS_FLAG_IGNORE_STATE) {
|
||||
xen_be_printf(xendev, 2, "frontend not ready, ignoring\n");
|
||||
xen_pv_printf(xendev, 2, "frontend not ready, ignoring\n");
|
||||
} else {
|
||||
xen_be_printf(xendev, 2, "frontend not ready (yet)\n");
|
||||
xen_pv_printf(xendev, 2, "frontend not ready (yet)\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ static int xen_be_try_reset(struct XenDevice *xendev)
|
|||
return -1;
|
||||
}
|
||||
|
||||
xen_be_printf(xendev, 1, "device reset (for re-connect)\n");
|
||||
xen_pv_printf(xendev, 1, "device reset (for re-connect)\n");
|
||||
xen_be_set_state(xendev, XenbusStateInitialising);
|
||||
return 0;
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ static int xenstore_scan(const char *type, int dom, struct XenDevOps *ops)
|
|||
snprintf(token, sizeof(token), "be:%p:%d:%p", type, dom, ops);
|
||||
snprintf(path, sizeof(path), "backend/%s/%d", type, dom);
|
||||
if (!xs_watch(xenstore, path, token)) {
|
||||
xen_be_printf(NULL, 0, "xen be: watching backend path (%s) failed\n",
|
||||
xen_pv_printf(NULL, 0, "xen be: watching backend path (%s) failed\n",
|
||||
path);
|
||||
return -1;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ int xen_be_init(void)
|
|||
{
|
||||
xenstore = xs_daemon_open();
|
||||
if (!xenstore) {
|
||||
xen_be_printf(NULL, 0, "can't connect to xenstored\n");
|
||||
xen_pv_printf(NULL, 0, "can't connect to xenstored\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -576,10 +576,10 @@ int xen_be_bind_evtchn(struct XenDevice *xendev)
|
|||
xendev->local_port = xenevtchn_bind_interdomain
|
||||
(xendev->evtchndev, xendev->dom, xendev->remote_port);
|
||||
if (xendev->local_port == -1) {
|
||||
xen_be_printf(xendev, 0, "xenevtchn_bind_interdomain failed\n");
|
||||
xen_pv_printf(xendev, 0, "xenevtchn_bind_interdomain failed\n");
|
||||
return -1;
|
||||
}
|
||||
xen_be_printf(xendev, 2, "bind evtchn port %d\n", xendev->local_port);
|
||||
xen_pv_printf(xendev, 2, "bind evtchn port %d\n", xendev->local_port);
|
||||
qemu_set_fd_handler(xenevtchn_fd(xendev->evtchndev),
|
||||
xen_be_evtchn_event, NULL, xendev);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue