Skip to content

Commit 9be0733

Browse files
sstabelliniBoris Ostrovsky
authored andcommitted
xen/pvcalls: initialize the module and register the xenbus backend
Keep a list of connected frontends. Use a semaphore to protect list accesses. Signed-off-by: Stefano Stabellini <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Reviewed-by: Juergen Gross <[email protected]> CC: [email protected] CC: [email protected] Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent 72e59c3 commit 9be0733

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/xen/pvcalls-back.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
#include <xen/xenbus.h>
2626
#include <xen/interface/io/pvcalls.h>
2727

28+
struct pvcalls_back_global {
29+
struct list_head frontends;
30+
struct semaphore frontends_lock;
31+
} pvcalls_back_global;
32+
2833
static int pvcalls_back_probe(struct xenbus_device *dev,
2934
const struct xenbus_device_id *id)
3035
{
@@ -59,3 +64,20 @@ static struct xenbus_driver pvcalls_back_driver = {
5964
.uevent = pvcalls_back_uevent,
6065
.otherend_changed = pvcalls_back_changed,
6166
};
67+
68+
static int __init pvcalls_back_init(void)
69+
{
70+
int ret;
71+
72+
if (!xen_domain())
73+
return -ENODEV;
74+
75+
ret = xenbus_register_backend(&pvcalls_back_driver);
76+
if (ret < 0)
77+
return ret;
78+
79+
sema_init(&pvcalls_back_global.frontends_lock, 1);
80+
INIT_LIST_HEAD(&pvcalls_back_global.frontends);
81+
return 0;
82+
}
83+
module_init(pvcalls_back_init);

0 commit comments

Comments
 (0)