Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1554891
| Path | csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!proxad.net!feeder1-2.proxad.net!news.mixmin.net!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Jason Wang <jasowang@redhat.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] vhost: scsi: constify target_core_fabric_ops structures |
| Date | Tue, 10 Jan 2017 04:00:01 +0100 |
| Message-ID | <sXUPf-3V1-5@gated-at.bofh.it> (permalink) |
| References | <sXK3v-5SD-21@gated-at.bofh.it> |
| X-Original-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 |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Scanned-By | MIMEDefang 2.68 on 10.5.11.27 |
| X-Greylist | Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 10 Jan 2017 02:50:21 +0000 (UTC) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 65 |
| Organization | linux.* mail to news gateway |
| X-Original-Date | Tue, 10 Jan 2017 10:50:05 +0800 |
| X-Original-Message-ID | <933d05a8-aabd-0cd8-1adf-d36af62a8e0c@redhat.com> |
| X-Original-References | <1483975262-1260-1-git-send-email-bhumirks@gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1554891 |
Show key headers only | View raw
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>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] vhost: scsi: constify target_core_fabric_ops structures Bhumika Goyal <bhumirks@gmail.com> - 2017-01-09 16:30 +0100
Re: [PATCH] vhost: scsi: constify target_core_fabric_ops structures Jason Wang <jasowang@redhat.com> - 2017-01-10 04:00 +0100
Re: [PATCH] vhost: scsi: constify target_core_fabric_ops structures "Michael S. Tsirkin" <mst@redhat.com> - 2017-01-10 06:20 +0100
Re: [PATCH] vhost: scsi: constify target_core_fabric_ops structures Bhumika Goyal <bhumirks@gmail.com> - 2017-01-10 13:50 +0100
Re: [PATCH] vhost: scsi: constify target_core_fabric_ops structures "Michael S. Tsirkin" <mst@redhat.com> - 2017-01-10 16:20 +0100
csiph-web