Commit 1d822a40 authored by Bhumika Goyal's avatar Bhumika Goyal Committed by Michael S. Tsirkin

vhost: scsi: constify target_core_fabric_ops structures

Declare target_core_fabric_ops strucrues as const as they are only
passed as an argument to the functions target_register_template and
target_unregister_template. The arguments are of type const struct
target_core_fabric_ops *, so target_core_fabric_ops structures having
this property can be declared const.
Done using Coccinelle:

@r disable [email protected]
identifier i;
position p;
@@
static struct target_core_fabric_ops [email protected]={...};

@ok@
position p;
identifier r.i;
@@
(
target_register_template(&[email protected])
|
target_unregister_template(&[email protected])
)
@bad@
position p!={r.p,ok.p};
identifier r.i;
@@
[email protected]

@depends on !bad disable [email protected]
identifier r.i;
@@
+const
struct target_core_fabric_ops i;

File size before: drivers/vhost/scsi.o
   text	   data	    bss	    dec	    hex	filename
  18063	   2985	     40	  21088	   5260	drivers/vhost/scsi.o

File size after: drivers/vhost/scsi.o
   text	   data	    bss	    dec	    hex	filename
  18479	   2601	     40	  21120	   5280	drivers/vhost/scsi.o
Signed-off-by: Bhumika Goyal's avatarBhumika Goyal <[email protected]>
Signed-off-by: default avatarMichael S. Tsirkin <[email protected]>
Acked-by: default avatarJason Wang <[email protected]>
parent 49def185
......@@ -2087,7 +2087,7 @@ static struct configfs_attribute *vhost_scsi_wwn_attrs[] = {
NULL,
};
static struct target_core_fabric_ops vhost_scsi_ops = {
static const struct target_core_fabric_ops vhost_scsi_ops = {
.module = THIS_MODULE,
.name = "vhost",
.get_fabric_name = vhost_scsi_get_fabric_name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment