virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Bhumika Goyal <bhumirks@gmail.com>,
	julia.lawall@lip6.fr, mst@redhat.com, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vhost: scsi: constify target_core_fabric_ops structures
Date: Tue, 10 Jan 2017 10:50:05 +0800	[thread overview]
Message-ID: <933d05a8-aabd-0cd8-1adf-d36af62a8e0c@redhat.com> (raw)
In-Reply-To: <1483975262-1260-1-git-send-email-bhumirks@gmail.com>



On 2017年01月09日 23:21, Bhumika Goyal wrote:
> 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 optional_qualifier@
> identifier i;
> position p;
> @@
> static struct target_core_fabric_ops i@p={...};
>
> @ok@
> position p;
> identifier r.i;
> @@
> (
> target_register_template(&i@p)
> |
> target_unregister_template(&i@p)
> )
> @bad@
> position p!={r.p,ok.p};
> identifier r.i;
> @@
> i@p
>
> @depends on !bad disable optional_qualifier@
> 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 <bhumirks@gmail.com>
> ---
>   drivers/vhost/scsi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 253310c..620366d 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -2087,7 +2087,7 @@ static void vhost_scsi_drop_tport(struct se_wwn *wwn)
>   	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,

Acked-by: Jason Wang <jasowang@redhat.com>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

       reply	other threads:[~2017-01-10  2:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1483975262-1260-1-git-send-email-bhumirks@gmail.com>
2017-01-10  2:50 ` Jason Wang [this message]
2017-01-10  5:11 ` [PATCH] vhost: scsi: constify target_core_fabric_ops structures Michael S. Tsirkin
2017-01-10 12:41   ` Bhumika Goyal
     [not found]   ` <CAOH+1jG4xohEaTTcgXPq2SA6T8yM-Q8oMEMS3iwyp+0RQnxkUg@mail.gmail.com>
2017-01-10 15:13     ` Michael S. Tsirkin
2017-01-09 15:21 Bhumika Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=933d05a8-aabd-0cd8-1adf-d36af62a8e0c@redhat.com \
    --to=jasowang@redhat.com \
    --cc=bhumirks@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).