浏览代码

hw/xen: Make XenDevOps structures const

Keep XenDevOps structures in .rodata.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Paul Durrant <paul@xen.org>
Message-Id: <20240510104908.76908-5-philmd@linaro.org>
Philippe Mathieu-Daudé 1 年之前
父节点
当前提交
d76795ea3d
共有 4 个文件被更改,包括 5 次插入5 次删除
  1. 1 1
      hw/9pfs/xen-9p-backend.c
  2. 2 2
      hw/display/xenfb.c
  3. 1 1
      hw/usb/xen-usb.c
  4. 1 1
      include/hw/xen/xen-legacy-backend.h

+ 1 - 1
hw/9pfs/xen-9p-backend.c

@@ -513,7 +513,7 @@ static void xen_9pfs_alloc(struct XenLegacyDevice *xendev)
     xenstore_write_be_int(xendev, "max-ring-page-order", MAX_RING_ORDER);
     xenstore_write_be_int(xendev, "max-ring-page-order", MAX_RING_ORDER);
 }
 }
 
 
-static struct XenDevOps xen_9pfs_ops = {
+static const struct XenDevOps xen_9pfs_ops = {
     .size       = sizeof(Xen9pfsDev),
     .size       = sizeof(Xen9pfsDev),
     .flags      = DEVOPS_FLAG_NEED_GNTDEV,
     .flags      = DEVOPS_FLAG_NEED_GNTDEV,
     .alloc      = xen_9pfs_alloc,
     .alloc      = xen_9pfs_alloc,

+ 2 - 2
hw/display/xenfb.c

@@ -972,7 +972,7 @@ static void fb_event(struct XenLegacyDevice *xendev)
 
 
 /* -------------------------------------------------------------------- */
 /* -------------------------------------------------------------------- */
 
 
-static struct XenDevOps xen_kbdmouse_ops = {
+static const struct XenDevOps xen_kbdmouse_ops = {
     .size       = sizeof(struct XenInput),
     .size       = sizeof(struct XenInput),
     .init       = input_init,
     .init       = input_init,
     .initialise = input_initialise,
     .initialise = input_initialise,
@@ -981,7 +981,7 @@ static struct XenDevOps xen_kbdmouse_ops = {
     .event      = input_event,
     .event      = input_event,
 };
 };
 
 
-struct XenDevOps xen_framebuffer_ops = {
+const struct XenDevOps xen_framebuffer_ops = {
     .size       = sizeof(struct XenFB),
     .size       = sizeof(struct XenFB),
     .init       = fb_init,
     .init       = fb_init,
     .initialise = fb_initialise,
     .initialise = fb_initialise,

+ 1 - 1
hw/usb/xen-usb.c

@@ -1083,7 +1083,7 @@ static void usbback_event(struct XenLegacyDevice *xendev)
     qemu_bh_schedule(usbif->bh);
     qemu_bh_schedule(usbif->bh);
 }
 }
 
 
-static struct XenDevOps xen_usb_ops = {
+static const struct XenDevOps xen_usb_ops = {
     .size            = sizeof(struct usbback_info),
     .size            = sizeof(struct usbback_info),
     .flags           = DEVOPS_FLAG_NEED_GNTDEV,
     .flags           = DEVOPS_FLAG_NEED_GNTDEV,
     .init            = usbback_init,
     .init            = usbback_init,

+ 1 - 1
include/hw/xen/xen-legacy-backend.h

@@ -67,7 +67,7 @@ static inline void xen_be_unmap_grant_ref(struct XenLegacyDevice *xendev,
 }
 }
 
 
 /* backend drivers not included in all machines */
 /* backend drivers not included in all machines */
-extern struct XenDevOps xen_framebuffer_ops;  /* xenfb.c */
+extern const struct XenDevOps xen_framebuffer_ops;  /* xenfb.c */
 
 
 /* configuration (aka xenbus setup) */
 /* configuration (aka xenbus setup) */
 void xen_config_cleanup(void);
 void xen_config_cleanup(void);